Class SimpleSelector
java.lang.Object
javafx.css.Selector
javafx.css.SimpleSelector
public final class SimpleSelector extends Selector
A simple selector which behaves according to the CSS standard.
- Since:
- 9
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
applies |
Gets whether this Selector applies to the given Styleable. |
boolean |
applies |
Gets whether this Selector applies to the given Styleable. |
Match |
createMatch() |
Creates a Match. |
String |
getId() |
Gets the value of the selector id. |
String |
getName() |
Gets the name of the java class to which this selector is applied, or *. |
NodeOrientation |
getNodeOrientation() |
Gets the NodeOrientation of this Selector. |
List<String> |
getStyleClasses() |
Gets an immutable list of style-classes of the Selector. |
Set<StyleClass> |
getStyleClassSet() |
Gets the immutable Set of StyleClasses of the Selector. |
boolean |
stateMatches |
Determines whether the current state of the Node and its parents matches the pseudo-classes defined (if any) for this selector. |
String |
toString() |
Converts this object to a string. |
protected final void |
writeBinary |
Writes Selector data in binary form to given DataOutputStream. |
Methods declared in class javafx.css.Selector
createSelector, getOrdinal, getRule, setOrdinal
Method Details
getName
public String getName()
Gets the name of the java class to which this selector is applied, or *.
- Returns:
- the name of the java class
getStyleClasses
public List<String> getStyleClasses()
Gets an immutable list of style-classes of the
Selector.- Returns:
- an immutable list of style-classes of the
Selector
getStyleClassSet
public Set<StyleClass> getStyleClassSet()
Gets the immutable
Set of StyleClasses of the Selector.- Returns:
- the
SetofStyleClasses
getId
public String getId()
Gets the value of the selector id.
- Returns:
- the value of the selector id, which may be an empty string
getNodeOrientation
public NodeOrientation getNodeOrientation()
Gets the
NodeOrientation of this Selector.- Returns:
- the
NodeOrientation
createMatch
public Match createMatch()
Description copied from class:
SelectorCreates a
Match.- Specified by:
-
createMatchin classSelector - Returns:
- a match, never
null
applies
public boolean applies(Styleable styleable)
Description copied from class:
SelectorGets whether this
Selector applies to the given Styleable.- Specified by:
-
appliesin classSelector - Parameters:
-
styleable- theStyleableto match - Returns:
-
trueif thisSelectorapplies to the givenStyleable
applies
public boolean applies(Styleable styleable, Set<PseudoClass>[] pseudoClasses, int depth)
Description copied from class:
SelectorGets whether this
Selector applies to the given Styleable. It is the same as the Selector.applies(javafx.css.Styleable) method except it also returns PseudoClass state that it finds along the way.- Specified by:
-
appliesin classSelector - Parameters:
-
styleable- theStyleableto match -
pseudoClasses- a set ofPseudoClassstates -
depth- depth of theNodeheirarchy to look for - Returns:
-
trueif thisSelectorand a set ofPseudoClassapplies to the givenStyleable
stateMatches
public boolean stateMatches(Styleable styleable, Set<PseudoClass> states)
Description copied from class:
SelectorDetermines whether the current state of the
Node and its parents matches the pseudo-classes defined (if any) for this selector.- Specified by:
-
stateMatchesin classSelector - Parameters:
-
styleable- the styleable -
states- the state - Returns:
-
trueif the current state of the node and its parents matches the pseudo-classes defined (if any) for this selector
toString
public String toString()
Converts this object to a string.
- Overrides:
-
toStringin classObject
writeBinary
protected final void writeBinary(DataOutputStream os, StyleConverter.StringStore stringStore) throws IOException
Description copied from class:
SelectorWrites
Selector data in binary form to given DataOutputStream.- Overrides:
-
writeBinaryin classSelector - Parameters:
-
os-DataOutputStreamto writeSelectordata to -
stringStore- unused - Throws:
-
IOException- if writing toDataOutputStreamfails
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.