public class BasicElementStateProvider extends AbstractNodeStateProvider
This should be considered a low level class focusing on performance and leaving most sanity checks to the caller.
The data is stored directly in the state node but this should be considered an implementation detail which can change.
| Modifier and Type | Method and Description | 
|---|---|
DomListenerRegistration | 
addEventListener(StateNode node,
                String eventType,
                DomEventListener listener)
Adds a DOM event listener. 
 | 
Registration | 
addPropertyChangeListener(StateNode node,
                         String name,
                         PropertyChangeListener listener)
Adds a property change listener. 
 | 
void | 
addSynchronizedProperty(StateNode node,
                       String property,
                       DisabledUpdateMode mode)
Makes the property synchronized from the client side to the server. 
 | 
StateNode | 
attachShadow(StateNode node)
Attaches the shadow root for the  
node. | 
static StateNode | 
createStateNode(String tag)
Creates a compatible element state node using the given  
tag. | 
static BasicElementStateProvider | 
get()
Gets the one and only instance. 
 | 
String | 
getAttribute(StateNode node,
            String attribute)
Gets the value of the given attribute. 
 | 
Stream<String> | 
getAttributeNames(StateNode node)
Gets the defined attribute names. 
 | 
ClassList | 
getClassList(StateNode node)
Gets a list representation of all CSS class names set for an element. 
 | 
static Collection<Class<? extends NodeFeature>> | 
getFeatures()
Gets all the features used by an element node. 
 | 
protected Node<?> | 
getNode(StateNode node)
Gets the flyweight instance for the  
node supported by the
 provider. | 
Node | 
getParent(StateNode node)
Gets the parent element. 
 | 
Serializable | 
getProperty(StateNode node,
           String name)
Gets the value of the given property. 
 | 
Stream<String> | 
getPropertyNames(StateNode node)
Gets the defined property names. 
 | 
protected Class<? extends NodeFeature>[] | 
getProviderFeatures()
Returns the features supported by the provider. 
 | 
