Class SetEnabledAction
java.lang.Object
com.vaadin.flow.component.trigger.AbstractAction
com.vaadin.flow.component.trigger.SetEnabledAction
- All Implemented Interfaces:
Action,Serializable
Sets a target element's enabled state. Runs client-side by toggling the
disabled attribute so the change is visible the instant the
triggering DOM event handler returns — closing the latency window in which a
user could otherwise click the element a second time before the server
acknowledges the first click.
The server-side Component.setEnabled(boolean) (or
Element.setEnabled(boolean)) mirror is applied in the next server
cycle so application code observes the same enabled state.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSetEnabledAction(Component target, boolean enabled) Creates a set-enabled action targeting the component's root element.SetEnabledAction(Element target, boolean enabled) Creates a set-enabled action. -
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.booleanMethods inherited from class com.vaadin.flow.component.trigger.AbstractAction
getTypeId
-
Field Details
-
TYPE_ID
- See Also:
-
-
Constructor Details
-
SetEnabledAction
Creates a set-enabled action.- Parameters:
target- the element to enable or disable, notnullenabled-trueto enable,falseto disable
-
SetEnabledAction
Creates a set-enabled action targeting the component's root element.- Parameters:
target- the component to enable or disable, notnullenabled-trueto enable,falseto disable
-
-
Method Details
-
getTarget
- Returns:
- the target element
-
isEnabled
public boolean isEnabled()- Returns:
- the value the action sets
-
buildClientConfig
Description copied from class:AbstractActionProduces 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.- Overrides:
buildClientConfigin classAbstractAction- Parameters:
context- the resolver for referenced elements and outputs, notnull- Returns:
- a Jackson
ObjectNode, nevernull
-
applyServerSideEffect
public void applyServerSideEffect()Description copied from class:AbstractActionMirrors 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.- Overrides:
applyServerSideEffectin classAbstractAction
-