public class NthChildSelector extends Object implements Selector
Equivalent to :nth-child selector in CSS. Its specificity is (0,0,1,0).
The index is stored as a byte for heap optimization and therefore cannot exceed 255.
Widget.getParent(),
SelectorHelper| Constructor and Description |
|---|
NthChildSelector(int index)
Creates a nth child selector.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
appliesToWidget(Widget widget)
Checks whether or not this selector applies to the given widget.
|
int |
getSpecificity()
Returns the specificity of this selector.
|
public NthChildSelector(int index)
The given index is clamped between 0 and 255.
index - the index of the child.public boolean appliesToWidget(Widget widget)
SelectorappliesToWidget in interface Selectorwidget - the widget to test.true if this selectors applies to the given widget, false otherwise.public int getSpecificity()
SelectorThe 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):
SelectorHelper provides a method to
compute the specificity of a selector.getSpecificity in interface Selector