Results 1 to 7 of 7

Thread: ThemeSelector

  1. #1

    Default ThemeSelector

    Hello,
    im trying to make a ThemeSelector, the biggest problem: im kinda new to ExtGWT so i need help.

    i searched the forum and found some information about it, i now have the code:
    Code:
        
        ThemeManager.register(Slate.SLATE);
        Slate.SLATE.set("file", "resources/themes/slate/css/xtheme-slate.css");
        Theme.GRAY.set("file","resources/css/gxt-gray.css");
        Theme.BLUE.set("file","resources/css/gxt-all.css");
        north.add(new ThemeSelector())
    and in the xml file:
    Code:
    <inherits name='com.extjs.gxt.themes.Themes'/>
    AND in the html file:
    Code:
    <link rel="stylesheet" type="text/css" href="resources/themes/slate/css/xtheme-slate.css" />
    for blue and gray it works perfekt, but if i try to use slate, it crashes with a NullPointer Exception and i have to reset the theme using
    Code:
    GXT.setDefaultTheme(Theme.BLUE, true);
    in the onModuleLoad method

    i tried everything, i placed the slate theme in every place it could belong, i changed every path in the code, i even made the "Slate" class new and changed the path there but i always get the same error.
    i want to add custom themes later (dont know how right now...) but i cant even get that one to work, can someone help me?

  2. #2
    Sencha User
    Join Date
    Nov 2007
    Posts
    20

    Default

    Blue and gray themes are built in, so no configuration required for those.

    To use ThemeManager put this into your project gwt.xml
    Code:
    <inherits name="com.extjs.gxt.themes.Themes"/>
    To use Slate add this to the begining of onModuleLoad():

    Code:
    ThemeManager.register(new Slate());
    No other settings are required assuming you are using latest GXT.

  3. #3

    Default

    first of all: thank you for your response

    it worked, i now can use the Slate theme, BUT i cant use any other ^^
    i was using the ThemeSelector, but i cant change themes anymore its just using slate as default i cant switch to themes

    eidt: ok got it, everything works perfekt now, thanks again ^^

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    2

    Default

    I have exactly the same problem.
    I have inserted
    Code:
    <inherits name="com.extjs.gxt.themes.Themes"/>
    into my project's gwt.xml

    In the beginning of my entry point's onModuleLoad() I have the following code:

    Code:
                ThemeManager.register(new Access());
                GXT.setDefaultTheme(Access.ACCESS, false); //set default theme to new SLATE skin
                
                 
                 Theme.BLUE.set("file","css/gxt-all.css"); //set custom css'es path for standard blue theme
                 Slate.SLATE.set("file","themes/slate/css/xtheme-slate.css"); //set custom path for SLATE theme
                 Access.ACCESS.set("file", "themes/access/css/xtheme-access.css");
    and finally when my project is compiled I change the html file by inserting:
    Code:
        <link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css"/>
        <link type="text/css" rel="stylesheet" href="resources/themes/access/css/xtheme-access.css"/>
        <link rel="stylesheet" type="text/css" href="resources/css/gxt-gray.css"/>
        <link type="text/css" rel="stylesheet" href="resources/themes/slate/css/xtheme-slate.css"/>
    However, the themeselector does not work. It refreshes the page but the theme doesn't. I can manually set the theme by changing the order of the css files in the html file, i.e., the last one in that order is always the one used as the default theme.

    Could someone help me figure out why?
    Thank you in advance!

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    79

    Default

    You are going very complex way. See how the theme selector is done in the default explorer demo
    http://www.sencha.com/examples/

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    2

    Default

    Thanks for the reply. But while I can view the source code for the examples in the demo, I cant actually see the code for the default explorer demo and its themeselector (there isn't a source button in the default page). Am I doing something wrong?

    Can you attach the source code so that I can understand?

  7. #7
    Sencha User
    Join Date
    Mar 2011
    Posts
    79

    Default

    When you download GXT from sencha site all the demo sources are also in the archive

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •