diff options
author | Risto Yrjänä <risto.yrjana@vaadin.com> | 2013-06-28 15:53:03 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-06-28 13:14:07 +0000 |
commit | 6291a5080e2a6d2f0c5a955e5cf9ae984763a5aa (patch) | |
tree | da07964ae9ede1841ca4097a2d3127ca666f777d /server/src/com/vaadin/ui | |
parent | da480bdce215249344a9c80bb257a4575f072ceb (diff) | |
download | vaadin-framework-6291a5080e2a6d2f0c5a955e5cf9ae984763a5aa.tar.gz vaadin-framework-6291a5080e2a6d2f0c5a955e5cf9ae984763a5aa.zip |
Ensure that Slider diffstate always contains "value" (#12133)
Force diff state to contain "value", so that value changes from value
change listeners work.
Change-Id: I5b2c661f1297ec0272c150a5a9ff4ca26f19fefe
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r-- | server/src/com/vaadin/ui/Slider.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java index e63fdc5e10..44fc49ba9b 100644 --- a/server/src/com/vaadin/ui/Slider.java +++ b/server/src/com/vaadin/ui/Slider.java @@ -16,6 +16,8 @@ package com.vaadin.ui; +import org.json.JSONException; + import com.vaadin.shared.ui.slider.SliderOrientation; import com.vaadin.shared.ui.slider.SliderServerRpc; import com.vaadin.shared.ui.slider.SliderState; @@ -32,6 +34,21 @@ public class Slider extends AbstractField<Double> { @Override public void valueChanged(double value) { + /* + * 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 #12133. + */ + try { + getUI().getConnectorTracker().getDiffState(Slider.this) + .put("value", value); + } catch (JSONException e) { + throw new RuntimeException(e); + } + try { setValue(value, true); } catch (final ValueOutOfBoundsException e) { |