PDA

View Full Version : Setting a theme



andap
29 Aug 2011, 2:07 AM
Hello,

From what I read, the setting of the theme for an application is done only in the Entrypoint class. I tried setting it in other places, but it had no effect.

Is there any way I can set it somewhere else except the Entrypoint? Because I am loading some user preferences and the loading does not take place in the Entrypoint.

Thanks in advance,

Anda

micgala
30 Aug 2011, 5:55 AM
Hi.

I use a menu for setting the style. The styles can be changed at any time.
This is how I do the chage:



CSS.removeStyleSheet("gxt_theme");
CSS.addStyleSheet("gxt_theme", newThemeUrl);


Where newThemeUrl contains the path to one of the gxt css files (gxt-all.css, gxt-gray.css, or xtheme-slate.css, for example).

andap
30 Aug 2011, 10:29 AM
Hi,

Thank you for the answer, but I was looking for a Java code sample for this.

micgala
30 Aug 2011, 11:09 PM
That is exactly what I pasted you...
CSS is a GXT class.

Regards,
Michel.

andap
31 Aug 2011, 12:27 AM
Yes, you are right, it is a GWT class. But now my question would be: how to link the "id" that has to be passed to the remove and add stylesheet methods to the actual path of the .css file? I see that the add method has a url in its parameter list, but how does the remove know what to remove?

Thanks in advance

micgala
31 Aug 2011, 12:38 AM
"gxt_theme" is the id used by gxt... so simply stick with that.
Removing the style "gxt_theme" will remove the current theme.
Simply then add the new one using also that id.