Class SignalOutput<T>
java.lang.Object
com.vaadin.flow.component.trigger.AbstractOutput<T>
com.vaadin.flow.component.trigger.SignalOutput<T>
- Type Parameters:
T- the runtime type of the produced value
- All Implemented Interfaces:
Output<T>,Serializable
Output backed by a server-side
Signal. The signal's current value is
snapshotted into the client config at each emit; a host-scoped effect
subscribes to the signal so that every change re-emits the snapshot.
Snapshot semantics: actions read the latest value at trigger fire time. This
is a value reader, not a graph builder — composing computed outputs remains
the signal layer's job (use Signal.cached(com.vaadin.flow.signals.Signal<T>)).
ValueSignal<String> locale = ...;
new ClickTrigger(button).triggers(
new ClipboardCopyAction(new SignalOutput<>(String.class, locale)));
The effect that wires the re-emit is created lazily on the first
buildClientConfig call against an attached host, and is cleaned up
automatically by ElementEffect when the host detaches.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSignalOutput(Class<T> valueType, Signal<T> signal) Creates a signal-backed output. -
Method Summary
Modifier and TypeMethodDescriptiontools.jackson.databind.node.ObjectNodebuildClientConfig(ConfigContext context) Produces the JSON configuration this output sends to the client.static <T> SignalOutput<T> of(ValueSignal<T> signal, Class<T> valueType) Convenience for the common case: pair aValueSignalwith an output of the same value type.Methods inherited from class com.vaadin.flow.component.trigger.AbstractOutput
getTypeId, getValueType
-
Field Details
-
TYPE_ID
- See Also:
-
-
Constructor Details
-
SignalOutput
Creates a signal-backed output.- Parameters:
valueType- runtime type of the produced value, notnullsignal- the source signal, notnull
-
-
Method Details
-
of
Convenience for the common case: pair aValueSignalwith an output of the same value type.- Type Parameters:
T- the value type- Parameters:
signal- the source signal, notnullvalueType- runtime type, notnull- Returns:
- a new SignalOutput
-
getSignal
- Returns:
- the source signal
-
buildClientConfig
Description copied from class:AbstractOutputProduces the JSON configuration this output sends to the client. Default is an empty object; override to add type-specific options.Subclasses encode element references by calling
ConfigContext.referenceElement(com.vaadin.flow.dom.Element). Public so the internal framework can read the config without reflection; subclasses just override.- Overrides:
buildClientConfigin classAbstractOutput<T>- Parameters:
context- the resolver for referenced elements, notnull- Returns:
- a Jackson
ObjectNode, nevernull
-