summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-03-13 11:14:24 +0200
committerArtur Signell <artur@vaadin.com>2013-03-13 11:40:07 +0200
commit5cba827316eed64508ffb254edb95f303f44eab9 (patch)
treec0f54bcc226b3b2c24c16e459261be70305af836 /server/src
parent499e13878e3cb3711b21c21406166cee72ba98bf (diff)
downloadvaadin-framework-5cba827316eed64508ffb254edb95f303f44eab9.tar.gz
vaadin-framework-5cba827316eed64508ffb254edb95f303f44eab9.zip
Fixed client-server value sync problem in CheckBox (#11028)
Change-Id: I1bac8e8a746bcc97b3ce929e76cf3476ad793bf6
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/ui/CheckBox.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/CheckBox.java b/server/src/com/vaadin/ui/CheckBox.java
index 0ace0a4f26..ac33f5e410 100644
--- a/server/src/com/vaadin/ui/CheckBox.java
+++ b/server/src/com/vaadin/ui/CheckBox.java
@@ -16,6 +16,8 @@
package com.vaadin.ui;
+import org.json.JSONException;
+
import com.vaadin.data.Property;
import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
@@ -37,6 +39,21 @@ public class CheckBox extends AbstractField<Boolean> {
return;
}
+ /*
+ * Client side updates the state before sending the event so we need
+ * to make sure the cached state is updated to match the client. If
+ * we do not do this, a reverting setValue() call in a listener will
+ * not cause the new state to be sent to the client.
+ *
+ * See #11028, #10030.
+ */
+ try {
+ getUI().getConnectorTracker().getDiffState(CheckBox.this)
+ .put("checked", checked);
+ } catch (JSONException e) {
+ throw new RuntimeException(e);
+ }
+
final Boolean oldValue = getValue();
final Boolean newValue = checked;