Package com.vaadin.flow.dom.impl
Class ShadowRootStateProvider
java.lang.Object
com.vaadin.flow.dom.impl.AbstractNodeStateProvider
com.vaadin.flow.dom.impl.ShadowRootStateProvider
- All Implemented Interfaces:
ElementStateProvider,Serializable
Implementation which handles shadow root nodes.
Only the methods implemented in the AbstractNodeStateProvider are
supported (related to the composition).
The data is stored directly in the state node but this should be considered an implementation detail which can change.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
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.attachShadow(StateNode node) Attaches the shadow root for thenode.voidbindAttributeSignal(Element owner, String attribute, Signal<String> signal) Binds the given signal to the given attribute.Create a new shadow root node for the given elementnode.static ShadowRootStateProviderget()Gets the one and only instance.getAttribute(StateNode node, String attribute) Gets the value of the given attribute.getAttributeNames(StateNode node) Gets the defined attribute names.getClassList(StateNode node) Gets a list representation of all CSS class names set for an element.protected Node<?> Gets the flyweight instance for thenodesupported by the provider.getProperty(StateNode node, String name) Gets the value of the given property.getPropertyNames(StateNode node) Gets the defined property names.protected Class<? extends NodeFeature>[]Returns the features supported by the provider.getShadowRoot(StateNode node) Gets shadow root for thenodeif it has been attached.Returns a style instance for managing element inline styles.Gets the tag name for the given node.getTextContent(StateNode node) Gets the text content.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.booleanisTextNode(StateNode node) Checks if the state node represents a text node.booleanGets thenodevisibility.protected ObjectvoidremoveAttribute(StateNode node, String attribute) Removes the given attribute if it has been set.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.voidsetTextContent(StateNode node, String textContent) Sets the text content.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 com.vaadin.flow.dom.impl.AbstractNodeStateProvider
appendVirtualChild, attachExistingElement, getChild, getChildCount, getParent, insertChild, removeAllChildren, removeChild, removeChild, supports, visitDescendantsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.dom.ElementStateProvider
getComponent, setComponent
-
Constructor Details
-
ShadowRootStateProvider
public ShadowRootStateProvider()
-
-
Method Details
-
get
Gets the one and only instance.- Returns:
- the instance to use for shadow root nodes
-
createShadowRootNode
Create a new shadow root node for the given elementnode.- Parameters:
node- the node to create the shadow root for- Returns:
- the shadow root node
-
getTag
Description copied from interface:ElementStateProviderGets the tag name for the given node.- Parameters:
node- the node containing the data- Returns:
- the tag name
-
setAttribute
Description copied from interface:ElementStateProviderSets the given attribute to the given value.- Parameters:
node- the node containing the dataattribute- the attribute name, not nullvalue- the attribute value
-
bindAttributeSignal
Description copied from interface:ElementStateProviderBinds the given signal to the given attribute.nullsignal unbinds existing binding.- Parameters:
owner- the owner element for which the signal is bound, notnullattribute- the name of the attributesignal- the signal to bind ornullto unbind any existing binding
-
setAttribute
Description copied from interface:ElementStateProviderSets the given attribute to the givenStreamResourcevalue.- Parameters:
node- the node containing the dataattribute- the attribute name, not nullresource- the attribute value, not null
-
getAttribute
Description copied from interface:ElementStateProviderGets the value of the given attribute.- 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:ElementStateProviderChecks if the given attribute has been set.- 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:ElementStateProviderRemoves the given attribute if it has been set.- Parameters:
node- the node containing the dataattribute- the attribute name, not null
-
getAttributeNames
Description copied from interface:ElementStateProviderGets the defined attribute names.- Parameters:
node- the node containing the data- Returns:
- the defined attribute names
-
addEventListener
public DomListenerRegistration addEventListener(StateNode node, String eventType, DomEventListener listener) Description copied from interface:ElementStateProviderAdds a DOM event listener.- 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:ElementStateProviderGets the value of the given property.- 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
Description copied from interface:ElementStateProviderSets the given property to the given value.- 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
Description copied from interface:ElementStateProviderRemoves the given property if it has been set.- Parameters:
node- the node containing the dataname- the property name, notnull
-
hasProperty
Description copied from interface:ElementStateProviderChecks if the given property has been set.- Parameters:
node- the node containing the dataname- the property name, notnull- Returns:
trueif the property has been set,falseotherwise
-
getPropertyNames
Description copied from interface:ElementStateProviderGets the defined property names.- Parameters:
node- the node containing the data- Returns:
- the defined property names
-
isTextNode
Description copied from interface:ElementStateProviderChecks if the state node represents a text node.- Parameters:
node- the node to check- Returns:
trueif the state node represents a text node; otherwisefalse
-
getTextContent
Description copied from interface:ElementStateProviderGets the text content. This is only valid ifElementStateProvider.isTextNode(StateNode)returnstrue.- Parameters:
node- the node containing the data- Returns:
- the text content
-
setTextContent
Description copied from interface:ElementStateProviderSets the text content. This is only valid ifElementStateProvider.isTextNode(StateNode)returnstrue.- Parameters:
node- the node containing the datatextContent- the text content, not null
-
getClassList
Description copied from interface:ElementStateProviderGets a list representation of all CSS class names set for an element.- Parameters:
node- the node containing the data- Returns:
- the class list, never
null
-
getStyle
Description copied from interface:ElementStateProviderReturns a style instance for managing element inline styles.- Parameters:
node- the node containing the data- Returns:
- the element styles
-
addPropertyChangeListener
public Registration addPropertyChangeListener(StateNode node, String name, PropertyChangeListener listener) Description copied from interface:ElementStateProviderAdds a property change listener.- 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:ElementStateProviderGets shadow root for thenodeif it has been attached.- Parameters:
node- the node having a shadow root, notnull- Returns:
- the shadow root of the
node, may be null
-
attachShadow
Description copied from interface:ElementStateProviderAttaches the shadow root for thenode.- Parameters:
node- the node to attach the shadow root- Returns:
- the shadow root of the
node
-
visit
Description copied from interface:ElementStateProviderVisit thenodeapplyingvisitorto it and its descendants based on the return value from the visitor.- Parameters:
node- the node to visitvisitor- the visitor to apply to the node
-
getProviderFeatures
Description copied from class:AbstractNodeStateProviderReturns the features supported by the provider.- Specified by:
getProviderFeaturesin classAbstractNodeStateProvider- Returns:
- features supported by the provider
-
getNode
Description copied from class:AbstractNodeStateProviderGets the flyweight instance for thenodesupported by the provider.- Specified by:
getNodein classAbstractNodeStateProvider- Parameters:
node- the node to wrap into flyweight- Returns:
- the flyweight instance for the
node - See Also:
-
setVisible
Description copied from interface:ElementStateProviderSets thenodevisibility.- Parameters:
node- the node containing the datavisible- the node visibility value
-
isVisible
Description copied from interface:ElementStateProviderGets thenodevisibility.- Parameters:
node- the node containing the data- Returns:
- the node visibility
-
readResolve
- Throws:
ObjectStreamException
-