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