Package ej.mwt.stylesheet.selector
Interface Selector
-
- All Known Implementing Classes:
AdjacentSiblingCombinator,AndCombinator,ChildCombinator,ClassSelector,Combinator,DescendantCombinator,DisabledSelector,EnabledSelector,EvenChildSelector,FirstChildSelector,GeneralSiblingCombinator,LastChildSelector,NotSelector,NthChildSelector,OddChildSelector,RootSelector,StateSelector,StrictTypeSelector,TypeSelector,UniversalSelector
public interface SelectorRepresents a selector.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanappliesToWidget(Widget widget)Checks whether or not this selector applies to the given widget.booleanequals(java.lang.Object obj)intgetSpecificity()Returns the specificity of this selector.
-
-
-
Method Detail
-
appliesToWidget
boolean appliesToWidget(Widget widget)
Checks whether or not this selector applies to the given widget.- Parameters:
widget- the widget to test.- Returns:
trueif this selectors applies to the given widget,falseotherwise.
-
getSpecificity
int getSpecificity()
Returns the specificity of this selector.The specificity allows to determine in which order the rules of a stylesheet should be applied.
A specificity is composed of four numbers (defined by CSS2 specification):
- count 1 if the declaration is from is a 'style' attribute rather than a rule with a selector, 0 otherwise (= a)
- count the number of ID attributes in the selector (= b)
- count the number of other attributes and pseudo-classes in the selector (= c)
- count the number of widget names and pseudo-widgets in the selector (= d)
SelectorHelperprovides a method to compute the specificity of a selector.- Returns:
- the specificity of this selector.
-
equals
boolean equals(@Nullable java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
-