Class ImageBlobInput

java.lang.Object
com.vaadin.flow.component.trigger.internal.Action.Input<Object>
com.vaadin.flow.component.trigger.internal.ImageBlobInput
All Implemented Interfaces:
Serializable

public class ImageBlobInput extends Action.Input<Object>
Input that produces the source <img> element of a component, for use as the image slot of WriteToClipboardAction. The TS helper (window.Vaadin.Flow.clipboard.writePayload) re-encodes it to image/png via a canvas round-trip ? the only image MIME type every browser's asynchronous Clipboard API accepts on write.

The Java type parameter is purely a marker: the value never crosses the network ? the action calls the TS helper with the live Element reference and the canvas conversion happens entirely on the client.

For internal use only. May be renamed or removed in a future release.

Since:
25.2
See Also:
  • Constructor Details

    • ImageBlobInput

      public ImageBlobInput(Component source)
      Creates an image input that yields the given component's root element as the source <img>.
      Parameters:
      source - the component carrying the <img> root element, not null; its root tag must be img
      Throws:
      IllegalArgumentException - if the source's root element is not an <img>
    • ImageBlobInput

      public ImageBlobInput(Element source)
      Creates an image input that yields the given element as the source <img>.
      Parameters:
      source - the source <img> element, not null; its tag must be img
      Throws:
      IllegalArgumentException - if the source element is not an <img>
  • Method Details

    • toJs

      public JsFunction toJs(Trigger trigger)
      Description copied from class: Action.Input
      Builds the JsFunction that yields this input's value when called. The function may take event as a runtime argument (declared by the subclass via JsFunction.withArguments(String...)); inputs that don't need event simply omit the declaration and ignore the argument the caller passes.

      Public so that Action implementations in any package can consume inputs they receive as parameters, not only inputs they created themselves.

      Specified by:
      toJs in class Action.Input<Object>
      Parameters:
      trigger - the surrounding trigger this render is for, not null
      Returns:
      the input's JS function, not null