-
11 Dec 2008 12:18 AM #1
Changing default theme
Changing default theme
I have looked at sample of how to change the default theme to something else on start up but cannot get it to work.
The following is in my onModuleLoad ( first 2 lines).
This is done in a class which implements LayoutContainer.
ThemeManager.register(Slate.SLATE);
GXT.setDefaultTheme(Slate.SLATE, true);
This does not work the theme stays the blue default theme when I launch the app.
-
11 Dec 2008 12:56 AM #2
did you add the custom themes in the module.gwt.xml ???
GXT JavaDocs: http://extjs.com/deploy/gxtdocs/
GXT FAQ & Wiki: http://extjs.com/learn/Learn_About_the_Ext_GWT_Library
Buy the Book on GXT: http://www.apress.com/book/view/9781430219408
Follow me on Twitter: http://twitter.com/gslender
-
11 Dec 2008 1:02 AM #3
Should I do that for SLATE ?
Should I do that for SLATE ?
<inherits name="com.extjs.gxt.themes.Themes"/>
What should it be for slate ?
-
11 Dec 2008 1:33 AM #4
ok, the problem is that your base class, with the onModuleLoad is extending a GXT widget (maybe layoutcontainer or contentpanel or window etc??)... as such, it extends Component which calls GXT.init before you've set the default theme.
You need to have a plain class, that just implement EntryPoint
Like so....
Code:public class Test implements EntryPoint { public void onModuleLoad() { ThemeManager.register(Slate.SLATE); GXT.setDefaultTheme(Slate.SLATE, true);GXT JavaDocs: http://extjs.com/deploy/gxtdocs/
GXT FAQ & Wiki: http://extjs.com/learn/Learn_About_the_Ext_GWT_Library
Buy the Book on GXT: http://www.apress.com/book/view/9781430219408
Follow me on Twitter: http://twitter.com/gslender
-
11 Dec 2008 5:03 AM #5
No luck
No luck
I have removed all my code and just have the following but this no luck
public class LifeCockpit implements com.google.gwt.core.client.EntryPoint{
final Viewport v = new Viewport();
public void onModuleLoad() {
ThemeManager.register(Slate.SLATE);
GXT.setDefaultTheme(Slate.SLATE, true);
RootPanel.get().add(new Button("test"));
MessageBox.alert("test", "test", null);
}
}
-
11 Dec 2008 5:28 AM #6
remove the final Viewport v = new Viewport() - this creates an Component class (and calls GXT.init) before you set the default theme... remember as I said before.
try just this...
Code:public void onModuleLoad() { ThemeManager.register(Slate.SLATE); GXT.setDefaultTheme(Slate.SLATE, true); RootPanel.get().add(new Button("test")); MessageBox.alert("test", "test", null); } }GXT JavaDocs: http://extjs.com/deploy/gxtdocs/
GXT FAQ & Wiki: http://extjs.com/learn/Learn_About_the_Ext_GWT_Library
Buy the Book on GXT: http://www.apress.com/book/view/9781430219408
Follow me on Twitter: http://twitter.com/gslender
-
11 Dec 2008 9:04 AM #7
If you aren't planning on having the switcher in you UI, you can just put this in your html head tag
Code:<link rel="stylesheet" type="text/css" href="css/ext-all.css" /> <link rel="stylesheet" type="text/css" href="css/xtheme-slate.css" />
-
17 Dec 2008 6:39 AM #8
Hi,
You need to do something like this:
If you extend your class from Viewport the GXT.init() is executed first than GXT.setDefaultTheme(...).Code:public class App implements EntryPoint { private Viewport viewport; public Layout() { } public void onModuleLoad() { // Themes ThemeManager.register(Slate.SLATE); GXT.setDefaultTheme(Slate.SLATE, true); viewport = new Viewport() { @Override protected void onRender(Element parent, int pos) { super.onRender(parent, pos); } }; RootPanel.get().add(viewport); } }
Regards,--
Pedro Sousa


Reply With Quote
