com.vaadin.flow.dom.impl.
Class AbstractTextElementStateProvider
- java.lang.Object
-
- com.vaadin.flow.dom.impl.AbstractTextElementStateProvider
-
All Implemented Interfaces:
Direct Known Subclasses:
public abstract class AbstractTextElementStateProvider extends Object implements ElementStateProviderAbstract element state provider for text nodes. Operations that are not applicable for text nodes throw
UnsupportedOperationException.Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor and Description AbstractTextElementStateProvider()
-
Method Summary
All Methods Modifier and Type Method and 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.
voidaddSynchronizedProperty(StateNode node, String property, DisabledUpdateMode mode)Makes the property synchronized from the client side to the server.
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 given
tagNamewhich is the next sibling for thepreviousSibling.StateNodeattachShadow(StateNode node)Attaches the shadow root for the
node.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 the
nodeif it has been attached.StylegetStyle(StateNode node)Returns a style instance for managing element inline styles.
Set<String>getSynchronizedProperties(StateNode node)Gets the names of the properties to synchronize from the client side to the server.
Set<String>getSynchronizedPropertyEvents(StateNode node)Gets the event types which should trigger synchronization of properties from the client side to the server.
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 the
nodevisibility.voidremoveAllChildren(StateNode node)Removes all child elements.
voidremoveAttribute(StateNode node, String attribute)Removes the given attribute if it has been set.
voidremoveChild(StateNode node, Element child)Removes the given child.
voidremoveChild(StateNode node, int index)Removes the child at the given position.
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 given
StreamResourcevalue.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 the
nodevisibility.voidvisit(StateNode node, NodeVisitor visitor)Visit the
nodeapplyingvisitorto 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 interfaceElementStateProviderParameters:
node- the node to checkReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
node- the node containing the dataattribute- the attribute name, not nullReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataattribute- the attribute name, not nullReturns:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
the defined attribute names
-
getChildCount
public int getChildCount(StateNode node)Description copied from interface:
ElementStateProviderGets the number of child elements.
Specified by:
getChildCountin interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataindex- the index of the child element to returnReturns:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
node- the node containing the dataeventType- the event typelistener- the listenerReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataname- the property name, not nullReturns:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
node- the node containing the dataname- the property name, notnullReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
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 interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
the element styles
-
getSynchronizedProperties
public Set<String> getSynchronizedProperties(StateNode node)Description copied from interface:
ElementStateProviderGets the names of the properties to synchronize from the client side to the server.
The events which trigger synchronization are defined using
ElementStateProvider.getSynchronizedPropertyEvents(StateNode).Specified by:
getSynchronizedPropertiesin interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
the names of the properties to synchronize
-
getSynchronizedPropertyEvents
public Set<String> getSynchronizedPropertyEvents(StateNode node)Description copied from interface:
ElementStateProviderGets the event types which should trigger synchronization of properties from the client side to the server.
Specified by:
getSynchronizedPropertyEventsin interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
the event types which should trigger synchronization
-
setAttribute
public void setAttribute(StateNode node, String attribute, AbstractStreamResource resource)Description copied from interface:
ElementStateProviderSets the given attribute to the given
StreamResourcevalue.Specified by:
setAttributein interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
node- the node containing the propertyname- the property name to add the listener forlistener- listener to get notifications about property value changesReturns:
an event registration handle for removing the listener
-
getShadowRoot
public StateNode getShadowRoot(StateNode node)Description copied from interface:
ElementStateProviderGets shadow root for the
nodeif it has been attached.Specified by:
getShadowRootin interfaceElementStateProviderParameters:
node- the node having a shadow root, notnullReturns:
the shadow root of the
node, may be null
-
attachShadow
public StateNode attachShadow(StateNode node)Description copied from interface:
ElementStateProviderAttaches the shadow root for the
node.Specified by:
attachShadowin interfaceElementStateProviderParameters:
node- the node to attach the shadow rootReturns:
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 given
tagNamewhich 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 interfaceElementStateProviderParameters:
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 interfaceElementStateProviderParameters:
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 the
nodeapplyingvisitorto it and its descendants based on the return value from the visitor.Specified by:
visitin interfaceElementStateProviderParameters:
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 the
nodevisibility.Specified by:
setVisiblein interfaceElementStateProviderParameters:
node- the node containing the datavisible- the node visibility value
-
isVisible
public boolean isVisible(StateNode node)Description copied from interface:
ElementStateProviderGets the
nodevisibility.Specified by:
isVisiblein interfaceElementStateProviderParameters:
node- the node containing the dataReturns:
the node visibility
-
addSynchronizedProperty
public void addSynchronizedProperty(StateNode node, String property, DisabledUpdateMode mode)Description copied from interface:
ElementStateProviderMakes the property synchronized from the client side to the server.
The events which trigger synchronization are defined using
ElementStateProvider.getSynchronizedPropertyEvents(StateNode).Specified by:
addSynchronizedPropertyin interfaceElementStateProviderParameters:
node- the node containing the dataproperty- the property to synchronizemode- controls RPC from the client side to the server side when the element is disabled, notnullSee Also:
ElementStateProvider.getSynchronizedPropertyEvents(StateNode),ElementStateProvider.getSynchronizedProperties(StateNode)
-
-