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 throw
UnsupportedOperationException
.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddEventListener
(StateNode node, String eventType, DomEventListener listener) Adds a DOM event listener.addPropertyChangeListener
(StateNode node, String name, PropertyChangeListener listener) Adds a property change listener.void
appendVirtualChild
(StateNode node, Element child, String type, String payload) Append the given element as a virtual child.void
attachExistingElement
(StateNode node, String tagName, Element previousSibling, ChildElementConsumer callback) Attaches a child element with the giventagName
which is the next sibling for thepreviousSibling
.attachShadow
(StateNode node) Attaches the shadow root for thenode
.getAttribute
(StateNode node, String attribute) Gets the value of the given attribute.getAttributeNames
(StateNode node) Gets the defined attribute names.Returns the child element at the given position.int
getChildCount
(StateNode node) Gets the number of child elements.getClassList
(StateNode node) Gets a list representation of all CSS class names set for an element.getProperty
(StateNode node, String name) Gets the value of the given property.getPropertyNames
(StateNode node) Gets the defined property names.getShadowRoot
(StateNode node) Gets shadow root for thenode
if it has been attached.Returns a style instance for managing element inline styles.Gets the tag name for the given node.boolean
hasAttribute
(StateNode node, String attribute) Checks if the given attribute has been set.boolean
hasProperty
(StateNode node, String name) Checks if the given property has been set.void
insertChild
(StateNode node, int index, Element child) Inserts the given child at the given position.boolean
isTextNode
(StateNode node) Checks if the state node represents a text node.boolean
Gets thenode
visibility.void
removeAllChildren
(StateNode node) Removes all child elements.void
removeAttribute
(StateNode node, String attribute) Removes the given attribute if it has been set.void
removeChild
(StateNode node, int index) Removes the child at the given position.void
removeChild
(StateNode node, Element child) Removes the given child.void
removeProperty
(StateNode node, String name) Removes the given property if it has been set.void
setAttribute
(StateNode node, String attribute, AbstractStreamResource resource) Sets the given attribute to the givenStreamResource
value.void
setAttribute
(StateNode node, String attribute, String value) Sets the given attribute to the given value.void
setProperty
(StateNode node, String name, Serializable value, boolean emitChange) Sets the given property to the given value.void
setVisible
(StateNode node, boolean visible) Sets thenode
visibility.void
visit
(StateNode node, NodeVisitor visitor) Visit thenode
applyingvisitor
to 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
-
Constructor Details
-
AbstractTextElementStateProvider
public AbstractTextElementStateProvider()
-
-
Method Details
-
isTextNode
Description copied from interface:ElementStateProvider
Checks if the state node represents a text node.- Specified by:
isTextNode
in interfaceElementStateProvider
- Parameters:
node
- the node to check- Returns:
true
if the state node represents a text node; otherwisefalse
-
getTag
Description copied from interface:ElementStateProvider
Gets the tag name for the given node.- Specified by:
getTag
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the tag name
-
setAttribute
Description copied from interface:ElementStateProvider
Sets the given attribute to the given value.- Specified by:
setAttribute
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataattribute
- the attribute name, not nullvalue
- the attribute value
-
getAttribute
Description copied from interface:ElementStateProvider
Gets the value of the given attribute.- Specified by:
getAttribute
in 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
Description copied from interface:ElementStateProvider
Checks if the given attribute has been set.- Specified by:
hasAttribute
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataattribute
- the attribute name, not null- Returns:
- true if the attribute has been set, false otherwise
-
removeAttribute
Description copied from interface:ElementStateProvider
Removes the given attribute if it has been set.- Specified by:
removeAttribute
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataattribute
- the attribute name, not null
-
getAttributeNames
Description copied from interface:ElementStateProvider
Gets the defined attribute names.- Specified by:
getAttributeNames
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the defined attribute names
-
getChildCount
Description copied from interface:ElementStateProvider
Gets the number of child elements.- Specified by:
getChildCount
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the number of child elements
-
getChild
Description copied from interface:ElementStateProvider
Returns the child element at the given position.- Specified by:
getChild
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataindex
- the index of the child element to return- Returns:
- the child element
-
insertChild
Description copied from interface:ElementStateProvider
Inserts the given child at the given position.- Specified by:
insertChild
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataindex
- the position at which to insert the new childchild
- the child element to insert
-
removeChild
Description copied from interface:ElementStateProvider
Removes the child at the given position.- Specified by:
removeChild
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataindex
- the position of the child element to remove
-
removeChild
Description copied from interface:ElementStateProvider
Removes the given child.- Specified by:
removeChild
in interfaceElementStateProvider
- Parameters:
node
- the node containing the datachild
- the child element to remove
-
removeAllChildren
Description copied from interface:ElementStateProvider
Removes all child elements.- Specified by:
removeAllChildren
in interfaceElementStateProvider
- 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 interfaceElementStateProvider
- Parameters:
node
- the node containing the dataeventType
- the event typelistener
- the listener- Returns:
- a handle for configuring or removing the listener
-
getProperty
Description copied from interface:ElementStateProvider
Gets the value of the given property.- Specified by:
getProperty
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataname
- the property name, not null- Returns:
- the property value, or
null
if the property has not been set
-
setProperty
Description copied from interface:ElementStateProvider
Sets the given property to the given value.- Specified by:
setProperty
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataname
- the property name, notnull
value
- the property valueemitChange
- true to create a change event for the client side
-
removeProperty
Description copied from interface:ElementStateProvider
Removes the given property if it has been set.- Specified by:
removeProperty
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataname
- the property name, notnull
-
hasProperty
Description copied from interface:ElementStateProvider
Checks if the given property has been set.- Specified by:
hasProperty
in interfaceElementStateProvider
- Parameters:
node
- the node containing the dataname
- the property name, notnull
- Returns:
true
if the property has been set,false
otherwise
-
getPropertyNames
Description copied from interface:ElementStateProvider
Gets the defined property names.- Specified by:
getPropertyNames
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the defined property names
-
getClassList
Description copied from interface:ElementStateProvider
Gets a list representation of all CSS class names set for an element.- Specified by:
getClassList
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the class list, never
null
-
getStyle
Description copied from interface:ElementStateProvider
Returns a style instance for managing element inline styles.- Specified by:
getStyle
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the element styles
-
setAttribute
Description copied from interface:ElementStateProvider
Sets the given attribute to the givenStreamResource
value.- Specified by:
setAttribute
in 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:ElementStateProvider
Adds a property change listener.- Specified by:
addPropertyChangeListener
in 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
Description copied from interface:ElementStateProvider
Gets shadow root for thenode
if it has been attached.- Specified by:
getShadowRoot
in interfaceElementStateProvider
- Parameters:
node
- the node having a shadow root, notnull
- Returns:
- the shadow root of the
node
, may be null
-
attachShadow
Description copied from interface:ElementStateProvider
Attaches the shadow root for thenode
.- Specified by:
attachShadow
in 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:ElementStateProvider
Attaches a child element with the giventagName
which is the next sibling for thepreviousSibling
.The
previousSibling
parameter value can benull
which means that the very first child with the giventagName
will be used to attach (if any).- Specified by:
attachExistingElement
in interfaceElementStateProvider
- Parameters:
node
- the parent nodetagName
- the tag name of the element to attach, notnull
previousSibling
- previous sibling, may benull
callback
- the callback which will be invoked with a server side element instance or an error will be reported, notnull
-
appendVirtualChild
Description copied from interface:ElementStateProvider
Append the given element as a virtual child.- Specified by:
appendVirtualChild
in interfaceElementStateProvider
- Parameters:
node
- the node containing the datachild
- the child element to addtype
- the type of additional payload datapayload
- the additional payload data
-
visit
Description copied from interface:ElementStateProvider
Visit thenode
applyingvisitor
to it and its descendants based on the return value from the visitor.- Specified by:
visit
in interfaceElementStateProvider
- Parameters:
node
- the node to visitvisitor
- the visitor to apply to the node
-
setVisible
Description copied from interface:ElementStateProvider
Sets thenode
visibility.- Specified by:
setVisible
in interfaceElementStateProvider
- Parameters:
node
- the node containing the datavisible
- the node visibility value
-
isVisible
Description copied from interface:ElementStateProvider
Gets thenode
visibility.- Specified by:
isVisible
in interfaceElementStateProvider
- Parameters:
node
- the node containing the data- Returns:
- the node visibility
-