Class ClipboardCopyAction
java.lang.Object
com.vaadin.flow.component.trigger.AbstractAction
com.vaadin.flow.component.trigger.ClipboardCopyAction
- All Implemented Interfaces:
Action,Serializable
Copies a value to the user's clipboard via
navigator.clipboard.writeText.
The Clipboard API requires the call to happen inside a short-lived user
gesture (click, key press, …). Bind this action to a Trigger that
fires during such a gesture, e.g. ClickTrigger.
Output<String> value = new PropertyOutput<>(textField, "value",
String.class);
new ClickTrigger(button).triggers(new ClipboardCopyAction(value));
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClipboardCopyAction(Output<String> textOutput) Creates a clipboard-copy action that copies the value produced by the given output. -
Method Summary
Modifier and TypeMethodDescriptiontools.jackson.databind.node.ObjectNodebuildClientConfig(ConfigContext context) Produces the JSON configuration this action sends to the client.Methods inherited from class com.vaadin.flow.component.trigger.AbstractAction
applyServerSideEffect, getTypeId
-
Field Details
-
TYPE_ID
- See Also:
-
-
Constructor Details
-
ClipboardCopyAction
Creates a clipboard-copy action that copies the value produced by the given output.- Parameters:
textOutput- the output supplying the text to copy, notnull
-
-
Method Details
-
getTextOutput
- Returns:
- the output supplying the text
-
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
-