public class ElementPropertyMap extends AbstractPropertyMap
Constructor and Description |
---|
ElementPropertyMap(StateNode node)
Creates a new element property map for the given node.
|
Modifier and Type | Method and Description |
---|---|
Registration |
addPropertyChangeListener(String name,
PropertyChangeListener listener)
Adds a property change listener.
|
Runnable |
deferredUpdateFromClient(String key,
Serializable value)
Updates a property value from the client and returns a Runnable for
firing the associated PropertyChangeEvent.
|
static ElementPropertyMap |
getModel(StateNode node)
Gets the model map for the given node.
|
protected boolean |
mayUpdateFromClient(String key,
Serializable value)
Checks whether the client is allowed to store the given value with the
given key.
|
protected Serializable |
put(String key,
Serializable value,
boolean emitChange)
Stores a value with the given key, replacing any value previously stored
with the same key.
|
protected Serializable |
remove(String key)
Removes the value stored for the given key.
|
ModelList |
resolveModelList(String modelPath)
Resolves the
ModelList that the model path refers to. |
ElementPropertyMap |
resolveModelMap(String modelPath)
Resolves the
ElementPropertyMap that the model path refers to. |
void |
setProperty(String name,
Serializable value)
Sets a property to the given value.
|
void |
setProperty(String name,
Serializable value,
boolean emitChange)
Sets a property to the given value.
|
void |
setUpdateFromClientFilter(SerializablePredicate<String> updateFromClientFilter)
Sets a filter that will be used by for determining whether a property
maybe updated from the client.
|
getProperty, getPropertyNames, hasProperty, isValidValueType, removeAllProperties, removeProperty
clear, collectChanges, contains, forEachChild, generateChangesFromEmpty, get, getOrDefault, getOrDefault, getOrDefault, keySet, put, updateFromClient
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
public ElementPropertyMap(StateNode node)
node
- the node that the map belongs topublic Runnable deferredUpdateFromClient(String key, Serializable value)
key
- the key to usevalue
- the value to storepublic void setProperty(String name, Serializable value, boolean emitChange)
AbstractPropertyMap
setProperty
in class AbstractPropertyMap
name
- the property namevalue
- the value, must be a string, a boolean, a double or
null
emitChange
- true to create a change event for the client sidepublic void setProperty(String name, Serializable value)
name
- the property namevalue
- the value, must be a string, a boolean, a double or
null
setProperty(String, Serializable, boolean)
public Registration addPropertyChangeListener(String name, PropertyChangeListener listener)
name
- the property name to add the listener forlistener
- listener to get notifications about property value changesprotected Serializable put(String key, Serializable value, boolean emitChange)
NodeMap
protected Serializable remove(String key)
NodeMap
protected boolean mayUpdateFromClient(String key, Serializable value)
NodeMap
false
by default.mayUpdateFromClient
in class NodeMap
key
- the key to usevalue
- the value to storetrue
if the value update is accepted,
false
if the value should not be allowed to be
updatedpublic void setUpdateFromClientFilter(SerializablePredicate<String> updateFromClientFilter)
updateFromClientFilter
- the filter to set, or null
to remove the current
filterpublic ElementPropertyMap resolveModelMap(String modelPath)
ElementPropertyMap
that the model path refers to.
If the model path contains separate dot separated parts, any non-existing part will be created during resolving.
modelPath
- the path to resolve, either a single property name or a dot
separated pathpublic ModelList resolveModelList(String modelPath)
ModelList
that the model path refers to.
If the model path contains separate dot separated parts, any non-existing part will be created during resolving.
modelPath
- the path to resolve, either a single property name or a dot
separated pathpublic static ElementPropertyMap getModel(StateNode node)
Throws an exception if the node does not have a model map.
node
- the node which has a model mapCopyright © 2018. All rights reserved.