Package com.vaadin.flow.dom.impl
Class AbstractNodeStateProvider
- java.lang.Object
-
- com.vaadin.flow.dom.impl.AbstractNodeStateProvider
-
- All Implemented Interfaces:
ElementStateProvider,Serializable
- Direct Known Subclasses:
BasicElementStateProvider,ShadowRootStateProvider
public abstract class AbstractNodeStateProvider extends Object implements ElementStateProvider
Abstract implementation of theElementStateProviderrelated to the composition essence of the provider.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 AbstractNodeStateProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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.ElementgetChild(StateNode node, int index)Returns the child element at the given position.intgetChildCount(StateNode node)Gets the number of child elements.protected abstract Node<?>getNode(StateNode node)Gets the flyweight instance for thenodesupported by the provider.NodegetParent(StateNode node)Gets the parent element.protected abstract Class<? extends NodeFeature>[]getProviderFeatures()Returns the features supported by the provider.voidinsertChild(StateNode node, int index, Element child)Inserts the given child at the given position.voidremoveAllChildren(StateNode node)Removes all child elements.voidremoveChild(StateNode node, int index)Removes the child at the given position.voidremoveChild(StateNode node, Element child)Removes the given child.booleansupports(StateNode node)Checks if the element state provider supports the given state node.protected voidvisitDescendants(Node<?> node, NodeVisitor visitor)Apply thevisitorfor the descendants of thenode.-
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
addEventListener, addPropertyChangeListener, attachShadow, getAttribute, getAttributeNames, getClassList, getComponent, getProperty, getPropertyNames, getShadowRoot, getStyle, getTag, getTextContent, hasAttribute, hasProperty, isTextNode, isVisible, removeAttribute, removeProperty, setAttribute, setAttribute, setComponent, setProperty, setTextContent, setVisible, visit
-
-
-
-
Method Detail
-
supports
public boolean supports(StateNode node)
Description copied from interface:ElementStateProviderChecks if the element state provider supports the given state node.- Specified by:
supportsin interfaceElementStateProvider- Parameters:
node- the state node to check- Returns:
- true if the element state provider is compatible with the given state node, false otherwise
-
getProviderFeatures
protected abstract Class<? extends NodeFeature>[] getProviderFeatures()
Returns the features supported by the provider.- Returns:
- features supported by the provider
-
getParent
public Node getParent(StateNode node)
Description copied from interface:ElementStateProviderGets the parent element.- Specified by:
getParentin interfaceElementStateProvider- Parameters:
node- the node containing the data- Returns:
- the parent element or null if the element has no parent
-
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
-
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
-
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
-
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
-
visitDescendants
protected void visitDescendants(Node<?> node, NodeVisitor visitor)
Apply thevisitorfor the descendants of thenode.- Parameters:
node- the node whose descendants are targets to apply the visitorvisitor- the visitor to apply
-
getNode
protected abstract Node<?> getNode(StateNode node)
Gets the flyweight instance for thenodesupported by the provider.- Parameters:
node- the node to wrap into flyweight- Returns:
- the flyweight instance for the
node - See Also:
supports(StateNode)
-
-