Update: when I remove the <ui:style> section, create an external
ClientBundle and move the css rules into a new interface outside of
the Widget.java then it works however this workaround feels cumbersome
and now defeats the value of putting the CSS with the layout in
the .ui.xml file.  The @Shared works when the interface is created via
a ClientBundle but not when the UiBinder creates it which gives me the
impression something may differ in how UiBinder creates instances of
CssResource interfaces.  Is there anyone from UiBinder who could help
shed some light on the problem?

The workaround is as follows:
interface MyBundle extends ClientBundle{
...
@Source("widgetAStyle.css")
public WidgetAStyle getWidgetAStyle();
@Source("widgetBStyle.css")
public WidgetBStyle getWidgetAStyle();
...
}

then a new class file for each Widget:
interface WidgetX extends SharedStyle{
...
}
and finally in WidgetX.ui.xml
<ui:with field="bundle" tyle="MyBundle"></ui:with>

I hope this is not the "correct" way to use @Shared and that there is
some way to use it with UiBinder <ui:style> tags


On Mar 19, 2:14 pm, Will <[email protected]> wrote:
> My GWT 2.0.3 project uses UiBinder to create widgets and I wanted to
> use a shared CssResource to make each widget have a common runtime CSS
> class. I created my SharedStyle as follows:
>
> @Shared
> interface SharedStyle extends CssResource{
> public String test();
>
> }
>
> Then each WidgetX uses the following template:
> WidgetX.java:
> public WidgetX...{
>     public interface WidgetXStyle extends SharedStyle{
>     }
> ...}
>
> WidgetX.ui.xml:
> ...
> <ui:style type="WidgetX.WidgetXStyle">
> .test{
> ...}
>
> ...
> </ui:style>
>
> What ends up happening is that the style.test( ) for each different
> Widget (eg WidgetA & WidgetB) class is not identical.  I hoped to use
> this technique to allow a parent widget to treat each child widget the
> same when processing a browser event but it is not working.  Any
> guidance on what I'm doing wrong would be appreciated.

-- 
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