- 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(T element, @Nullable String namespacePattern, String attributeName, String substring) Returns true if the element has an attribute with the specified name and the value contains the specified substring.default booleanattributeValueContainsWord(T element, @Nullable String namespacePattern, String attributeName, 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(T element, @Nullable String namespacePattern, String attributeName, 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(T element, @Nullable String namespacePattern, String attributeName, String attributeValue) Returns true if the element has an attribute with the specified name and value.default booleanattributeValueStartsWith(T element, @Nullable String namespacePattern, String attributeName, String substring) Returns true if the element has an attribute with the specified name and the attribute value starts with the specified substring.getAttribute(T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, String name) Returns the attribute value with the given name from the specified style origin.default @Nullable StringgetAttributeAsString(T element, @Nullable String namespacePattern, String name) Returns the attribute value with the given name from the USER style origin.default @Nullable StringgetAttributeAsString(T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, String name) Returns the attribute value with the given name from the specified style origin.getAttributeNames(T element) Returns all styleable attributes of the element.getComposedAttributeNames(T element) Returns all non-decomposed styleable attributes of the element.getDecomposedAttributeNames(T element) Returns all decomposed styleable attributes of the element.@Nullable StringReturns the id of the element.@Nullable TGets the parent of the element.@Nullable TgetPreviousSibling(T element) Gets the previous sibling of the element.getPseudoClasses(T element) Returns the pseudo classes of the element.getStyleClasses(T element) Returns the style classes of the element.@Nullable QualifiedNameReturns the style type of the element.booleanhasAttribute(T element, @Nullable String namespace, String attributeName) Returns true if the element has the specified attribute.booleanReturns true if the element has the specified id.booleanhasPseudoClass(T element, String pseudoClass) Returns true if the element has the specified pseudo class.booleanhasStyleClass(T element, 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(T element, javafx.css.StyleOrigin origin, @Nullable String namespace, 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(T element, @Nullable String namespacePattern, String attributeName, 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(T element, @Nullable String namespacePattern, String attributeName, 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(T element, @Nullable String namespacePattern, String attributeName, 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(T element, @Nullable String namespacePattern, String attributeName, 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(T element, @Nullable String namespacePattern, String attributeName, 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- 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 starts with the specified substring.
-
getAttributeAsString
default @Nullable String getAttributeAsString(T element, @Nullable String namespacePattern, 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
default @Nullable String getAttributeAsString(T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, String name) Returns the attribute value with the given name from the specified style origin.- Parameters:
element- The elementorigin- The style originnamespacePattern- 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.
-
getAttribute
@Nullable List<CssToken> getAttribute(T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, String name) Returns the attribute value with the given name from the specified style origin.- Parameters:
element- The elementorigin- The style originnamespacePattern- an optional namespace ("*" means any namespace, null means no namespace)name- The attribute name- Returns:
- The attribute value as a list of
CssTokens.
-
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(T element, javafx.css.StyleOrigin origin, @Nullable String namespace, 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
-