summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/CheckBox.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui/CheckBox.java')
-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;