Class SignalBindingFeature
java.lang.Object
com.vaadin.flow.internal.nodefeature.NodeFeature
com.vaadin.flow.internal.nodefeature.ServerSideFeature
com.vaadin.flow.internal.nodefeature.SignalBindingFeature
- All Implemented Interfaces:
Serializable
Node feature for binding
Signals to various properties of a node.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a SignalBindingFeature for the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoidclearBindings(String keyPrefix) Clears all bindings with keys starting with the given prefix.<T> Signal<T> Gets the signal bound to the given key.<T> SerializableConsumer<T> getWriteCallback(String key) Gets the write callback for the given key.booleanhasBinding(String key) Checks whether there is a binding for the given key.voidremoveBinding(String key) Removes the binding for the given key.voidsetBinding(String key, Registration registration, Signal<?> signal) Sets a binding for the given key.voidsetBinding(String key, Registration registration, Signal<?> signal, SerializableConsumer<?> writeCallback) Sets a binding for the given key with a write callback.<T> booleanupdateSignalByWriteCallback(String key, T oldValue, T newValue, SerializableBiPredicate<T, T> valueEquals, SerializableConsumer<T> revertCallback) Updates the signal value by invoking the write callback for the given key.Methods inherited from class com.vaadin.flow.internal.nodefeature.ServerSideFeature
collectChanges, forEachChild, generateChangesFromEmptyMethods inherited from class com.vaadin.flow.internal.nodefeature.NodeFeature
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode, onAttach, onDetach
-
Field Details
-
CLASSES
- See Also:
-
ENABLED
- See Also:
-
VALUE
- See Also:
-
THEMES
- See Also:
-
HTML_CONTENT
- See Also:
-
CHILDREN
- See Also:
-
-
Constructor Details
-
SignalBindingFeature
Creates a SignalBindingFeature for the given node.- Parameters:
node- the node which supports the feature
-
-
Method Details
-
hasBinding
Checks whether there is a binding for the given key.- Parameters:
key- the key- Returns:
- true if there is a binding for the given key, false otherwise
-
clearBindings
Clears all bindings with keys starting with the given prefix.- Parameters:
keyPrefix- the key prefix
-
removeBinding
Removes the binding for the given key.- Parameters:
key- the key
-
getWriteCallback
Gets the write callback for the given key.- Type Parameters:
T- the type of the consumer value- Parameters:
key- the key- Returns:
- the write callback for the given key, or null if no callback is set
-
getSignal
Gets the signal bound to the given key.- Type Parameters:
T- the type of the signal value- Parameters:
key- the key- Returns:
- the signal bound to the given key, or null if no signal is bound
-
updateSignalByWriteCallback
public <T> boolean updateSignalByWriteCallback(String key, T oldValue, T newValue, SerializableBiPredicate<T, T> valueEquals, SerializableConsumer<T> revertCallback) Updates the signal value by invoking the write callback for the given key. The callback is expected to update the signal value, and this method will check whether the signal value was updated to the expected new value. If the signal value differs from the expected new value after the callback, the revert callback will be invoked with the current signal value to revert the change.- Type Parameters:
T- the type of the signal value- Parameters:
key- the key for which to update the signal valueoldValue- the old value before the update, used for comparison in case of revertnewValue- the expected new value to be set by the write callbackvalueEquals- a predicate to compare signal values for equalityrevertCallback- a callback to revert the component value to the updated signal's value if the signal value does not match the expected new value after invoking the write callback- Returns:
- true if the signal value was updated to the expected new value, false if a revert was performed