Package com.google.gwt.resources.client
Annotation Type CssResource.Shared
-
@Documented @Retention(RUNTIME) @Target(TYPE) public static @interface CssResource.SharedIndicates 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 theFocusCssinterface is tagged with@Shared, thefocused()method on the instance ofPanelCsswill match the.focusedparent selector ininput.css.The effect of inheriting an
Sharedinterface can be replicated by use use of theCssResource.Importannotation (e.g..FocusCss-focused .widget), however the use of state-bearing descendant selectors is common enough to warrant an easier use-case.