- Type Parameters:
T- the element type
- All Known Implementing Classes:
AbstractSelectorModel,DocumentSelectorModel,StyleableSelectorModel
public interface SelectorModel<T>
This is a model on which a
CssAST.SelectorGroup can perform a match
operation.- Author:
- Werner Randelshofer
-
Property Summary
PropertiesTypePropertyDescriptionPseudo classes set on the selector model. -
Method Summary
Modifier and TypeMethodDescriptionPseudo classes set on the selector model.default booleanattributeValueContains(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring) Returns true if the element has an attribute with the specified name and the value contains the specified substring.default booleanattributeValueContainsWord(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String word) Returns true if the element has an attribute with the specified name and the value is a list of words which contains the specified word.default booleanattributeValueEndsWith(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring) Returns true if the element has an attribute with the specified name and the attribute value ends with the specified substring.default booleanattributeValueEquals(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String attributeValue) Returns true if the element has an attribute with the specified name and value.default booleanattributeValueStartsWith(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring) Returns true if the element has an attribute with the specified name and the attribute value starts with the specified substring.getAttribute(@NonNull T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, @NonNull String name) Returns the attribute value with the given name from the USER style origin.getAttributeAsString(@NonNull T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, @NonNull String name) getAttributeNames(@NonNull T element) Returns all styleable attributes of the element.getComposedAttributeNames(@NonNull T element) Returns all non-decomposed styleable attributes of the element.getDecomposedAttributeNames(@NonNull T element) Returns all decomposed styleable attributes of the element.Returns the id of the element.Gets the parent of the element.getPreviousSibling(@NonNull T element) Gets the previous sibling of the element.getPseudoClasses(@NonNull T element) Returns the pseudo classes of the element.getStyleClasses(@NonNull T element) Returns the style classes of the element.Returns the style type of the element.booleanReturns true if the element has the specified attribute.booleanReturns true if the element has the specified id.booleanhasPseudoClass(@NonNull T element, @NonNull String pseudoClass) Returns true if the element has the specified pseudo class.booleanhasStyleClass(@NonNull T element, @NonNull String clazz) Returns true if the element has the specified style class.booleanReturns true if the element has the specified type.voidResets all values with non-StyleOrigin.USERorigin.voidsetAttribute(@NonNull T element, @NonNull javafx.css.StyleOrigin origin, @Nullable String namespace, @NonNull String name, @Nullable ReadOnlyList<CssToken> value) Sets an attribute value.
-
Property Details
-
additionalPseudoClassStates
Pseudo classes set on the selector model.- See Also:
-
-
Method Details
-
additionalPseudoClassStatesProperty
Pseudo classes set on the selector model.- Returns:
- a map
-
attributeValueContains
default boolean attributeValueContains(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring) Returns true if the element has an attribute with the specified name and the value contains the specified substring.- Parameters:
element- An element of the documentnamespacePattern- an optional namespace ("*" means any namespace, null means no namespace)attributeName- an attribute namesubstring- the substring- Returns:
- true if the element has an attribute with the specified name and the value contains the specified substring.
-
attributeValueContainsWord
default boolean attributeValueContainsWord(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String word) Returns true if the element has an attribute with the specified name and the value is a list of words which contains the specified word.- Parameters:
element- An element of the documentnamespacePattern- an optional namespace ("*" means any namespace, null means no namespace)attributeName- an attribute nameword- the word- Returns:
- true if the element has an attribute with the specified name and the value contains the specified word.
-
attributeValueEndsWith
default boolean attributeValueEndsWith(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring) Returns true if the element has an attribute with the specified name and the attribute value ends with the specified substring.- Parameters:
element- An element of the documentnamespacePattern- an optional namespace ("*" means any namespace, null means no namespace)attributeName- an attribute namesubstring- the substring- Returns:
- true if the element has an attribute with the specified name and the value ends with the specified substring.
-
attributeValueEquals
default boolean attributeValueEquals(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String attributeValue) Returns true if the element has an attribute with the specified name and value.- Parameters:
element- An element of the documentnamespacePattern- an optional namespace ("*" means any namespace, null means no namespace)attributeName- an attribute nameattributeValue- the attribute value- Returns:
- true if the element has an attribute with the specified name and value
-
attributeValueStartsWith
default boolean attributeValueStartsWith(@NonNull T element, @Nullable String namespacePattern, @NonNull String attributeName, @NonNull String substring) Returns true if the element has an attribute with the specified name and the attribute value starts with the specified substring.- Parameters:
element- An element of the documentnamespacePattern- The attribute namespaceattributeName- an attribute namesubstring- the substring- Returns:
- true if the element has an attribute with the specified name and the value starts with the specified substring.
-
getAttributeAsString
default @Nullable String getAttributeAsString(@NonNull T element, @Nullable String namespacePattern, @NonNull String name) Returns the attribute value with the given name from the USER style origin.- Parameters:
element- The elementnamespacePattern- an optional namespace ("*" means any namespace, null means no namespace)name- The attribute name- Returns:
- The attribute value. Returns "initial" if the element does not have an attribute with this name.
-
getAttributeAsString
-
getAttribute
-
getAttributeNames
Returns all styleable attributes of the element.- Parameters:
element- An element of the document- Returns:
- a set of styleable attributes.
-
getComposedAttributeNames
Returns all non-decomposed styleable attributes of the element.If an attribute can be decomposed, only the composite attribute is returned.
- Parameters:
element- An element of the document- Returns:
- a set of styleable attributes.
-
getDecomposedAttributeNames
Returns all decomposed styleable attributes of the element.If an attribute can be composed, only the decomposed attributes are returned.
- Parameters:
element- An element of the document- Returns:
- a set of styleable attributes.
-
getId
Returns the id of the element.- Parameters:
element- the element- Returns:
- the id or null if the element does not have an id.
-
getParent
Gets the parent of the element.- Parameters:
element- An element of the document- Returns:
- The parent element. Returns null if the element has no parent.
-
getPreviousSibling
Gets the previous sibling of the element.- Parameters:
element- An element of the document- Returns:
- The previous sibling. Returns null if the element has no previous sibling.
-
getStyleClasses
Returns the style classes of the element.- Parameters:
element- the element- Returns:
- the style classes or an empty set.
-
getPseudoClasses
Returns the pseudo classes of the element.- Parameters:
element- the element- Returns:
- the pseudo classes or an empty set.
-
getType
Returns the style type of the element.- Parameters:
element- the element- Returns:
- the style type of the element, return null if the element is not styleable by type.
-
hasAttribute
Returns true if the element has the specified attribute.- Parameters:
element- An element of the documentnamespace- an optional namespace (null means any namespace , an empty String means no namespace)attributeName- an attribute name- Returns:
- true if the element has an attribute with the specified name
-
hasId
Returns true if the element has the specified id.- Parameters:
element- An element of the documentid- an id- Returns:
- true if the element has the id
-
hasPseudoClass
Returns true if the element has the specified pseudo class.- Parameters:
element- An element of the documentpseudoClass- a pseudo class- Returns:
- true if the element has the id
-
hasStyleClass
Returns true if the element has the specified style class.- Parameters:
element- An element of the documentclazz- a style class- Returns:
- true if the element has the id
-
hasType
Returns true if the element has the specified type.- Parameters:
element- An element of the documentnamespacePattern- a namespace pattern ("*" means any namespace, null means no namespace)type- an id- Returns:
- true if the element has the id
-
reset
Resets all values with non-StyleOrigin.USERorigin. -
setAttribute
void setAttribute(@NonNull T element, @NonNull javafx.css.StyleOrigin origin, @Nullable String namespace, @NonNull String name, @Nullable ReadOnlyList<CssToken> value) throws ParseException Sets an attribute value.- Parameters:
element- The elementorigin- The style originnamespace- an optional namespace ("*" means any namespace, null means no namespace)name- The attribute namevalue- The attribute value.nullremoves the attribute from the element. That is,nullhas the same effect like the keyword "unset".- Throws:
ParseException- if parsing the value failed
-