summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2013-02-11 17:04:15 +0200
committerVaadin Code Review <review@vaadin.com>2013-02-18 17:11:50 +0000
commitc4a0bc318ec9c6b41d652e7020ee39784cc1eb10 (patch)
treed9decb3f9b52f9b15a580b5e4cc7e3a0b7fde539 /server/src
parentf3ad9cad8d3c12e3e25574569186d52c79c4f2a1 (diff)
downloadvaadin-framework-c4a0bc318ec9c6b41d652e7020ee39784cc1eb10.tar.gz
vaadin-framework-c4a0bc318ec9c6b41d652e7020ee39784cc1eb10.zip
Properly pass the AbstractField internal value to shared state in Slider and ProgressIndicator (#10921)
* In case of a null value, 0 is stored to shared state. This is consistent with how CheckBox is already implemented. * This somewhat hacky solution should be replaced with a better one once AbstractField itself is migrated. See #11064. Change-Id: I2b313af8491a6deccdc7a509dcd1b718482cdcd4
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/ui/CheckBox.java7
-rw-r--r--server/src/com/vaadin/ui/ProgressIndicator.java15
-rw-r--r--server/src/com/vaadin/ui/Slider.java16
3 files changed, 38 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/CheckBox.java b/server/src/com/vaadin/ui/CheckBox.java
index 22b90b224f..0ace0a4f26 100644
--- a/server/src/com/vaadin/ui/CheckBox.java
+++ b/server/src/com/vaadin/ui/CheckBox.java
@@ -110,6 +110,13 @@ public class CheckBox extends AbstractField<Boolean> {
return (CheckBoxState) super.getState();
}
+ /*
+ * Overridden to keep the shared state in sync with the AbstractField
+ * internal value. Should be removed once AbstractField is refactored to use
+ * shared state.
+ *
+ * See tickets #10921 and #11064.
+ */
@Override
protected void setInternalValue(Boolean newValue) {
super.setInternalValue(newValue);
diff --git a/server/src/com/vaadin/ui/ProgressIndicator.java b/server/src/com/vaadin/ui/ProgressIndicator.java
index 96c2d2814a..c481aa1e8f 100644
--- a/server/src/com/vaadin/ui/ProgressIndicator.java
+++ b/server/src/com/vaadin/ui/ProgressIndicator.java
@@ -157,4 +157,19 @@ public class ProgressIndicator extends AbstractField<Float> implements
return getState().pollingInterval;
}
+ /*
+ * Overridden to keep the shared state in sync with the AbstractField
+ * internal value. Should be removed once AbstractField is refactored to use
+ * shared state.
+ *
+ * See tickets #10921 and #11064.
+ */
+ @Override
+ protected void setInternalValue(Float newValue) {
+ super.setInternalValue(newValue);
+ if (newValue == null) {
+ newValue = 0.0f;
+ }
+ getState().state = newValue;
+ }
}
diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java
index 2bf05f895c..e63fdc5e10 100644
--- a/server/src/com/vaadin/ui/Slider.java
+++ b/server/src/com/vaadin/ui/Slider.java
@@ -263,6 +263,22 @@ public class Slider extends AbstractField<Double> {
getState().value = newFieldValue;
}
+ /*
+ * Overridden to keep the shared state in sync with the AbstractField
+ * internal value. Should be removed once AbstractField is refactored to use
+ * shared state.
+ *
+ * See tickets #10921 and #11064.
+ */
+ @Override
+ protected void setInternalValue(Double newValue) {
+ super.setInternalValue(newValue);
+ if (newValue == null) {
+ newValue = 0.0;
+ }
+ getState().value = newValue;
+ }
+
/**
* Thrown when the value of the slider is about to be set to a value that is
* outside the valid range of the slider.