Class ClipboardCopy

java.lang.Object
com.vaadin.flow.component.clipboard.ClipboardCopy
All Implemented Interfaces:
Registration, Serializable

public final class ClipboardCopy extends Object implements Registration, Serializable
Handle for a client-side click-to-copy registration created by Clipboard.copyOnClick(Component, String) (and overloads).

Use setValue(String) to push a new text value to the client without re-installing the handler. Call remove() to detach the click handler when the trigger should no longer copy.

See Also:
  • Method Details

    • setValue

      public void setValue(String text)
      Updates the text that will be copied when the trigger element is clicked. The new value is synchronized to the client without a server round-trip on click.

      Only meaningful for handles returned by the copyOnClick string overloads. For copyOnClick(trigger, sourceComponent) and copyImageOnClick, the value is read live from the source on each click and this setter has no effect.

      Parameters:
      text - the new text to copy; null is treated as an empty string
    • remove

      public void remove()
      Removes the client-side click handler and releases any return channels registered for success/error callbacks. Idempotent.
      Specified by:
      remove in interface Registration
      See Also: