diff options
author | Maciej PrzepioĢra <matthew@vaadin.com> | 2015-03-16 15:44:43 +0100 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-03-29 14:17:46 +0000 |
commit | 722072bb53f0699bc337446048db2beade0df421 (patch) | |
tree | 5ae5f1074f6bd21f326c411efe1201ff29946c50 /client/src | |
parent | 6986117ced043eb01039dc61efe2d222c76981ce (diff) | |
download | vaadin-framework-722072bb53f0699bc337446048db2beade0df421.tar.gz vaadin-framework-722072bb53f0699bc337446048db2beade0df421.zip |
Do proper cleanup in VDragAndDropManager.endDrag(boolean) (#17163)
Change-Id: I5f9462923fce9f033bc89b791d68607a1e0fc5c7
Diffstat (limited to 'client/src')
-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); } |