T
- The Grid bean type.@DomEvent(value="grid-drop") public class GridDropEvent<T> extends ComponentEvent<Grid<T>>
Grid
or its rows.Grid#addDropListener(GridDropListener)
,
Serialized Formsource
Constructor and Description |
---|
GridDropEvent(Grid<T> source,
boolean fromClient,
elemental.json.JsonObject item,
String dropLocation,
elemental.json.JsonArray dragData)
Creates a grid drop event.
|
Modifier and Type | Method and Description |
---|---|
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" . |
GridDropLocation |
getDropLocation()
Get the location of the drop within the row.
|
Optional<T> |
getDropTargetItem()
Get the row the drop happened on.
|
getSource, isFromClient, unregisterListener
toString
public GridDropEvent(Grid<T> source, boolean fromClient, @EventData(value="event.detail.dropTargetItem") elemental.json.JsonObject item, @EventData(value="event.detail.dropLocation") String dropLocation, @EventData(value="event.detail.dragData") elemental.json.JsonArray dragData)
source
- Component that was dragged.fromClient
- true
if the event originated from the client
side, false
otherwiseitem
- The item on which the drop occurred, from
detail.dropTargetItem
.dropLocation
- Drop location from detail.dropLocation
.dragData
- Drag data from detail.dragData
.public Optional<T> getDropTargetItem()
If the drop was not on top of a row (see getDropLocation()
) or
GridDropMode.ON_GRID
is used, then returns an empty optional.
public GridDropLocation getDropLocation()
NOTE: the location will be GridDropLocation.EMPTY
if:
GridDropMode.ON_GRID
was usedGridDropMode.ON_TOP
is used and the drop happened on empty
space after last row or on top of the header / footer
getDropTargetItem()
or GridDropLocation.EMPTY
if
no target row presentGrid.setDropMode(GridDropMode)
public 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.Copyright © 2023. All rights reserved.