CssResource.Shared (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT

## com.google.gwt.resources.client
Annotation Type CssResource.Shared

    @Documented
    @Retention(value=RUNTIME)
    @Target(value=TYPE)
    public static @interface CssResource.Shared

Indicates that the String accessor methods defined in a CssResource will return the same values across all implementations of that type.

This is an example of "stateful" class selectors being used:

    @Shared
     interface FocusCss extends CssResource {
       String focused();
       String unfocused();
     }

     interface PanelCss extends CssResource, FocusCss {
       String widget();
     }

     interface InputCss extends CssResource, FocusCss {
       String widget();
     }

     input.css:
     *.focused .widget {border: thin solid blue;}

     Application.java:
     myPanel.add(myInputWidget);
     myPanel.addStyleName(instanceOfPanelCss.focused());

Because the `FocusCss` interface is tagged with `@Shared`, the `focused()` method on the instance of `PanelCss` will match the `.focused` parent selector in `input.css`.

The effect of inheriting an `Shared` interface can be replicated by use use of the `CssResource.Import` annotation (e.g. `.FocusCss-focused .widget`), however the use of state-bearing descendant selectors is common enough to warrant an easier use-case.

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT