summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-08-09 10:59:11 +0300
committerVaadin Code Review <review@vaadin.com>2013-08-09 08:31:47 +0000
commitc7a48ae008d0c2a168635b863fe2e44d708c4b02 (patch)
treee19f44b27490008b7298f618d060fa459475a5cf /client
parent4f3e81a8db20c780c3c4733627be1793fb17921a (diff)
downloadvaadin-framework-c7a48ae008d0c2a168635b863fe2e44d708c4b02.tar.gz
vaadin-framework-c7a48ae008d0c2a168635b863fe2e44d708c4b02.zip
Delay sending DateField popup value to server until popup is closed #6252
Change-Id: Ib6f4681ea38fe7a6cac8a44bc4ab4b23151844dd
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VPopupCalendar.java3
-rw-r--r--client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java32
2 files changed, 32 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index e431da127d..57a0222118 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -217,9 +217,6 @@ public class VPopupCalendar extends VTextualDate implements Field,
}
}
}
- if (isImmediate()) {
- getClient().sendPendingVariableChanges();
- }
}
}
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index 7257af4a08..627478ebe5 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -18,6 +18,9 @@ package com.vaadin.client.ui.datefield;
import java.util.Date;
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.user.client.ui.PopupPanel;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.DateTimeService;
import com.vaadin.client.UIDL;
@@ -36,6 +39,35 @@ public class PopupDateFieldConnector extends TextualDateConnector {
/*
* (non-Javadoc)
*
+ * @see com.vaadin.client.ui.AbstractConnector#init()
+ */
+ @Override
+ protected void init() {
+ getWidget().popup.addCloseHandler(new CloseHandler<PopupPanel>() {
+
+ @Override
+ public void onClose(CloseEvent<PopupPanel> event) {
+ /*
+ * FIXME This is a hack so we do not have to rewrite half of the
+ * datefield so values are not sent while selecting a date
+ * (#6252).
+ *
+ * The datefield will now only set the date UIDL variables while
+ * the user is selecting year/month/date/time and not send them
+ * directly. Only when the user closes the popup (by clicking on
+ * a day/enter/clicking outside of popup) then the new value is
+ * communicated to the server.
+ */
+ if (getWidget().isImmediate()) {
+ getConnection().sendPendingVariableChanges();
+ }
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see com.vaadin.client.ui.VTextualDate#updateFromUIDL(com.vaadin
* .client.UIDL, com.vaadin.client.ApplicationConnection)
*/