diff options
author | Maciej Przepióra <matthew@vaadin.com> | 2015-03-16 15:44:43 +0100 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2015-03-30 14:52:16 +0300 |
commit | 74f32adbd58f9488d2eeea681a8d9301366c4f2f (patch) | |
tree | d8e1acdbbd22ba74116872eea66099e46d37325e /client | |
parent | 9d7db6067e989293d72f8ce8bb6ad0c114ef3125 (diff) | |
download | vaadin-framework-74f32adbd58f9488d2eeea681a8d9301366c4f2f.tar.gz vaadin-framework-74f32adbd58f9488d2eeea681a8d9301366c4f2f.zip |
Do proper cleanup in VDragAndDropManager.endDrag(boolean) (#17163)
Change-Id: I5f9462923fce9f033bc89b791d68607a1e0fc5c7
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java index 3a0b52b6af..47f8eb1b66 100644 --- a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java +++ b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java @@ -433,23 +433,14 @@ public class VDragAndDropManager { .getNativeEvent()); if (Math.abs(startX - currentX) > MINIMUM_DISTANCE_TO_START_DRAG || Math.abs(startY - currentY) > MINIMUM_DISTANCE_TO_START_DRAG) { - if (deferredStartRegistration != null) { - deferredStartRegistration - .removeHandler(); - deferredStartRegistration = null; - } + ensureDeferredRegistrationCleanup(); currentDrag.setCurrentGwtEvent(event .getNativeEvent()); startDrag.execute(); } break; default: - // on any other events, clean up the - // deferred drag start - if (deferredStartRegistration != null) { - deferredStartRegistration.removeHandler(); - deferredStartRegistration = null; - } + ensureDeferredRegistrationCleanup(); currentDrag = null; clearDragElement(); break; @@ -540,10 +531,10 @@ public class VDragAndDropManager { } private void endDrag(boolean doDrop) { - if (handlerRegistration != null) { - handlerRegistration.removeHandler(); - handlerRegistration = null; - } + + ensureDeferredRegistrationCleanup(); + ensureHandlerRegistrationCleanup(); + boolean sendTransferableToServer = false; if (currentDropHandler != null) { if (doDrop) { @@ -601,6 +592,20 @@ public class VDragAndDropManager { } + private void ensureHandlerRegistrationCleanup() { + if (handlerRegistration != null) { + handlerRegistration.removeHandler(); + handlerRegistration = null; + } + } + + private void ensureDeferredRegistrationCleanup() { + if (deferredStartRegistration != null) { + deferredStartRegistration.removeHandler(); + deferredStartRegistration = null; + } + } + private void removeActiveDragSourceStyleName(ComponentConnector dragSource) { dragSource.getWidget().removeStyleName(ACTIVE_DRAG_SOURCE_STYLENAME); } |