Interface SelectorModel<T>

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 Details

  • Method Details

    • additionalPseudoClassStatesProperty

      javafx.beans.property.MapProperty<String,Set<T>> 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 document
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      attributeName - an attribute name
      substring - 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 document
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      attributeName - an attribute name
      word - 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 document
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      attributeName - an attribute name
      substring - 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 document
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      attributeName - an attribute name
      attributeValue - 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 document
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      attributeName - an attribute name
      substring - 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 element
      namespacePattern - 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 element
      origin - The style origin
      namespacePattern - 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 element
      origin - The style origin
      namespacePattern - an optional namespace ("*" means any namespace, null means no namespace)
      name - The attribute name
      Returns:
      The attribute value as a list of CssTokens.
    • getAttributeNames

      Set<QualifiedName> getAttributeNames(T element)
      Returns all styleable attributes of the element.
      Parameters:
      element - An element of the document
      Returns:
      a set of styleable attributes.
    • getComposedAttributeNames

      Set<QualifiedName> getComposedAttributeNames(T element)
      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

      Set<QualifiedName> getDecomposedAttributeNames(T element)
      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

      @Nullable String getId(T element)
      Returns the id of the element.
      Parameters:
      element - the element
      Returns:
      the id or null if the element does not have an id.
    • getParent

      @Nullable T getParent(T element)
      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

      @Nullable T getPreviousSibling(T element)
      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

      ReadOnlySet<String> getStyleClasses(T element)
      Returns the style classes of the element.
      Parameters:
      element - the element
      Returns:
      the style classes or an empty set.
    • getPseudoClasses

      ReadOnlySet<String> getPseudoClasses(T element)
      Returns the pseudo classes of the element.
      Parameters:
      element - the element
      Returns:
      the pseudo classes or an empty set.
    • getType

      @Nullable QualifiedName getType(T element)
      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

      boolean hasAttribute(T element, @Nullable String namespace, String attributeName)
      Returns true if the element has the specified attribute.
      Parameters:
      element - An element of the document
      namespace - 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

      boolean hasId(T element, String id)
      Returns true if the element has the specified id.
      Parameters:
      element - An element of the document
      id - an id
      Returns:
      true if the element has the id
    • hasPseudoClass

      boolean hasPseudoClass(T element, String pseudoClass)
      Returns true if the element has the specified pseudo class.
      Parameters:
      element - An element of the document
      pseudoClass - a pseudo class
      Returns:
      true if the element has the id
    • hasStyleClass

      boolean hasStyleClass(T element, String clazz)
      Returns true if the element has the specified style class.
      Parameters:
      element - An element of the document
      clazz - a style class
      Returns:
      true if the element has the id
    • hasType

      boolean hasType(T element, @Nullable String namespacePattern, String type)
      Returns true if the element has the specified type.
      Parameters:
      element - An element of the document
      namespacePattern - a namespace pattern ("*" means any namespace, null means no namespace)
      type - an id
      Returns:
      true if the element has the id
    • reset

      void reset(T elem)
      Resets all values with non-StyleOrigin.USER origin.
    • 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 element
      origin - The style origin
      namespace - an optional namespace ("*" means any namespace, null means no namespace)
      name - The attribute name
      value - The attribute value. null removes the attribute from the element. That is, null has the same effect like the keyword "unset".
      Throws:
      ParseException - if parsing the value failed