Class AbstractAction
- All Implemented Interfaces:
Action,Serializable
- Direct Known Subclasses:
ClickAction,ClipboardCopyAction,JsAction,ServerCallbackAction,SetEnabledAction
Action implementations.
Subclasses identify themselves with a namespaced type id
("flow:clipboard-copy", "myapp:show-toast", …) which must
match a factory registered against window.Vaadin.Flow.triggers on the
client side. Subclasses override buildClientConfig(com.vaadin.flow.component.trigger.internal.ConfigContext) to ship
configuration with the action; if the action has a server-observable effect
that should stay in sync with what just ran in the browser, they also
override applyServerSideEffect().
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAction(String typeId) Creates a new action with the given namespaced type id. -
Method Summary
Modifier and TypeMethodDescriptionvoidMirrors the client-side effect on the server.tools.jackson.databind.node.ObjectNodebuildClientConfig(ConfigContext context) Produces the JSON configuration this action sends to the client.final StringThe namespaced type id of this action.
-
Constructor Details
-
AbstractAction
Creates a new action with the given namespaced type id.- Parameters:
typeId- type id matching a client factory, notnull
-
-
Method Details
-
getTypeId
The namespaced type id of this action.- Returns:
- the type id, never
null
-
buildClientConfig
Produces the JSON configuration this action sends to the client. Default is an empty object; override to add type-specific options.Subclasses encode output references by calling
ConfigContext.registerOutput(Output)and element references by callingConfigContext.referenceElement(com.vaadin.flow.dom.Element). Public so the internal framework can read the config without reflection; subclasses just override.- Parameters:
context- the resolver for referenced elements and outputs, notnull- Returns:
- a Jackson
ObjectNode, nevernull
-
applyServerSideEffect
public void applyServerSideEffect()Mirrors the client-side effect on the server. Called on the UI thread, at the start of the same server cycle that processes the triggering DOM event, before any user-attached event listeners run, so that listener code observes the post-action state.Default is a no-op. Subclasses with a server-observable effect (e.g.
SetEnabledAction) override this.
-