diff options
author | Adam Wagner <wbadam@users.noreply.github.com> | 2017-02-22 15:36:58 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-02-22 15:36:58 +0200 |
commit | 813a99cfeff9d9cd70d77bd5d9ae75f5fa7b2ff5 (patch) | |
tree | de49df11876668ab0e0d4e6f42266bfdc5ff629d /client | |
parent | 998ea1f48a37ce04fea9ad4bcc49bf98ac511652 (diff) | |
download | vaadin-framework-813a99cfeff9d9cd70d77bd5d9ae75f5fa7b2ff5.tar.gz vaadin-framework-813a99cfeff9d9cd70d77bd5d9ae75f5fa7b2ff5.zip |
Make DragSource extension/component available in DropEvent (#8636)
* Make DragSource extension/component available in DropEvent (resolves #8439)
* Update drag and drop test to use new API
* Change type of drag source and update javadoc
* Use existing data map instead of DataTransfer
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java | 9 | ||||
-rw-r--r-- | client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java index 532b9877fc..b823167572 100644 --- a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java @@ -42,6 +42,11 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector { private static final String CLASS_DRAGGABLE = "v-draggable"; + /** + * Data type for storing drag source extension connector's ID + */ + static final String DATA_TYPE_DRAG_SOURCE_ID = "drag-source-id"; + // Create event listeners private final EventListener dragStartListener = this::onDragStart; private final EventListener dragEndListener = this::onDragEnd; @@ -104,6 +109,10 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector { nativeEvent.getDataTransfer().setData(format, data.get(format)); } + // Store the extension's connector ID in DataTransfer.data + nativeEvent.getDataTransfer() + .setData(DATA_TYPE_DRAG_SOURCE_ID, getConnectorId()); + // Initiate firing server side dragstart event when there is a // DragStartListener attached on the server side if (hasEventListener(DragSourceState.EVENT_DRAGSTART)) { diff --git a/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java index 3a9cbbfe84..37d62ad7c0 100644 --- a/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/DropTargetExtensionConnector.java @@ -193,7 +193,8 @@ public class DropTargetExtensionConnector extends AbstractExtensionConnector { } getRpcProxy(DropTargetRpc.class) - .drop(types, data, getState().dropEffect); + .drop(types, data, getState().dropEffect, data.get( + DragSourceExtensionConnector.DATA_TYPE_DRAG_SOURCE_ID)); } removeTargetIndicator(getDropTargetElement()); |