T
- Type of the drop target component.public class DropEvent<T extends AbstractComponent> extends Component.Event
DropTargetExtension.addDropListener(DropListener)
,
Serialized Formsource
Constructor and Description |
---|
DropEvent(T target,
Map<String,String> data,
DropEffect dropEffect,
DragSourceExtension<? extends AbstractComponent> dragSourceExtension,
MouseEventDetails mouseEventDetails)
Creates a server side drop event.
|
Modifier and Type | Method and Description |
---|---|
T |
getComponent()
Returns the drop target component where the drop event occurred.
|
Map<String,String> |
getDataTransferData()
Get all of the transfer data from the
DataTransfer object. |
Optional<String> |
getDataTransferData(String type)
Get data from the
DataTransfer object. |
String |
getDataTransferText()
Get data of any of the types
"text" , "Text" or "text/plain" . |
Optional<Object> |
getDragData()
Gets the server side drag data.
|
Optional<AbstractComponent> |
getDragSourceComponent()
Returns the drag source component if the drag originated from a component
in the same UI as the drop target component, or an empty optional.
|
Optional<DragSourceExtension<? extends AbstractComponent>> |
getDragSourceExtension()
Returns the extension of the drag source component if the drag originated
from a component in the same UI as the drop target component, or an empty
optional.
|
DropEffect |
getDropEffect()
Get the desired dropEffect for the drop event.
|
MouseEventDetails |
getMouseEventDetails()
Gets the mouse event details for the drop event.
|
getConnector
getSource, toString
public DropEvent(T target, Map<String,String> data, DropEffect dropEffect, DragSourceExtension<? extends AbstractComponent> dragSourceExtension, MouseEventDetails mouseEventDetails)
target
- Component that received the drop.data
- Map containing all types and corresponding data from the
DataTransfer
object.dropEffect
- the desired drop effectdragSourceExtension
- Drag source extension of the component that initiated the drop
event.mouseEventDetails
- Mouse event details object containing information about the
drop eventpublic Optional<String> getDataTransferData(String type)
DataTransfer
object.type
- Data format, e.g. text/plain
or text/uri-list
.DataTransfer
, otherwise Optional.empty()
.public String getDataTransferText()
"text"
, "Text"
or "text/plain"
.
IE 11 transfers data dropped from the desktop as "Text"
while
most other browsers transfer textual data as "text/plain"
.
"text"
, "Text"
or "text/plain"
, or null
if none of them exist.public Map<String,String> getDataTransferData()
DataTransfer
object. The
data can be iterated to find the most relevant data as it preserves the
order in which the data was set to the drag source element.DataTransfer
object.public DropEffect getDropEffect()
NOTE: Currently you cannot trust this to work on all browsers!
https://github.com/vaadin/framework/issues/9247 For Chrome & IE11 it is
never set and always returns DropEffect.NONE
even though the drop
succeeded!
public Optional<AbstractComponent> getDragSourceComponent()
public Optional<DragSourceExtension<? extends AbstractComponent>> getDragSourceExtension()
public Optional<Object> getDragData()
Optional
.DragSourceExtension.setDragData(Object)
public MouseEventDetails getMouseEventDetails()
public T getComponent()
getComponent
in class Component.Event
Copyright © 2018 Vaadin Ltd. All rights reserved.