StateNode | 
getShadowRoot(StateNode node)
Gets shadow root for the  
node if it has been attached. | 
Style | 
getStyle(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. 
 | 
String | 
getTag(StateNode node)
Gets the tag name for the given node. 
 | 
String | 
getTextContent(StateNode node)
Gets the text content. 
 | 
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. 
 | 
boolean | 
isTextNode(StateNode node)
Checks if the state node represents a text node. 
 | 
boolean | 
isVisible(StateNode node)
Gets the  
node visibility. | 
void | 
removeAttribute(StateNode node,
               String attribute)
Removes the given attribute if it has been set. 
 | 
void | 
removeProperty(StateNode node,
              String name)
Removes the given property if it has been set. 
 | 
void | 
setAttribute(StateNode node,
            String attribute,
            AbstractStreamResource receiver)
Sets the given attribute to the given  
StreamResource 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 | 
setTextContent(StateNode node,
              String textContent)
Sets the text content. 
 | 
void | 
setVisible(StateNode node,
          boolean visible)
Sets the  
node visibility. | 
boolean | 
supports(StateNode node)
Checks if the element state provider supports the given state node. 
 | 
void | 
visit(StateNode node,
     NodeVisitor visitor)
Visit the  
node applying visitor to it and its descendants
 based on the return value from the visitor. | 
appendVirtualChild, attachExistingElement, getChild, getChildCount, insertChild, removeAllChildren, removeChild, removeChild, visitDescendantsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetComponent, setComponentpublic static BasicElementStateProvider get()
public static StateNode createStateNode(String tag)
tag.tag - the tag to use for the elementpublic boolean supports(StateNode node)
ElementStateProvidersupports in interface ElementStateProvidersupports in class AbstractNodeStateProvidernode - the state node to checkpublic String getTag(StateNode node)
ElementStateProvidernode - the node containing the datapublic void setAttribute(StateNode node, String attribute, String value)
ElementStateProvidernode - the node containing the dataattribute - the attribute name, not nullvalue - the attribute valuepublic String getAttribute(StateNode node, String attribute)
ElementStateProvidernode - the node containing the dataattribute - the attribute name, not nullpublic boolean hasAttribute(StateNode node, String attribute)
ElementStateProvidernode - the node containing the dataattribute - the attribute name, not nullpublic void removeAttribute(StateNode node, String attribute)
ElementStateProvidernode - the node containing the dataattribute - the attribute name, not nullpublic Stream<String> getAttributeNames(StateNode node)
ElementStateProvidernode - the node containing the datapublic Node getParent(StateNode node)
ElementStateProvidergetParent in interface ElementStateProvidergetParent in class AbstractNodeStateProvidernode - the node containing the datapublic DomListenerRegistration addEventListener(StateNode node, String eventType, DomEventListener listener)
ElementStateProvidernode - the node containing the dataeventType - the event typelistener - the listenerpublic static Collection<Class<? extends NodeFeature>> getFeatures()
public Serializable getProperty(StateNode node, String name)
ElementStateProvidernode - the node containing the dataname - the property name, not nullnull if the property has not
         been setpublic void setProperty(StateNode node, String name, Serializable value, boolean emitChange)
ElementStateProvidernode - the node containing the dataname - the property name, not nullvalue - the property valueemitChange - true to create a change event for the client sidepublic void removeProperty(StateNode node, String name)
ElementStateProvidernode - the node containing the dataname - the property name, not nullpublic boolean hasProperty(StateNode node, String name)
ElementStateProvidernode - the node containing the dataname - the property name, not nulltrue if the property has been set,
         false otherwisepublic Stream<String> getPropertyNames(StateNode node)
ElementStateProvidernode - the node containing the datapublic boolean isTextNode(StateNode node)
ElementStateProvidernode - the node to checktrue if the state node represents a text node;
         otherwise falsepublic String getTextContent(StateNode node)
ElementStateProviderElementStateProvider.isTextNode(StateNode) returns true.node - the node containing the datapublic void setTextContent(StateNode node, String textContent)
ElementStateProviderElementStateProvider.isTextNode(StateNode) returns true.node - the node containing the datatextContent - the text content, not nullpublic ClassList getClassList(StateNode node)
ElementStateProvidernode - the node containing the datanullpublic Style getStyle(StateNode node)
ElementStateProvidernode - the node containing the datapublic Set<String> getSynchronizedProperties(StateNode node)
ElementStateProvider
 The events which trigger synchronization are defined using
 ElementStateProvider.getSynchronizedPropertyEvents(StateNode).
node - the node containing the datapublic Set<String> getSynchronizedPropertyEvents(StateNode node)
ElementStateProvidernode - the node containing the datapublic void setAttribute(StateNode node, String attribute, AbstractStreamResource receiver)
ElementStateProviderStreamResource value.node - the node containing the dataattribute - the attribute name, not nullreceiver - the attribute value, not nullpublic Registration addPropertyChangeListener(StateNode node, String name, PropertyChangeListener listener)
ElementStateProvidernode - the node containing the propertyname - the property name to add the listener forlistener - listener to get notifications about property value changespublic StateNode getShadowRoot(StateNode node)
ElementStateProvidernode if it has been attached.node - the node having a shadow root, not nullnode, may be nullpublic StateNode attachShadow(StateNode node)
ElementStateProvidernode.node - the node to attach the shadow rootnodepublic void visit(StateNode node, NodeVisitor visitor)
ElementStateProvidernode applying visitor to it and its descendants
 based on the return value from the visitor.node - the node to visitvisitor - the visitor to apply to the nodepublic void setVisible(StateNode node, boolean visible)
ElementStateProvidernode visibility.node - the node containing the datavisible - the node visibility valuepublic boolean isVisible(StateNode node)
ElementStateProvidernode visibility.node - the node containing the datapublic void addSynchronizedProperty(StateNode node, String property, DisabledUpdateMode mode)
ElementStateProvider
 The events which trigger synchronization are defined using
 ElementStateProvider.getSynchronizedPropertyEvents(StateNode).
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, not nullElementStateProvider.getSynchronizedPropertyEvents(StateNode), 
ElementStateProvider.getSynchronizedProperties(StateNode)protected Node<?> getNode(StateNode node)
AbstractNodeStateProvidernode supported by the
 provider.getNode in class AbstractNodeStateProvidernode - the node to wrap into flyweightnodeAbstractNodeStateProvider.supports(StateNode)protected Class<? extends NodeFeature>[] getProviderFeatures()
AbstractNodeStateProvidergetProviderFeatures in class AbstractNodeStateProviderCopyright © 2019. All rights reserved.