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

public final Class CompoundSelector

extends Selector
Class Inheritance
Imports
java.util.Collection, .Collections, .List, .Set, java.util.stream.Collectors, javafx.css.PseudoClass, .Selector, .Styleable

A compound selector which behaves according to the CSS standard. The selector is composed of one or more Selectors, along with an array of CompoundSelectorRelationships indicating the required relationship at each stage. There must be exactly one less Combinator than there are selectors.

For example, the parameters [selector1, selector2, selector3] and [Combinator.CHILD, Combinator.DESCENDANT] will match a component when all of the following conditions hold:

  1. The component itself is matched by selector3
  2. The component has an ancestor which is matched by selector2
  3. The ancestor matched in step 2 is a direct CHILD of a component matched by selector1
In other words, the compound selector specified above is (in CSS syntax) selector1 > selector2 selector3. The greater-than (>) between selector1 and selector2 specifies a direct CHILD, whereas the whitespace between selector2 and selector3 corresponds to Combinator.DESCENDANT.

Field Summary

Modifier and TypeField and Description
private int
private final List<Combinator>
private final List<SimpleSelector>

Constructor Summary

AccessConstructor and Description
public
CompoundSelector(List<SimpleSelector> selectors, List<Combinator> relationships)

Creates a CompoundSelector from a list of selectors and a list of Combinator relationships.

Method Summary

Modifier and TypeMethod and Description
public boolean
applies(final Styleable
the Styleable to match
styleable
)

Implements abstract javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable.

public boolean
applies(final Styleable
the Styleable to match
styleable
,
Set<PseudoClass>[]
a set of PseudoClass states
triggerStates
,
int
depth of the Node hierarchy to look for
depth
)

Implements abstract javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable.

private boolean
applies(final Styleable styleable, final int index, Set<PseudoClass>[] triggerStates, int depth)

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

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

pack-priv List<Combinator>

Returns:

Immutable List<Combinator>
getRelationships
()

The relationships between the selectors

public List<SimpleSelector>

Returns:

Immutable List<SimpleSelector>
getSelectors
()

The selectors that make up this compound selector

public Set<String>
getStyleClassNames()

Implements abstract javafx.css.Selector.getStyleClassNames.

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

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
stateMatches(final Styleable
the styleable
styleable
,
Set<PseudoClass>
the state
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.

private boolean
stateMatches(Styleable styleable, Set<PseudoClass> states, int index)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from javafx.css.Selector:
createMatchcreateSelectorgetOrdinalgetRulesetOrdinal

Field Detail

hashback to summary
private int hash
relationshipsback to summary
private final List<Combinator> relationships
selectorsback to summary
private final List<SimpleSelector> selectors

Constructor Detail

CompoundSelectorback to summary
public CompoundSelector(List<SimpleSelector> selectors, List<Combinator> relationships)

Creates a CompoundSelector from a list of selectors and a list of Combinator relationships. There must be exactly one less Combinator than there are selectors.

Method Detail

appliesback to summary
public boolean applies(final Styleable styleable)

Implements abstract javafx.css.Selector.applies.

Doc from javafx.css.Selector.applies.

Gets whether this Selector applies to the given Styleable.

Parameters
styleable:Styleable

the Styleable to match

Returns:boolean

true if this Selector applies to the given Styleable

Annotations
@Override
appliesback to summary
public boolean applies(final Styleable styleable, Set<PseudoClass>[] triggerStates, 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.

Parameters
styleable:Styleable

the Styleable to match

triggerStates:Set<PseudoClass>[]

a set of PseudoClass states

depth:int

depth of the Node hierarchy to look for

Returns:boolean

true if this Selector and a set of PseudoClass applies to the given Styleable

Annotations
@Override
appliesback to summary
private boolean applies(final Styleable styleable, final int index, Set<PseudoClass>[] triggerStates, int depth)
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.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getRelationshipsback to summary
pack-priv List<Combinator> getRelationships()

The relationships between the selectors

Returns:List<Combinator>

Immutable List<Combinator>

getSelectorsback to summary
public List<SimpleSelector> getSelectors()

The selectors that make up this compound selector

Returns:List<SimpleSelector>

Immutable List<SimpleSelector>

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.

Returns:Set<String>

an immutable set with style class names, never null, or contains nulls, but can be empty

Annotations
@Override
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.
Returns:int

a hash code value for this object

Annotations
@Override
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.

Parameters
styleable:Styleable

the styleable

states:Set<PseudoClass>

the state

Returns:boolean

true if the current state of the node and its parents matches the pseudo-classes defined (if any) for this selector

Annotations
@Override
stateMatchesback to summary
private boolean stateMatches(Styleable styleable, Set<PseudoClass> states, int index)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override