Class ClipboardEvent

java.lang.Object
com.vaadin.flow.component.clipboard.ClipboardEvent
All Implemented Interfaces:
Serializable

public final class ClipboardEvent extends Object implements Serializable
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Event type identifier for copy events.
    static final String
    Event type identifier for cut events.
    static final String
    Event type identifier for paste events.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the files attached to this event.
    @Nullable String
    Returns the HTML payload, or null if the event carried none.
    @Nullable String
    Returns the plain-text payload, or null if the event carried none.
    Returns the event type — one of PASTE, COPY, CUT.
    boolean
    Returns whether the event carried at least one file.
    boolean
    Returns whether the event carried a non-empty HTML payload.
    boolean
    Returns whether the event carried a non-empty plain-text payload.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getType

      public String getType()
      Returns the event type — one of PASTE, COPY, CUT.
      Returns:
      the event type
    • getText

      public @Nullable String getText()
      Returns the plain-text payload, or null if the event carried none.
      Returns:
      the plain text, or null
    • getHtml

      public @Nullable String getHtml()
      Returns the HTML payload, or null if the event carried none. Useful when the user pastes rich text from a web page or word processor.
      Returns:
      the HTML, or null
    • hasText

      public boolean hasText()
      Returns whether the event carried a non-empty plain-text payload.
      Returns:
      true if getText() is non-null and non-empty
    • hasHtml

      public boolean hasHtml()
      Returns whether the event carried a non-empty HTML payload.
      Returns:
      true if getHtml() is non-null and non-empty
    • hasFiles

      public boolean hasFiles()
      Returns whether the event carried at least one file.
      Returns:
      true if getFiles() is non-empty
    • getFiles

      public List<ClipboardFile> getFiles()
      Returns the files attached to this event. Empty for copy and cut events.
      Returns:
      an unmodifiable list of files, never null