From a773c8c7b365e4041db87b5d9ddaad0bdc244a91 Mon Sep 17 00:00:00 2001 From: Adam Wagner Date: Fri, 7 Apr 2017 09:52:06 +0300 Subject: Make it possible to drop things between Grid rows (#8979) Fixes #8401 --- .../com/vaadin/event/dnd/grid/GridDropEvent.java | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'server/src/main/java/com/vaadin/event') 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 * The Grid bean type. @@ -32,9 +33,10 @@ import com.vaadin.ui.Grid; public class GridDropEvent extends DropEvent> { 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 extends DropEvent> { * @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 target, String dataTransferText, DragSourceExtension 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 extends DropEvent> { 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; + } } -- cgit v1.2.3