Class ClipboardEvent
java.lang.Object
com.vaadin.flow.component.clipboard.ClipboardEvent
- All Implemented Interfaces:
Serializable
Payload delivered to listeners registered via
Clipboard.addPasteListener(com.vaadin.flow.component.Component, com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.clipboard.ClipboardEvent>), Clipboard.addCopyListener(com.vaadin.flow.component.Component, com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.clipboard.ClipboardEvent>) or
Clipboard.addCutListener(com.vaadin.flow.component.Component, com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.clipboard.ClipboardEvent>).
A paste event may carry plain text, HTML, files, or any combination. Copy and cut events typically carry only text and HTML — files are paste-only on the browser side.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetFiles()Returns the files attached to this event.@Nullable StringgetHtml()Returns the HTML payload, ornullif the event carried none.@Nullable StringgetText()Returns the plain-text payload, ornullif the event carried none.getType()booleanhasFiles()Returns whether the event carried at least one file.booleanhasHtml()Returns whether the event carried a non-empty HTML payload.booleanhasText()Returns whether the event carried a non-empty plain-text payload.
-
Field Details
-
PASTE
Event type identifier for paste events.- See Also:
-
COPY
Event type identifier for copy events.- See Also:
-
CUT
Event type identifier for cut events.- See Also:
-
-
Method Details
-
getType
- Returns:
- the event type
-
getText
Returns the plain-text payload, ornullif the event carried none.- Returns:
- the plain text, or
null
-
getHtml
Returns the HTML payload, ornullif 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:
trueifgetText()is non-null and non-empty
-
hasHtml
public boolean hasHtml()Returns whether the event carried a non-empty HTML payload.- Returns:
trueifgetHtml()is non-null and non-empty
-
hasFiles
public boolean hasFiles()Returns whether the event carried at least one file.- Returns:
trueifgetFiles()is non-empty
-
getFiles
Returns the files attached to this event. Empty for copy and cut events.- Returns:
- an unmodifiable list of files, never
null
-