Top Description Fields Constructors Methods
com.sun.javafx.css

public final Class SimpleSelector

extends Selector
Class Inheritance
Imports
com.sun.javafx.css.media.MediaQueryContext, .MediaRule, com.sun.javafx.scene.NodeHelper, javafx.css.PseudoClass, .Rule, .Selector, .StyleClass, .Styleable, javafx.geometry.NodeOrientation, javafx.scene.Node, java.util.ArrayList, .HashMap, .Iterator, .List, .Map, .Set, java.util.stream.Collectors

A simple selector which behaves according to the CSS standard.

Field Summary

Modifier and TypeField and Description
private transient Set<StyleClass>
cachedStyleClasses

Cache to avoid having to recreate this set on each call.

private final String
private final boolean
private final boolean
private final boolean
private final String
name

If specified in the CSS file, the name of the java class to which this selector is applied.

private final NodeOrientation
private final Set<PseudoClass>
private final FixedCapacitySet<String>
selectorStyleClassNames

Style class names (immutable).

private static final List<StyleClass>
private static final Map<String, Integer>

Constructor Summary

AccessConstructor and Description
public
SimpleSelector(final String name, final List<String> styleClasses, final List<String> pseudoClasses, final String id)

Method Summary

Modifier and TypeMethod and Description
public boolean
applies(Styleable styleable)

Implements abstract javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable.

public boolean
applies(Styleable styleable, Set<PseudoClass>[] pseudoClasses, int depth)

Implements abstract javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable.

private FixedCapacitySet<String>
public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public String

Returns:

the value of the selector id, which may be an empty string
getId
()

Gets the value of the selector id.

public String

Returns:

the name of the java class
getName
()

Gets the name of the java class to which this selector is applied, or *.

public NodeOrientation

Returns:

the NodeOrientation
getNodeOrientation
()

Gets the NodeOrientation of this Selector.

public Set<PseudoClass>
private static StyleClass
getStyleClass(String styleClass)

public List<String>

Returns:

an immutable list of style-classes of the Selector
getStyleClasses
()

Gets an immutable list of style-classes of the Selector.

public Set<String>
getStyleClassNames()

Implements abstract javafx.css.Selector.getStyleClassNames.

Gets the immutable set of style class names of this Selector.

public Set<StyleClass>

Returns:

the Set of StyleClasses
getStyleClassSet
()

Gets the immutable Set of StyleClasses of the Selector.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private boolean
matchesStyleClasses(List<String> styleClassNames)

public boolean
stateMatches(final Styleable styleable, Set<PseudoClass> states)

Implements abstract javafx.css.Selector.stateMatches.

Determines whether the current state of the Node and its parents matches the pseudo-classes defined (if any) for this selector.

public String
toString()

Overrides java.lang.Object.toString.

Converts this object to a string.

Inherited from javafx.css.Selector:
createMatchcreateSelectorgetOrdinalgetRulesetOrdinal

Field Detail

cachedStyleClassesback to summary
private transient Set<StyleClass> cachedStyleClasses

Cache to avoid having to recreate this set on each call.

idback to summary
private final String id
matchOnIdback to summary
private final boolean matchOnId
matchOnNameback to summary
private final boolean matchOnName
matchOnStyleClassback to summary
private final boolean matchOnStyleClass
nameback to summary
private final String name

If specified in the CSS file, the name of the java class to which this selector is applied. For example, if the CSS file had:

  Rectangle { }
then name would be "Rectangle".
nodeOrientationback to summary
private final NodeOrientation nodeOrientation
pseudoClassStateback to summary
private final Set<PseudoClass> pseudoClassState
selectorStyleClassNamesback to summary
private final FixedCapacitySet<String> selectorStyleClassNames

Style class names (immutable).

styleClassesback to summary
private static final List<StyleClass> styleClasses
styleClassMapback to summary
private static final Map<String, Integer> styleClassMap

Constructor Detail

SimpleSelectorback to summary
public SimpleSelector(final String name, final List<String> styleClasses, final List<String> pseudoClasses, final String id)

Method Detail

appliesback to summary
public boolean applies(Styleable styleable)

Implements abstract javafx.css.Selector.applies.

Doc from javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable.

Annotations
@Override
appliesback to summary
public boolean applies(Styleable styleable, Set<PseudoClass>[] pseudoClasses, int depth)

Implements abstract javafx.css.Selector.applies.

Doc from javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable. It is the same as the applies(Styleable) method except it also returns PseudoClass state that it finds along the way.

Annotations
@Override
convertStyleClassNamesToSetback to summary
private FixedCapacitySet<String> convertStyleClassNamesToSet(List<String> styleClasses)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getIdback to summary
public String getId()

Gets the value of the selector id.

Returns:String

the value of the selector id, which may be an empty string

getNameback to summary
public String getName()

Gets the name of the java class to which this selector is applied, or *.

Returns:String

the name of the java class

getNodeOrientationback to summary
public NodeOrientation getNodeOrientation()

Gets the NodeOrientation of this Selector.

Returns:NodeOrientation

the NodeOrientation

getPseudoClassStatesback to summary
public Set<PseudoClass> getPseudoClassStates()
getStyleClassback to summary
private static StyleClass getStyleClass(String styleClass)
getStyleClassesback to summary
public List<String> getStyleClasses()

Gets an immutable list of style-classes of the Selector.

Returns:List<String>

an immutable list of style-classes of the Selector

getStyleClassNamesback to summary
public Set<String> getStyleClassNames()

Implements abstract javafx.css.Selector.getStyleClassNames.

Doc from javafx.css.Selector.getStyleClassNames.

Gets the immutable set of style class names of this Selector.

Annotations
@Override
getStyleClassSetback to summary
public Set<StyleClass> getStyleClassSet()

Gets the immutable Set of StyleClasses of the Selector.

Returns:Set<StyleClass>

the Set of StyleClasses

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
matchesStyleClassesback to summary
private boolean matchesStyleClasses(List<String> styleClassNames)
stateMatchesback to summary
public boolean stateMatches(final Styleable styleable, Set<PseudoClass> states)

Implements abstract javafx.css.Selector.stateMatches.

Doc from javafx.css.Selector.stateMatches.

Determines whether the current state of the Node and its parents matches the pseudo-classes defined (if any) for this selector.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Converts this object to a string.

Annotations
@Override