aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/advanced
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2017-05-02 17:25:36 +0300
committerPekka Hyvönen <pekka@vaadin.com>2017-05-02 17:25:36 +0300
commitd5c7d4b68a2befa3ec874eae8a456614d0333233 (patch)
tree07da146d62e5c8b29abb484d430f24d71a67fa37 /documentation/advanced
parent1f070e124d628ea439a3369e99bbc07bdd917e8d (diff)
downloadvaadin-framework-d5c7d4b68a2befa3ec874eae8a456614d0333233.tar.gz
vaadin-framework-d5c7d4b68a2befa3ec874eae8a456614d0333233.zip
Add method for checking whether drag event was cancelled (#9214)
Diffstat (limited to 'documentation/advanced')
-rw-r--r--documentation/advanced/advanced-dragndrop.asciidoc10
1 files changed, 8 insertions, 2 deletions
diff --git a/documentation/advanced/advanced-dragndrop.asciidoc b/documentation/advanced/advanced-dragndrop.asciidoc
index 732b020806..1b424ed167 100644
--- a/documentation/advanced/advanced-dragndrop.asciidoc
+++ b/documentation/advanced/advanced-dragndrop.asciidoc
@@ -45,11 +45,17 @@ The [classname]#DragStartEvent# is fired when the drag has started, and the [cla
dragSource.addDragStartListener(event ->
event.getComponent().addStyleName("dragged")
);
-dragSource.addDragEndListener(event ->
+dragSource.addDragEndListener(event -> {
event.getComponent().removeStyleName("dragged")
-);
+
+ if (event.isCanceled()) {
+ Notification.show("Drag event was canceled");
+ }
+});
----
+You can check whether the drag was canceled using the `isCanceled()` method.
+
It is possible to transfer any Object as server side data to the drop target if both the drag source and drop target are placed in the same UI. This data is available in the drop event via the `DropEvent.getDragData()` method.
[source, java]