Package com.vaadin.flow.dom.impl
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 throwUnsupportedOperationException.For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractTextElementStateProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DomListenerRegistrationaddEventListener(StateNode node, String eventType, DomEventListener listener)Adds a DOM event listener.RegistrationaddPropertyChangeListener(StateNode node, String name, PropertyChangeListener listener)Adds a property change listener.voidappendVirtualChild(StateNode node, Element child, String type, String payload)Append the given element as a virtual child.voidattachExistingElement(StateNode node, String tagName, Element previousSibling, ChildElementConsumer callback)Attaches a child element with the giventagNamewhich is the next sibling for thepreviousSibling.StateNodeattachShadow(StateNode node)Attaches the shadow root for thenode.StringgetAttribute(StateNode node, String attribute)Gets the value of the given attribute.Stream<String>getAttributeNames(StateNode node)Gets the defined attribute names.ElementgetChild(StateNode node, int index)Returns the child element at the given position.intgetChildCount(StateNode node)Gets the number of child elements.ClassListgetClassList(StateNode node)Gets a list representation of all CSS class names set for an element.SerializablegetProperty(StateNode node, String name)Gets the value of the given property.Stream<String>getPropertyNames(StateNode node)Gets the defined property names.StateNodegetShadowRoot(StateNode node)Gets shadow root for thenodeif it has been attached.StylegetStyle(StateNode node)Returns a style instance for managing element inline styles.StringgetTag(StateNode node)Gets the tag name for the given node.booleanhasAttribute(StateNode node, String attribute)Checks if the given attribute has been set.booleanhasProperty(StateNode node, String name)Checks if the given property has been set.voidinsertChild(StateNode node, int index, Element child)Inserts the given child at the given position.booleanisTextNode(StateNode node)Checks if the state node represents a text node.booleanisVisible(StateNode node)Gets thenodevisibility.voidremoveAllChildren(StateNode node)Removes all child elements.voidremoveAttribute(StateNode node, String attribute)Removes the given attribute if it has been set.voidremoveChild(StateNode node, int index)Removes the child at the given position.voidremoveChild(StateNode node, Element child)Removes the given child.voidremoveProperty(StateNode node, String name)Removes the given property if it has been set.voidsetAttribute(StateNode node, String attribute, AbstractStreamResource resource)Sets the given attribute to the givenStreamResourcevalue.voidsetAttribute(StateNode node, String attribute, String value)Sets the given attribute to the given value.voidsetProperty(StateNode node, String name, Serializable value, boolean emitChange)Sets the given property to the given value.voidsetVisible(StateNode node, boolean visible)Sets thenodevisibility.voidvisit(StateNode node, NodeVisitor visitor)Visit thenodeapplyingvisitorto it and its descendants based on the return value from the visitor.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.dom.ElementStateProvider
getComponent, getParent, getTextContent, setComponent, setTextContent, supports
-
-
-
-
Method Detail
-
isTextNode
public boolean isTextNode(StateNode node)
Description copied from interface:ElementStateProviderChecks if the state node represents a text node.- Specified by:
isTextNodein interfaceElementStateProvider- Parameters:
node- the node to check- Returns:
trueif the state node represents a text node; otherwisefalse
-
getTag
public String getTag(StateNode node)
Description copied from interface:ElementStateProviderGets the tag name for the given node.- Specified by:
getTagin interfaceElementStateProvider- 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:ElementStateProviderSets the given attribute to the given value.- Specified by:
setAttributein interfaceElementStateProvider- Parameters:
node- the node containing the dataattribute- the attribute name, not nullvalue- the attribute value
-
getAttribute
public String getAttribute(StateNode node, String attribute)
Description copied from interface:ElementStateProviderGets the value of the given attribute.- Specified by:
getAttributein interfaceElementStateProvider- Parameters:
node- the node containing the dataattribute- 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:ElementStateProviderChecks if the given attribute has been set.- Specified by:
hasAttributein interfaceElementStateProvider- Parameters:
node- the node containing the dataattribute- 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:ElementStateProviderRemoves the given attribute if it has been set.- Specified by:
removeAttributein interfaceElementStateProvider- Parameters:
node- the node containing the dataattribute- the attribute name, not null
-
getAttributeNames
public Stream<String> getAttributeNames(StateNode node)
Description copied from interface:ElementStateProviderGets the defined attribute names.- Specified by:
getAttributeNamesin interfaceElementStateProvider- Parameters:
node- the node containing the data- Returns:
- the defined attribute names
-
getChildCount
public int getChildCount(StateNode node)
Description copied from interface:ElementStateProviderGets the number of child elements.- Specified by:
getChildCountin interfaceElementStateProvider- 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:ElementStateProviderReturns the child element at the given position.- Specified by:
getChildin interfaceElementStateProvider- Parameters:
node- the node containing the dataindex- 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:ElementStateProviderInserts the given child at the given position.- Specified by:
insertChildin interfaceElementStateProvider- Parameters:
node- the node containing the dataindex- the position at which to insert the new childchild- the child element to insert
-
removeChild
public void removeChild(StateNode node, int index)
Description copied from interface:ElementStateProviderRemoves the child at the given position.- Specified by:
removeChildin interfaceElementStateProvider- Parameters:
node- the node containing the dataindex- the position of the child element to remove
-
removeChild
public void removeChild(StateNode node, Element child)
Description copied from interface:ElementStateProviderRemoves the given child.- Specified by:
removeChildin interfaceElementStateProvider- Parameters:
node- the node containing the datachild- the child element to remove
-
removeAllChildren
public void removeAllChildren(StateNode node)
Description copied from interface:ElementStateProviderRemoves all child elements.- Specified by:
removeAllChildrenin interfaceElementStateProvider- Parameters:
node- the node containing the data
-
addEventListener
public DomListenerRegistration addEventListener(StateNode node, String eventType, DomEventListener listener)
Description copied from interface:ElementStateProviderAdds a DOM event listener.- Specified by:
addEventListenerin interfaceElementStateProvider- Parameters:
node- the node containing the dataeventType- the event typelistener- the listener- Returns:
- a handle for configuring or removing the listener
-
getProperty
public Serializable getProperty(StateNode node, String name)
Description copied from interface:ElementStateProviderGets the value of the given property.- Specified by:
getPropertyin interfaceElementStateProvider- Parameters:
node- the node containing the dataname- the property name, not null- Returns:
- the property value, or
nullif the property has not been set
-
setProperty
public void setProperty(StateNode node, String name, Serializable value, boolean emitChange)
Description copied from interface:ElementStateProviderSets the given property to the given value.- Specified by:
setPropertyin interfaceElementStateProvider- Parameters:
node- the node containing the dataname- the property name, notnullvalue- the property valueemitChange- true to create a change event for the client side
-
removeProperty
public void removeProperty(StateNode node, String name)
Description copied from interface:ElementStateProviderRemoves the given property if it has been set.- Specified by:
removePropertyin interfaceElementStateProvider- Parameters:
node- the node containing the dataname- the property name, notnull
-
hasProperty
public boolean hasProperty(StateNode node, String name)
Description copied from interface:ElementStateProviderChecks if the given property has been set.- Specified by:
hasPropertyin interfaceElementStateProvider- Parameters:
node- the node containing the dataname- the property name, notnull- Returns:
trueif the property has been set,falseotherwise
-
getPropertyNames
public Stream<String> getPropertyNames(StateNode node)
Description copied from interface:ElementStateProviderGets the defined property names.- Specified by:
getPropertyNamesin interfaceElementStateProvider- Parameters:
node- the node containing the data- Returns:
- the defined property names
-
getClassList
public ClassList getClassList(StateNode node)
Description copied from interface:ElementStateProviderGets a list representation of all CSS class names set for an element.- Specified by:
getClassListin interfaceElementStateProvider- Parameters:
node- the node containing the data- Returns:
- the class list, never
null
-
getStyle
public Style getStyle(StateNode node)
Description copied from interface:ElementStateProviderReturns a style instance for managing element inline styles.- Specified by:
getStylein interfaceElementStateProvider- 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:ElementStateProviderSets the given attribute to the givenStreamResourcevalue.- Specified by:
setAttributein interfaceElementStateProvider- Parameters:
node- the node containing the dataattribute- the attribute name, not nullresource- the attribute value, not null
-
addPropertyChangeListener
public Registration addPropertyChangeListener(StateNode node, String name, PropertyChangeListener listener)
Description copied from interface:ElementStateProviderAdds a property change listener.- Specified by:
addPropertyChangeListenerin interfaceElementStateProvider- Parameters:
node- the node containing the propertyname- the property name to add the listener forlistener- 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:ElementStateProviderGets shadow root for thenodeif it has been attached.- Specified by:
getShadowRootin interfaceElementStateProvider- Parameters:
node- the node having a shadow root, notnull- Returns:
- the shadow root of the
node, may be null
-
attachShadow
public StateNode attachShadow(StateNode node)
Description copied from interface:ElementStateProviderAttaches the shadow root for thenode.- Specified by:
attachShadowin interfaceElementStateProvider- 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:ElementStateProviderAttaches a child element with the giventagNamewhich is the next sibling for thepreviousSibling.The
previousSiblingparameter value can benullwhich means that the very first child with the giventagNamewill be used to attach (if any).- Specified by:
attachExistingElementin interfaceElementStateProvider- Parameters:
node- the parent nodetagName- the tag name of the element to attach, notnullpreviousSibling- previous sibling, may benullcallback- the callback which will be invoked with a server side element instance or an error will be reported, notnull
-
appendVirtualChild
public void appendVirtualChild(StateNode node, Element child, String type, String payload)
Description copied from interface:ElementStateProviderAppend the given element as a virtual child.- Specified by:
appendVirtualChildin interfaceElementStateProvider- Parameters:
node- the node containing the datachild- the child element to addtype- the type of additional payload datapayload- the additional payload data
-
visit
public void visit(StateNode node, NodeVisitor visitor)
Description copied from interface:ElementStateProviderVisit thenodeapplyingvisitorto it and its descendants based on the return value from the visitor.- Specified by:
visitin interfaceElementStateProvider- Parameters:
node- the node to visitvisitor- the visitor to apply to the node
-
setVisible
public void setVisible(StateNode node, boolean visible)
Description copied from interface:ElementStateProviderSets thenodevisibility.- Specified by:
setVisiblein interfaceElementStateProvider- Parameters:
node- the node containing the datavisible- the node visibility value
-
isVisible
public boolean isVisible(StateNode node)
Description copied from interface:ElementStateProviderGets thenodevisibility.- Specified by:
isVisiblein interfaceElementStateProvider- Parameters:
node- the node containing the data- Returns:
- the node visibility
-
-