Class StyleableSelectorModel

java.lang.Object
org.jhotdraw8.css.model.AbstractSelectorModel<javafx.css.Styleable>
org.jhotdraw8.css.model.StyleableSelectorModel
All Implemented Interfaces:
SelectorModel<javafx.css.Styleable>

public class StyleableSelectorModel extends AbstractSelectorModel<javafx.css.Styleable>
A SelectorModel for objects that implement the Styleable interface.
Author:
Werner Randelshofer
  • Constructor Details

    • StyleableSelectorModel

      public StyleableSelectorModel()
  • Method Details

    • getAttributeAsString

      public @Nullable String getAttributeAsString(javafx.css.Styleable element, javafx.css.StyleOrigin origin, @Nullable String namespacePattern, String name)
      Description copied from interface: SelectorModel
      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.
    • hasId

      public boolean hasId(javafx.css.Styleable element, String id)
      Description copied from interface: SelectorModel
      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
    • getId

      public String getId(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      Returns the id of the element.
      Parameters:
      element - the element
      Returns:
      the id or null if the element does not have an id.
    • hasType

      public boolean hasType(javafx.css.Styleable element, @Nullable String namespacePattern, String type)
      Description copied from interface: SelectorModel
      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

      public void reset(javafx.css.Styleable elem)
      Description copied from interface: SelectorModel
      Resets all values with non-StyleOrigin.USER origin.
    • getType

      public @Nullable QualifiedName getType(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      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.
    • hasStyleClass

      public boolean hasStyleClass(javafx.css.Styleable element, String clazz)
      Description copied from interface: SelectorModel
      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
    • getStyleClasses

      public ReadOnlySet<String> getStyleClasses(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      Returns the style classes of the element.
      Parameters:
      element - the element
      Returns:
      the style classes or an empty set.
    • getPseudoClasses

      public ReadOnlySet<String> getPseudoClasses(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      Returns the pseudo classes of the element.
      Parameters:
      element - the element
      Returns:
      the pseudo classes or an empty set.
    • hasPseudoClass

      public boolean hasPseudoClass(javafx.css.Styleable element, String pseudoClass)
      Description copied from interface: SelectorModel
      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
    • getParent

      public javafx.css.Styleable getParent(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      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

      public @Nullable javafx.css.Styleable getPreviousSibling(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      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.
    • hasAttribute

      public boolean hasAttribute(javafx.css.Styleable element, @Nullable String namespace, String attributeName)
      Description copied from interface: SelectorModel
      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
    • getAttribute

      public @Nullable List<CssToken> getAttribute(javafx.css.Styleable element, javafx.css.StyleOrigin origin, @Nullable String namespacePattern, String attributeName)
      Description copied from interface: SelectorModel
      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)
      attributeName - The attribute name
      Returns:
      The attribute value as a list of CssTokens.
    • attributeValueContainsWord

      public boolean attributeValueContainsWord(javafx.css.Styleable element, @Nullable String namespacePattern, String attributeName, String word)
      Description copied from interface: SelectorModel
      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.
    • getAttributeNames

      public Set<QualifiedName> getAttributeNames(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      Returns all styleable attributes of the element.
      Parameters:
      element - An element of the document
      Returns:
      a set of styleable attributes.
    • getComposedAttributeNames

      public Set<QualifiedName> getComposedAttributeNames(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      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

      public Set<QualifiedName> getDecomposedAttributeNames(javafx.css.Styleable element)
      Description copied from interface: SelectorModel
      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.
    • setAttribute

      public void setAttribute(javafx.css.Styleable elem, javafx.css.StyleOrigin origin, @Nullable String namespace, String name, @Nullable ReadOnlyList<CssToken> valueAsTokens)
      Description copied from interface: SelectorModel
      Sets an attribute value.
      Parameters:
      elem - The element
      origin - The style origin
      namespace - an optional namespace ("*" means any namespace, null means no namespace)
      name - The attribute name
      valueAsTokens - The attribute value. null removes the attribute from the element. That is, null has the same effect like the keyword "unset".