aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-04-23 20:45:14 +0300
committerArtur Signell <artur@vaadin.com>2014-04-23 20:45:39 +0300
commit41cb27e85f61f5abb029a98af66217ce400b2196 (patch)
tree609df412869abde48131079d45b2981bcb210744 /client
parent9f30eb285252348c349e9a759ac71098eb74a06a (diff)
parent0d4080ba5e5931fa928675ba6c95540e34b2f281 (diff)
downloadvaadin-framework-41cb27e85f61f5abb029a98af66217ce400b2196.tar.gz
vaadin-framework-41cb27e85f61f5abb029a98af66217ce400b2196.zip
Merge changes from origin/7.1
0d4080b ContainerEventProvider returns style names from container. Fixes #10718 6e91bdf Add test for TransactionalPropertyWrapper memory leaks f0aaf89 Fixed resetting of ComboBox if focused and new items allowed (#13413). e033fcd Always initialize WebBrowser for new sessions (#13571) 168de1f Revert "Drag image for text-area should contain text of text-area (#13557)" 35e2a34 Fix FieldGroup and TransactionalPropertyWrapper memory leaks (#13438) 7e5d44d Introduce a drag threshold for Drag and Drop (#13381) f227f0c Drag image for text-area should contain text of text-area (#13557). Change-Id: Idb01471f8ab0c7118fa884c364e6bc200d13948a
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java4
-rw-r--r--client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java74
2 files changed, 40 insertions, 38 deletions
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index 8dec26cf90..c9c1d9c50c 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -267,7 +267,9 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
// we have focus in field, prompting can't be set on, instead
// just clear the input if the value has changed from something
// else to null
- if (getWidget().selectedOptionKey != null) {
+ if (getWidget().selectedOptionKey != null
+ || (getWidget().allowNewItem && !getWidget().tb
+ .getValue().isEmpty())) {
getWidget().tb.setValue("");
}
}
diff --git a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java
index f44fceb398..1b1d7d72d8 100644
--- a/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java
+++ b/client/src/com/vaadin/client/ui/dd/VDragAndDropManager.java
@@ -31,7 +31,6 @@ import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Event.NativePreviewEvent;
import com.google.gwt.user.client.Event.NativePreviewHandler;
-import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ApplicationConnection;
@@ -340,10 +339,7 @@ public class VDragAndDropManager {
.addNativePreviewHandler(defaultDragAndDropEventHandler);
if (dragElement != null
&& dragElement.getParentElement() == null) {
- // deferred attaching drag image is on going, we can
- // hurry with it now
- lazyAttachDragElement.cancel();
- lazyAttachDragElement.run();
+ attachDragElement();
}
}
// just capture something to prevent text selection in IE
@@ -365,6 +361,13 @@ public class VDragAndDropManager {
deferredStartRegistration = Event
.addNativePreviewHandler(new NativePreviewHandler() {
+ private int startX = Util
+ .getTouchOrMouseClientX(currentDrag
+ .getCurrentGwtEvent());
+ private int startY = Util
+ .getTouchOrMouseClientY(currentDrag
+ .getCurrentGwtEvent());
+
@Override
public void onPreviewNativeEvent(
NativePreviewEvent event) {
@@ -417,13 +420,23 @@ public class VDragAndDropManager {
}
case Event.ONMOUSEMOVE:
case Event.ONTOUCHMOVE:
- if (deferredStartRegistration != null) {
- deferredStartRegistration.removeHandler();
- deferredStartRegistration = null;
+ int currentX = Util
+ .getTouchOrMouseClientX(event
+ .getNativeEvent());
+ int currentY = Util
+ .getTouchOrMouseClientY(event
+ .getNativeEvent());
+ if (Math.abs(startX - currentX) > 3
+ || Math.abs(startY - currentY) > 3) {
+ if (deferredStartRegistration != null) {
+ deferredStartRegistration
+ .removeHandler();
+ deferredStartRegistration = null;
+ }
+ currentDrag.setCurrentGwtEvent(event
+ .getNativeEvent());
+ startDrag.execute();
}
- currentDrag.setCurrentGwtEvent(event
- .getNativeEvent());
- startDrag.execute();
break;
default:
// on any other events, clean up the
@@ -712,16 +725,7 @@ public class VDragAndDropManager {
updateDragImagePosition();
if (isStarted) {
- lazyAttachDragElement.run();
- } else {
- /*
- * To make our default dnd handler as compatible as possible, we
- * need to defer the appearance of dragElement. Otherwise events
- * that are derived from sequences of other events might not
- * fire as domchanged will fire between them or mouse up might
- * happen on dragElement.
- */
- lazyAttachDragElement.schedule(300);
+ attachDragElement();
}
}
}
@@ -730,24 +734,20 @@ public class VDragAndDropManager {
return dragElement;
}
- private final Timer lazyAttachDragElement = new Timer() {
-
- @Override
- public void run() {
- if (dragElement != null && dragElement.getParentElement() == null) {
- ApplicationConnection connection = getCurrentDragApplicationConnection();
- Element dragImageParent;
- if (connection == null) {
- VConsole.error("Could not determine ApplicationConnection for current drag operation. The drag image will likely look broken");
- dragImageParent = RootPanel.getBodyElement();
- } else {
- dragImageParent = VOverlay.getOverlayContainer(connection);
- }
- dragImageParent.appendChild(dragElement);
+ public void attachDragElement() {
+ if (dragElement != null && dragElement.getParentElement() == null) {
+ ApplicationConnection connection = getCurrentDragApplicationConnection();
+ Element dragImageParent;
+ if (connection == null) {
+ VConsole.error("Could not determine ApplicationConnection for current drag operation. The drag image will likely look broken");
+ dragImageParent = RootPanel.getBodyElement();
+ } else {
+ dragImageParent = VOverlay.getOverlayContainer(connection);
}
-
+ dragImageParent.appendChild(dragElement);
}
- };
+
+ }
private Command deferredCommand;