Record Class PasteOptions

java.lang.Object
java.lang.Record
com.vaadin.flow.component.clipboard.PasteOptions
Record Components:
includeInputFieldPastes - whether to forward pastes whose composed path crosses an editable target (<input>, <textarea>, or an element with contenteditable). The defaults() factory sets this to false — pastes into a focused form field, including a focused field inside a Vaadin web component's shadow DOM, are skipped — which is typically what page-wide listeners want. The includingInputFields() factory sets this to true, so the listener observes every paste regardless of focus; this is also the default when no options are passed to Clipboard.onPaste(Component, SerializableConsumer).
All Implemented Interfaces:
Serializable

public record PasteOptions(boolean includeInputFieldPastes) extends Record implements Serializable
Configuration for Clipboard.onPaste.
See Also:
  • Constructor Details

    • PasteOptions

      public PasteOptions(boolean includeInputFieldPastes)
      Creates an instance of a PasteOptions record class.
      Parameters:
      includeInputFieldPastes - the value for the includeInputFieldPastes record component
  • Method Details

    • defaults

      public static PasteOptions defaults()
      Returns the default options: editable-target pastes are skipped.
      Returns:
      default options, equivalent to new PasteOptions(false)
    • includingInputFields

      public static PasteOptions includingInputFields()
      Returns:
      options that also forward pastes targeting input fields, text areas, and contenteditable elements; equivalent to new PasteOptions(true).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • includeInputFieldPastes

      public boolean includeInputFieldPastes()
      Returns the value of the includeInputFieldPastes record component.
      Returns:
      the value of the includeInputFieldPastes record component