Class ElementPropertyMap
java.lang.Object
com.vaadin.flow.internal.nodefeature.NodeFeature
com.vaadin.flow.internal.nodefeature.NodeMap
com.vaadin.flow.internal.nodefeature.AbstractPropertyMap
com.vaadin.flow.internal.nodefeature.ElementPropertyMap
- All Implemented Interfaces:
Serializable
Map for element property values.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.internal.nodefeature.NodeMap
NodeMap.SignalBinding -
Constructor Summary
ConstructorsConstructorDescriptionElementPropertyMap(StateNode node) Creates a new element property map for the given node. -
Method Summary
Modifier and TypeMethodDescriptionaddPropertyChangeListener(String name, PropertyChangeListener listener) Adds a property change listener.deferredUpdateFromClient(String key, Serializable value) Updates a property value from the client and returns a Runnable for firing the associated PropertyChangeEvent.protected SerializableGets the value corresponding to the given key.static ElementPropertyMapGets the model map for the given node.protected booleanmayUpdateFromClient(String key, Serializable value) Checks whether the client is allowed to store the given value with the given key.protected booleanproducePutChange(String key, boolean hadValueEarlier, Serializable newValue) Checks whether aMapPutChangeshould be produced.protected Serializableput(String key, Serializable value, boolean emitChange) Stores a value with the given key, replacing any value previously stored with the same key.protected SerializableRemoves the value stored for the given key.resolveModelList(String modelPath) Resolves theModelListthat the model path refers to.resolveModelMap(String modelPath) Resolves theElementPropertyMapthat the model path refers to.voidsetProperty(String name, Serializable value) Sets a property to the given value.voidsetProperty(String name, Serializable value, boolean emitChange) Sets a property to the given value.voidsetPropertyFromSignal(String name, Object value) Applies a value coming from a signal to the property while preserving an existing binding.voidsetUpdateFromClientFilter(SerializablePredicate<String> updateFromClientFilter) Sets a filter that will be used by for determining whether a property maybe updated from the client.Methods inherited from class com.vaadin.flow.internal.nodefeature.AbstractPropertyMap
bindSignal, getProperty, getPropertyNames, hasProperty, hasSignal, isValidValueType, removeAllProperties, removeProperty, updateFromClientMethods inherited from class com.vaadin.flow.internal.nodefeature.NodeMap
clear, collectChanges, contains, forEachChild, generateChangesFromEmpty, getOrDefault, getOrDefault, getOrDefault, keySet, putMethods inherited from class com.vaadin.flow.internal.nodefeature.NodeFeature
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
-
Constructor Details
-
ElementPropertyMap
Creates a new element property map for the given node.- Parameters:
node- the node that the map belongs to
-
-
Method Details
-
deferredUpdateFromClient
public Runnable deferredUpdateFromClient(String key, Serializable value) throws PropertyChangeDeniedException Updates a property value from the client and returns a Runnable for firing the associated PropertyChangeEvent.- Parameters:
key- the key to usevalue- the value to store- Returns:
- a runnable for firing the deferred change event
- Throws:
PropertyChangeDeniedException- if the property change is disallowed due to the property not being set as synchronized, or the signal bound to the property is not a ValueSignal and can not thus be updated
-
setProperty
Description copied from class:AbstractPropertyMapSets a property to the given value.- Overrides:
setPropertyin classAbstractPropertyMap- Parameters:
name- the property namevalue- the value, must be a string, a boolean, a double ornullemitChange- true to create a change event for the client side
-
setProperty
Sets a property to the given value.- Parameters:
name- the property namevalue- the value, must be a string, a boolean, a double ornull- See Also:
-
get
Description copied from class:NodeMapGets the value corresponding to the given key. -
setPropertyFromSignal
Description copied from class:AbstractPropertyMapApplies a value coming from a signal to the property while preserving an existing binding.- Specified by:
setPropertyFromSignalin classAbstractPropertyMap- Parameters:
name- the property namevalue- the value to apply;nullremoves the property on the client but keeps the binding and last-applied value asnull
-
addPropertyChangeListener
Adds a property change listener.- Parameters:
name- 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
-
put
Description copied from class:NodeMapStores a value with the given key, replacing any value previously stored with the same key. -
remove
Description copied from class:NodeMapRemoves the value stored for the given key. -
mayUpdateFromClient
Description copied from class:NodeMapChecks whether the client is allowed to store the given value with the given key. Always returnsfalseby default.- Overrides:
mayUpdateFromClientin classNodeMap- Parameters:
key- the key to usevalue- the value to store- Returns:
trueif the value update is accepted,falseif the value should not be allowed to be updated
-
producePutChange
Description copied from class:NodeMapChecks whether aMapPutChangeshould be produced.- Overrides:
producePutChangein classNodeMap- Parameters:
key- a key to produce a changehadValueEarlier- whether the value was already earlier in the mapnewValue- the new value for thekey- Returns:
trueif a change should be produced,falseotherwise
-
setUpdateFromClientFilter
Sets a filter that will be used by for determining whether a property maybe updated from the client. The filter is recursively inherited to child model properties.- Parameters:
updateFromClientFilter- the filter to set, ornullto remove the current filter
-
resolveModelMap
Resolves theElementPropertyMapthat the model path refers to.If the model path contains separate dot separated parts, any non-existing part will be created during resolving.
- Parameters:
modelPath- the path to resolve, either a single property name or a dot separated path- Returns:
- the resolved model map
-
resolveModelList
Resolves theModelListthat the model path refers to.If the model path contains separate dot separated parts, any non-existing part will be created during resolving.
- Parameters:
modelPath- the path to resolve, either a single property name or a dot separated path- Returns:
- the resolved model list
-
getModel
Gets the model map for the given node.Throws an exception if the node does not have a model map.
- Parameters:
node- the node which has a model map- Returns:
- the model map for the node
-