Hi Pavel,

One bit of optimization you might consider is changing GlobalRes from
a concrete class to a CssResource and move the method definitions to a
style-sheet as in:

------- GlobalRes.java --------
@ImportedWithPrefix("global")
public interface GlobalRes extends CssResource {
       String gap();
       String doubleGap();
       String mainColor();
}
------- GlobalRes.css --------
@def gap 10px;
@def doubleGap 20px;
@def mainColor #e6dbcf;
--------- end code ------------

Then you can import GlobalRes into ControlPanel, sort of like this:

----- ControlPanelResources.java -----
public interface ControlPanelResources extends ClientBundle {

    public interface ControlPanelStyle extends CssResource {
        String body();
        String header();
    }

    @Import(GlobalRes.class)
    @Source("ControlPanel.css")
    public ControlPanelStyle controlPanelStyle();
}

------------------ ControlPanel.css: ------------------

body {
        padding: value('global.gap');
}

.header {
        background: value('global.mainColor');
        margin-bottom: value('global.gap2');
}

------------------ end code ----------------

Using CssResource constants inside UiBinder template style tags gets a
little nastier. As far as I know, you need to use those @eval
directives on local variables within the tag just like your example. I
dealt with same thing yesterday:
see:  http://code.google.com/p/google-web-toolkit/issues/detail?id=4420&sort=-id
see:  
http://groups.google.com/group/google-web-toolkit-contributors/t/ca91dbdeaa6f93e8

Hope this helps,
Jeff

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to