Class GridDropEvent<T>
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<Grid<T>>
io.jmix.groupgridflowui.kit.vaadin.grid.dnd.GridDropEvent<T>
- Type Parameters:
T- The Grid bean type.
- All Implemented Interfaces:
Serializable
@DomEvent("grid-drop")
public class GridDropEvent<T>
extends com.vaadin.flow.component.ComponentEvent<Grid<T>>
Drop event that occurs on the
Grid or its rows.-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionGridDropEvent(Grid<T> source, boolean fromClient, elemental.json.JsonObject item, String dropLocation, elemental.json.JsonArray dragData) Creates a grid drop event. -
Method Summary
Modifier and TypeMethodDescriptionGet all of the transfer data from theDataTransferobject.getDataTransferData(String type) Get data from theDataTransferobject.Get data of any of the types"text","Text"or"text/plain".Get the location of the drop within the row.Get the row the drop happened on.Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListenerMethods inherited from class java.util.EventObject
toString
-
Constructor Details
-
GridDropEvent
public GridDropEvent(Grid<T> source, boolean fromClient, @EventData("event.detail.dropTargetItem") elemental.json.JsonObject item, @EventData("event.detail.dropLocation") String dropLocation, @EventData("event.detail.dragData") elemental.json.JsonArray dragData) Creates a grid drop event.- Parameters:
source- Component that was dragged.fromClient-trueif the event originated from the client side,falseotherwiseitem- The item on which the drop occurred, fromdetail.dropTargetItem.dropLocation- Drop location fromdetail.dropLocation.dragData- Drag data fromdetail.dragData.
-
-
Method Details
-
getDropTargetItem
Get the row the drop happened on.If the drop was not on top of a row (see
getDropLocation()) orGridDropMode.ON_GRIDis used, then returns an empty optional.- Returns:
- The item of the row the drop happened on, or an empty optional if drop was not on a row
-
getDropLocation
Get the location of the drop within the row.NOTE: the location will be
GridDropLocation.EMPTYif:- dropped on an empty grid
- dropping on rows was not possible because of
GridDropMode.ON_GRIDwas used GridDropMode.ON_TOPis used and the drop happened on empty space after last row or on top of the header / footer
- Returns:
- location of the drop in relative to the
getDropTargetItem()orGridDropLocation.EMPTYif no target row present - See Also:
-
getDataTransferData
Get data from theDataTransferobject.- Parameters:
type- Data format, e.g.text/plainortext/uri-list.- Returns:
- Optional data for the given format if exists in the
DataTransfer, otherwiseOptional.empty().
-
getDataTransferText
Get data of any of the types"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".- Returns:
- First existing data of types in order
"text","Text"or"text/plain", ornullif none of them exist.
-
getDataTransferData
Get all of the transfer data from theDataTransferobject. 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.- Returns:
- Map of type/data pairs, containing all the data from the
DataTransferobject.
-