aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/CheckBox.java
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/CheckBox.java')
-rw-r--r--server/src/main/java/com/vaadin/ui/CheckBox.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/CheckBox.java b/server/src/main/java/com/vaadin/ui/CheckBox.java
index 8675332eb5..84f816741d 100644
--- a/server/src/main/java/com/vaadin/ui/CheckBox.java
+++ b/server/src/main/java/com/vaadin/ui/CheckBox.java
@@ -60,7 +60,7 @@ public class CheckBox extends AbstractField<Boolean>
if (!newValue.equals(oldValue)) {
// The event is only sent if the switch state is changed
- setValue(newValue);
+ setValue(newValue, true);
}
};
@@ -118,6 +118,25 @@ public class CheckBox extends AbstractField<Boolean>
super.setValue(value);
}
+ /**
+ * Sets the value of this CheckBox. If the new value is not equal to
+ * {@code getValue()}, fires a {@link ValueChangeEvent}. Throws
+ * {@code NullPointerException} if the value is null.
+ *
+ * @param value
+ * the new value, not {@code null}
+ * @param userOriginated
+ * {@code true} if this event originates from the client,
+ * {@code false} otherwise.
+ * @throws NullPointerException
+ * if {@code value} is {@code null}
+ */
+ @Override
+ protected boolean setValue(Boolean value, boolean userOriginated) {
+ Objects.requireNonNull(value, "CheckBox value must not be null");
+ return super.setValue(value, userOriginated);
+ }
+
@Override
public Boolean getEmptyValue() {
return false;