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

      @NonNull javafx.beans.property.MapProperty<String,Set<T>> 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 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(@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 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(@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 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(@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 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(@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 document
      namespacePattern - The attribute 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(@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 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(@NonNull T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, @NonNull String name)
    • getAttribute

      @Nullable List<CssToken> getAttribute(@NonNull T element, @Nullable javafx.css.StyleOrigin origin, @Nullable String namespacePattern, @NonNull String name)
    • getAttributeNames

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

      @NonNull Set<QualifiedName> getComposedAttributeNames(@NonNull 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

      @NonNull Set<QualifiedName> getDecomposedAttributeNames(@NonNull 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(@NonNull 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(@NonNull 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(@NonNull 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

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

      @NonNull ReadOnlySet<String> getPseudoClasses(@NonNull 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(@NonNull 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(@NonNull T element, @Nullable String namespace, @NonNull 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(@NonNull T element, @NonNull 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(@NonNull T element, @NonNull 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(@NonNull T element, @NonNull 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(@NonNull T element, @Nullable String namespacePattern, @NonNull 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(@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 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