@Documented
@Retention(value=RUNTIME)
@Target(value=TYPE)
public static @interface CssResource.Shared
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.