I have a GWT 2.4 application which has many UiBinders within different client packages, set out the same as below:
com.xxx
com.xxx.client
com.xxx.client.package1
com.xxx.client.package2
com.xxx.client.package3
war
In my ui.xml files I am having to reference the stylesheet.css file which is within the same package as the UiBinder. I've been trying to reference the global_stylesheet.css file but am having no luck. Ideally I would like to be able to still use the {style.xxx} method of applying a style.
You can use a central ClientBundle with a CssResource for @Source("global_stylesheet.css")
, and reference it from your UiBinder templates:
<ui:with type="mypackage.client.MyClientBundle" field="myClientBundle"/>
So you can use it like:
<g:Label addStyleNames="{myClientBundle.myCssResource.example}"/>
But you would have to put global_stylesheet.css somewhere in your classpath - otherwise it cannot possibly be compiled.
Also, don't forget to call ensureInjected() on your CssResource.