- java.lang.Object
-
- javafx.css.Selector
-
- Direct Known Subclasses:
CompoundSelector,SimpleSelector
public abstract class Selector extends Object
Used byCSSRuleto determine whether or not theSelectorapplies to a given object.- Since:
- 9
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanapplies(Styleable styleable)Gets whether thisSelectorapplies to the givenStyleable.abstract booleanapplies(Styleable styleable, Set<PseudoClass>[] triggerStates, int depth)Gets whether thisSelectorapplies to the givenStyleable.abstract MatchcreateMatch()Creates aMatch.static SelectorcreateSelector(String cssSelector)Creates aSelectorobject.intgetOrdinal()Gets the ordinal of this Selector.RulegetRule()Gets theRuleof this Selector.voidsetOrdinal(int ordinal)Sets the ordinal of this Selector.abstract booleanstateMatches(Styleable styleable, Set<PseudoClass> state)Determines whether the current state of theNodeand its parents matches the pseudo-classes defined (if any) for this selector.protected voidwriteBinary(DataOutputStream os, StyleConverter.StringStore stringStore)WritesSelectordata in binary form to givenDataOutputStream.
-
-
-
Method Detail
-
getRule
public Rule getRule()
Gets theRuleof this Selector.- Returns:
- rule
-
setOrdinal
public void setOrdinal(int ordinal)
Sets the ordinal of this Selector.- Parameters:
ordinal- the ordinal of this Selector
-
getOrdinal
public int getOrdinal()
Gets the ordinal of this Selector.- Returns:
- the ordinal of this Selector
-
createMatch
public abstract Match createMatch()
Creates aMatch.- Returns:
- match
-
applies
public abstract boolean applies(Styleable styleable)
Gets whether thisSelectorapplies to the givenStyleable.- Parameters:
styleable- theStyleableto match- Returns:
trueif thisSelectorapplies to the givenStyleable
-
applies
public abstract boolean applies(Styleable styleable, Set<PseudoClass>[] triggerStates, int depth)
Gets whether thisSelectorapplies to the givenStyleable. It is the same as theapplies(javafx.css.Styleable)method except it also returnsPseudoClassstate that it finds along the way.- Parameters:
styleable- theStyleableto matchtriggerStates- a set ofPseudoClassstatesdepth- depth of theNodeheirarchy to look for- Returns:
trueif thisSelectorand a set ofPseudoClassapplies to the givenStyleable
-
stateMatches
public abstract boolean stateMatches(Styleable styleable, Set<PseudoClass> state)
Determines whether the current state of theNodeand its parents matches the pseudo-classes defined (if any) for this selector.- Parameters:
styleable- the styleablestate- the state- Returns:
trueif the current state of the node and its parents matches the pseudo-classes defined (if any) for this selector
-
writeBinary
protected void writeBinary(DataOutputStream os, StyleConverter.StringStore stringStore) throws IOException
WritesSelectordata in binary form to givenDataOutputStream.- Parameters:
os-DataOutputStreamto writeSelectordata tostringStore- unused- Throws:
IOException- if writing toDataOutputStreamfails
-
-