aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/event
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2017-04-07 09:52:06 +0300
committerHenri Sara <henri.sara@gmail.com>2017-04-12 14:58:11 +0300
commita773c8c7b365e4041db87b5d9ddaad0bdc244a91 (patch)
tree422ce4db5bde123c7dc775d70e49e259c17b2dce /server/src/main/java/com/vaadin/event
parent659313e8c35e68d14fe2599b9bbb4dbba35fb4a3 (diff)
downloadvaadin-framework-a773c8c7b365e4041db87b5d9ddaad0bdc244a91.tar.gz
vaadin-framework-a773c8c7b365e4041db87b5d9ddaad0bdc244a91.zip
Make it possible to drop things between Grid rows (#8979)
Fixes #8401
Diffstat (limited to 'server/src/main/java/com/vaadin/event')
-rw-r--r--server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java b/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java
index 07ba1327a6..98d1b3495b 100644
--- a/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java
+++ b/server/src/main/java/com/vaadin/event/dnd/grid/GridDropEvent.java
@@ -17,11 +17,12 @@ package com.vaadin.event.dnd.grid;
import com.vaadin.event.dnd.DragSourceExtension;
import com.vaadin.event.dnd.DropEvent;
+import com.vaadin.shared.ui.grid.DropLocation;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Grid;
/**
- * Server side drop event on an HTML5 drop target {@link Grid} row.
+ * Drop event on an HTML5 drop target {@link Grid} row.
*
* @param <T>
* The Grid bean type.
@@ -32,9 +33,10 @@ import com.vaadin.ui.Grid;
public class GridDropEvent<T> extends DropEvent<Grid<T>> {
private final T dropTargetRow;
+ private final DropLocation dropLocation;
/**
- * Creates a server side Grid row drop event.
+ * Creates a Grid row drop event.
*
* @param target
* Grid that received the drop.
@@ -44,16 +46,18 @@ public class GridDropEvent<T> extends DropEvent<Grid<T>> {
* @param dragSourceExtension
* Drag source extension of the component that initiated the drop
* event.
- * @param dropTargetRowKey
- * Key of the target row that received the drop.
+ * @param dropTargetRow
+ * Target row that received the drop.
+ * @param dropLocation
+ * Location of the drop within the target row.
*/
public GridDropEvent(Grid<T> target, String dataTransferText,
DragSourceExtension<? extends AbstractComponent> dragSourceExtension,
- String dropTargetRowKey) {
+ T dropTargetRow, DropLocation dropLocation) {
super(target, dataTransferText, dragSourceExtension);
- dropTargetRow = target.getDataCommunicator().getKeyMapper()
- .get(dropTargetRowKey);
+ this.dropTargetRow = dropTargetRow;
+ this.dropLocation = dropLocation;
}
/**
@@ -64,4 +68,13 @@ public class GridDropEvent<T> extends DropEvent<Grid<T>> {
public T getDropTargetRow() {
return dropTargetRow;
}
+
+ /**
+ * Get the location of the drop within the row.
+ *
+ * @return Location of the drop within the row.
+ */
+ public DropLocation getDropLocation() {
+ return dropLocation;
+ }
}