Class AbstractTextElementStateProvider

java.lang.Object
com.vaadin.flow.dom.impl.AbstractTextElementStateProvider
All Implemented Interfaces:
ElementStateProvider, Serializable
Direct Known Subclasses:
BasicTextElementStateProvider

public abstract class AbstractTextElementStateProvider extends Object implements ElementStateProvider
Abstract element state provider for text nodes. Operations that are not applicable for text nodes throw UnsupportedOperationException.

For internal use only. May be renamed or removed in a future release.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • AbstractTextElementStateProvider

      public AbstractTextElementStateProvider()
  • Method Details

    • isTextNode

      public boolean isTextNode(StateNode node)
      Description copied from interface: ElementStateProvider
      Checks if the state node represents a text node.
      Specified by:
      isTextNode in interface ElementStateProvider
      Parameters:
      node - the node to check
      Returns:
      true if the state node represents a text node; otherwise false
    • getTag

      public String getTag(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets the tag name for the given node.
      Specified by:
      getTag in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the tag name
    • setAttribute

      public void setAttribute(StateNode node, String attribute, String value)
      Description copied from interface: ElementStateProvider
      Sets the given attribute to the given value.
      Specified by:
      setAttribute in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      attribute - the attribute name, not null
      value - the attribute value
    • getAttribute

      public String getAttribute(StateNode node, String attribute)
      Description copied from interface: ElementStateProvider
      Gets the value of the given attribute.
      Specified by:
      getAttribute in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      attribute - the attribute name, not null
      Returns:
      the attribute value or null if the attribute has not been set
    • hasAttribute

      public boolean hasAttribute(StateNode node, String attribute)
      Description copied from interface: ElementStateProvider
      Checks if the given attribute has been set.
      Specified by:
      hasAttribute in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      attribute - the attribute name, not null
      Returns:
      true if the attribute has been set, false otherwise
    • removeAttribute

      public void removeAttribute(StateNode node, String attribute)
      Description copied from interface: ElementStateProvider
      Removes the given attribute if it has been set.
      Specified by:
      removeAttribute in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      attribute - the attribute name, not null
    • getAttributeNames

      public Stream<String> getAttributeNames(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets the defined attribute names.
      Specified by:
      getAttributeNames in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the defined attribute names
    • getChildCount

      public int getChildCount(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets the number of child elements.
      Specified by:
      getChildCount in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the number of child elements
    • getChild

      public Element getChild(StateNode node, int index)
      Description copied from interface: ElementStateProvider
      Returns the child element at the given position.
      Specified by:
      getChild in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      index - the index of the child element to return
      Returns:
      the child element
    • insertChild

      public void insertChild(StateNode node, int index, Element child)
      Description copied from interface: ElementStateProvider
      Inserts the given child at the given position.
      Specified by:
      insertChild in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      index - the position at which to insert the new child
      child - the child element to insert
    • removeChild

      public void removeChild(StateNode node, int index)
      Description copied from interface: ElementStateProvider
      Removes the child at the given position.
      Specified by:
      removeChild in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      index - the position of the child element to remove
    • removeChild

      public void removeChild(StateNode node, Element child)
      Description copied from interface: ElementStateProvider
      Removes the given child.
      Specified by:
      removeChild in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      child - the child element to remove
    • removeAllChildren

      public void removeAllChildren(StateNode node)
      Description copied from interface: ElementStateProvider
      Removes all child elements.
      Specified by:
      removeAllChildren in interface ElementStateProvider
      Parameters:
      node - the node containing the data
    • addEventListener

      public DomListenerRegistration addEventListener(StateNode node, String eventType, DomEventListener listener)
      Description copied from interface: ElementStateProvider
      Adds a DOM event listener.
      Specified by:
      addEventListener in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      eventType - the event type
      listener - the listener
      Returns:
      a handle for configuring or removing the listener
    • getProperty

      public Serializable getProperty(StateNode node, String name)
      Description copied from interface: ElementStateProvider
      Gets the value of the given property.
      Specified by:
      getProperty in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      name - the property name, not null
      Returns:
      the property value, or null if the property has not been set
    • setProperty

      public void setProperty(StateNode node, String name, Serializable value, boolean emitChange)
      Description copied from interface: ElementStateProvider
      Sets the given property to the given value.
      Specified by:
      setProperty in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      name - the property name, not null
      value - the property value
      emitChange - true to create a change event for the client side
    • removeProperty

      public void removeProperty(StateNode node, String name)
      Description copied from interface: ElementStateProvider
      Removes the given property if it has been set.
      Specified by:
      removeProperty in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      name - the property name, not null
    • hasProperty

      public boolean hasProperty(StateNode node, String name)
      Description copied from interface: ElementStateProvider
      Checks if the given property has been set.
      Specified by:
      hasProperty in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      name - the property name, not null
      Returns:
      true if the property has been set, false otherwise
    • getPropertyNames

      public Stream<String> getPropertyNames(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets the defined property names.
      Specified by:
      getPropertyNames in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the defined property names
    • getClassList

      public ClassList getClassList(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets a list representation of all CSS class names set for an element.
      Specified by:
      getClassList in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the class list, never null
    • getStyle

      public Style getStyle(StateNode node)
      Description copied from interface: ElementStateProvider
      Returns a style instance for managing element inline styles.
      Specified by:
      getStyle in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the element styles
    • setAttribute

      public void setAttribute(StateNode node, String attribute, AbstractStreamResource resource)
      Description copied from interface: ElementStateProvider
      Sets the given attribute to the given StreamResource value.
      Specified by:
      setAttribute in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      attribute - the attribute name, not null
      resource - the attribute value, not null
    • addPropertyChangeListener

      public Registration addPropertyChangeListener(StateNode node, String name, PropertyChangeListener listener)
      Description copied from interface: ElementStateProvider
      Adds a property change listener.
      Specified by:
      addPropertyChangeListener in interface ElementStateProvider
      Parameters:
      node - the node containing the property
      name - the property name to add the listener for
      listener - listener to get notifications about property value changes
      Returns:
      an event registration handle for removing the listener
    • getShadowRoot

      public StateNode getShadowRoot(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets shadow root for the node if it has been attached.
      Specified by:
      getShadowRoot in interface ElementStateProvider
      Parameters:
      node - the node having a shadow root, not null
      Returns:
      the shadow root of the node, may be null
    • attachShadow

      public StateNode attachShadow(StateNode node)
      Description copied from interface: ElementStateProvider
      Attaches the shadow root for the node.
      Specified by:
      attachShadow in interface ElementStateProvider
      Parameters:
      node - the node to attach the shadow root
      Returns:
      the shadow root of the node
    • attachExistingElement

      public void attachExistingElement(StateNode node, String tagName, Element previousSibling, ChildElementConsumer callback)
      Description copied from interface: ElementStateProvider
      Attaches a child element with the given tagName which is the next sibling for the previousSibling.

      The previousSibling parameter value can be null which means that the very first child with the given tagName will be used to attach (if any).

      Specified by:
      attachExistingElement in interface ElementStateProvider
      Parameters:
      node - the parent node
      tagName - the tag name of the element to attach, not null
      previousSibling - previous sibling, may be null
      callback - the callback which will be invoked with a server side element instance or an error will be reported, not null
    • appendVirtualChild

      public void appendVirtualChild(StateNode node, Element child, String type, String payload)
      Description copied from interface: ElementStateProvider
      Append the given element as a virtual child.
      Specified by:
      appendVirtualChild in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      child - the child element to add
      type - the type of additional payload data
      payload - the additional payload data
    • visit

      public void visit(StateNode node, NodeVisitor visitor)
      Description copied from interface: ElementStateProvider
      Visit the node applying visitor to it and its descendants based on the return value from the visitor.
      Specified by:
      visit in interface ElementStateProvider
      Parameters:
      node - the node to visit
      visitor - the visitor to apply to the node
    • setVisible

      public void setVisible(StateNode node, boolean visible)
      Description copied from interface: ElementStateProvider
      Sets the node visibility.
      Specified by:
      setVisible in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      visible - the node visibility value
    • isVisible

      public boolean isVisible(StateNode node)
      Description copied from interface: ElementStateProvider
      Gets the node visibility.
      Specified by:
      isVisible in interface ElementStateProvider
      Parameters:
      node - the node containing the data
      Returns:
      the node visibility