Enum Class ClipboardAvailability

java.lang.Object
java.lang.Enum<ClipboardAvailability>
com.vaadin.flow.component.clipboard.ClipboardAvailability
All Implemented Interfaces:
Serializable, Comparable<ClipboardAvailability>, Constable

public enum ClipboardAvailability extends Enum<ClipboardAvailability>
Whether the browser exposes the asynchronous Clipboard API in the current page context.

Returned by Clipboard.availabilityHintSignal(). Reading the value does not trigger a permission prompt — it only reports whether navigator.clipboard is exposed and the page is served in a context where the API can be used.

Typical usage:

  • AVAILABLE — show copy / paste controls; clipboard operations are usable.
  • UNSUPPORTED — hide clipboard controls; no user action will make them work in this context (page served over plain HTTP, or embedded in an iframe whose Permissions-Policy blocks clipboard-write / clipboard-read).
  • UNKNOWN — wait for the bootstrap handshake to complete; the brief window between server attach and the first client report holds this value.
  • Enum Constant Details

    • AVAILABLE

      public static final ClipboardAvailability AVAILABLE
      The Clipboard API is exposed and usable in the current page context. Subsequent copyOnClick / paste-listener calls are expected to succeed when invoked from a user gesture.
    • UNSUPPORTED

      public static final ClipboardAvailability UNSUPPORTED
      The Clipboard API is unusable in the current page context — the page is served over an insecure connection (plain HTTP rather than HTTPS or localhost), embedded in an iframe whose Permissions-Policy blocks clipboard-write, or the browser does not expose navigator.clipboard at all. No user action can change this, so applications should hide clipboard-related controls.
    • UNKNOWN

      public static final ClipboardAvailability UNKNOWN
      No value has been reported by the browser yet. Used only as the initial value of the signal before the first client handshake delivers the real one. In normal request handling the signal is seeded before any user code (UI initialization, UIInitListener, component attach) runs, so this value is essentially never observed in practice; once a real value has arrived, the signal never returns to UNKNOWN.
  • Method Details

    • values

      public static ClipboardAvailability[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ClipboardAvailability valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null