Home » Eclipse Projects » Remote Application Platform (RAP) » Switching theme
|
Re: Switching theme [message #85957 is a reply to message #85942] |
Mon, 05 May 2008 15:32 |
Eclipse User |
|
|
|
Originally posted by: rsternberg.innoopract.com
Hi Markus,
switching the theme at runtime is currently not supported by RAP.
Although it should be technically possible, we experienced some trouble
on the client-side when switching themes. I hope that we can support
this scenario with the next qooxdoo version, i.e. in RAP 1.2, but I
cannot promise.
If you like, you can play with the code below but remember that this is
non-API and will probably not work perfectly:
button.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( SelectionEvent e ) {
String[] themeIds = ThemeUtil.getAvailableThemeIds();
String currId = ThemeUtil.getCurrentThemeId();
int index = 0;
for( int i = 0; i < themeIds.length; i++ ) {
if( currId.equals( themeIds[ i ] ) ) {
index = i;
}
}
index = ( index + 1 ) % themeIds.length;
ThemeUtil.setCurrentThemeId( themeIds[ index ] );
}
} );
Best regards,
Ralf
Markus Krüger wrote:
> Hi,
> is it possible to switch a theme on the fly through code (i.e. pushing a
> button)?
>
> Regards,
> Markus
>
>
|
|
|
Re: Switching theme [message #85986 is a reply to message #85957] |
Mon, 05 May 2008 16:09 |
Eclipse User |
|
|
|
Originally posted by: rsternberg.innoopract.com
I forgot that if you try this, you will likely need to re-layout() all
Shells after switching the theme.
Ralf
Ralf Sternberg wrote:
> Hi Markus,
>
> switching the theme at runtime is currently not supported by RAP.
> Although it should be technically possible, we experienced some trouble
> on the client-side when switching themes. I hope that we can support
> this scenario with the next qooxdoo version, i.e. in RAP 1.2, but I
> cannot promise.
>
> If you like, you can play with the code below but remember that this is
> non-API and will probably not work perfectly:
>
> button.addSelectionListener( new SelectionAdapter() {
> public void widgetSelected( SelectionEvent e ) {
> String[] themeIds = ThemeUtil.getAvailableThemeIds();
> String currId = ThemeUtil.getCurrentThemeId();
> int index = 0;
> for( int i = 0; i < themeIds.length; i++ ) {
> if( currId.equals( themeIds[ i ] ) ) {
> index = i;
> }
> }
> index = ( index + 1 ) % themeIds.length;
> ThemeUtil.setCurrentThemeId( themeIds[ index ] );
> }
> } );
>
> Best regards,
> Ralf
>
> Markus Krüger wrote:
>> Hi,
>> is it possible to switch a theme on the fly through code (i.e. pushing
>> a button)?
>>
>> Regards,
>> Markus
>>
|
|
|
Re: Switching theme [message #119293 is a reply to message #85986] |
Fri, 23 January 2009 08:26 |
Eclipse User |
|
|
|
Originally posted by: g.yonchev.bers-soft.com
Hi all,
I'm using the latest version (1.2 m4), and want to ask, is it supported
already "theme switching" or not ?
I make a simple code to check it out
....
....
ThemeUtil.setCurrentThemeId(themeId);
window.getShell().layout(true, true);
This is from IAction in the MenuBar (radio buttons for each theme)
so, when I run the workbench and switch the theme everything works, only
if there is no Widget(shell) opened before that.
for example: if I start the workbench and open some Shell, close it and
then switch the theme, this errors occurs:
Could not evaluate javascript response:
TypeError: this._layoutChanges is null
org.eclipse.swt.EventUtil.suspendEventHandling();var req =
org.eclipse.swt.Request.getInstance();req.setRequestCounter( "12"
);qx.theme.manager.Meta.getInstance().setTheme(
org.eclipse.swt.theme.Custom_2 );var wm =
org.eclipse.swt.WidgetManager.getInstance();var w = wm.findWidgetById(
"w6" );w.setSpace( 3, 1272, 3, 20
);qx.ui.core.Widget.flushGlobalQueues();org.eclipse.swt.Even tUtil.resumeEventHandling();
Am I doing something wrong? I think this
> window.getShell().layout(true, true);
is enough to re-layout all shells or not?
TIA
George
Ralf Sternberg wrote:
> I forgot that if you try this, you will likely need to re-layout() all
> Shells after switching the theme.
>
> Ralf
>
> Ralf Sternberg wrote:
>> Hi Markus,
>>
>> switching the theme at runtime is currently not supported by RAP.
>> Although it should be technically possible, we experienced some
>> trouble on the client-side when switching themes. I hope that we can
>> support this scenario with the next qooxdoo version, i.e. in RAP 1.2,
>> but I cannot promise.
>>
>> If you like, you can play with the code below but remember that this
>> is non-API and will probably not work perfectly:
>>
>> button.addSelectionListener( new SelectionAdapter() {
>> public void widgetSelected( SelectionEvent e ) {
>> String[] themeIds = ThemeUtil.getAvailableThemeIds();
>> String currId = ThemeUtil.getCurrentThemeId();
>> int index = 0;
>> for( int i = 0; i < themeIds.length; i++ ) {
>> if( currId.equals( themeIds[ i ] ) ) {
>> index = i;
>> }
>> }
>> index = ( index + 1 ) % themeIds.length;
>> ThemeUtil.setCurrentThemeId( themeIds[ index ] );
>> }
>> } );
>>
>> Best regards,
>> Ralf
>>
>> Markus Krüger wrote:
>>> Hi,
>>> is it possible to switch a theme on the fly through code (i.e.
>>> pushing a button)?
>>>
>>> Regards,
>>> Markus
>>>
|
|
|
Re: Switching theme [message #119319 is a reply to message #119293] |
Fri, 23 January 2009 09:26 |
|
Hi Georgi,
I am sorry to say, but switching themes at runtime is currently not on
our agenda for RAP 1.2. Thus, it's unlikely that we find the time to
look into this issue in the next time.
Anyway, feel free to file an enhancement request in our bugzilla.
See also my inline comments below.
Regards,
Ralf
Georgi Yonchev wrote:
> Hi all,
> I'm using the latest version (1.2 m4), and want to ask, is it supported
> already "theme switching" or not ?
>
> I make a simple code to check it out
>
> ...
> ...
> ThemeUtil.setCurrentThemeId(themeId);
> window.getShell().layout(true, true);
>
> This is from IAction in the MenuBar (radio buttons for each theme)
> so, when I run the workbench and switch the theme everything works, only
> if there is no Widget(shell) opened before that.
> for example: if I start the workbench and open some Shell, close it and
> then switch the theme, this errors occurs:
>
> Could not evaluate javascript response:
>
> TypeError: this._layoutChanges is null
>
> org.eclipse.swt.EventUtil.suspendEventHandling();var req =
> org.eclipse.swt.Request.getInstance();req.setRequestCounter( "12"
> );qx.theme.manager.Meta.getInstance().setTheme(
> org.eclipse.swt.theme.Custom_2 );var wm =
> org.eclipse.swt.WidgetManager.getInstance();var w = wm.findWidgetById(
> "w6" );w.setSpace( 3, 1272, 3, 20
> );qx.ui.core.Widget.flushGlobalQueues();org.eclipse.swt.Even tUtil.resumeEventHandling();
This is obviously a Javascript error that occurs in qooxdoo code (class
qx.ui.core.Widget). Maybe the qooxdoo people can help with that?
See http://qooxdoo.org/community/mailing_lists
> Am I doing something wrong? I think this
>> window.getShell().layout(true, true);
>
> is enough to re-layout all shells or not?
No, this only re-layouts the main shell. If there are more (probably
hidden) shells, you can acquire a reference using Display.getShells()
and re-layout them all.
However, I don't think that the missing re-layout causes the error...
> TIA
> George
>
> Ralf Sternberg wrote:
>> I forgot that if you try this, you will likely need to re-layout() all
>> Shells after switching the theme.
>>
>> Ralf
>>
>> Ralf Sternberg wrote:
>>> Hi Markus,
>>>
>>> switching the theme at runtime is currently not supported by RAP.
>>> Although it should be technically possible, we experienced some
>>> trouble on the client-side when switching themes. I hope that we can
>>> support this scenario with the next qooxdoo version, i.e. in RAP 1.2,
>>> but I cannot promise.
>>>
>>> If you like, you can play with the code below but remember that this
>>> is non-API and will probably not work perfectly:
>>>
>>> button.addSelectionListener( new SelectionAdapter() {
>>> public void widgetSelected( SelectionEvent e ) {
>>> String[] themeIds = ThemeUtil.getAvailableThemeIds();
>>> String currId = ThemeUtil.getCurrentThemeId();
>>> int index = 0;
>>> for( int i = 0; i < themeIds.length; i++ ) {
>>> if( currId.equals( themeIds[ i ] ) ) {
>>> index = i;
>>> }
>>> }
>>> index = ( index + 1 ) % themeIds.length;
>>> ThemeUtil.setCurrentThemeId( themeIds[ index ] );
>>> }
>>> } );
>>>
>>> Best regards,
>>> Ralf
>>>
>>> Markus Krüger wrote:
>>>> Hi,
>>>> is it possible to switch a theme on the fly through code (i.e.
>>>> pushing a button)?
>>>>
>>>> Regards,
>>>> Markus
>>>>
|
|
|
Goto Forum:
Current Time: Fri Apr 26 00:53:07 GMT 2024
Powered by FUDForum. Page generated in 0.03442 seconds
|