diff options
-rw-r--r-- | server/src/com/vaadin/ui/AbstractField.java | 7 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java index 59e986cd23..9cf72a36b3 100644 --- a/server/src/com/vaadin/ui/AbstractField.java +++ b/server/src/com/vaadin/ui/AbstractField.java @@ -1344,8 +1344,11 @@ public abstract class AbstractField<T> extends AbstractComponent implements } private void localeMightHaveChanged() { - if (!equals(valueLocale, getLocale())) { - Object modelValue = convertToModel(getValue(), valueLocale); + if (!equals(valueLocale, getLocale()) && dataSource != null + && !isBuffered() && !isModified()) { + // When we have a data source and the internal value is directly + // read from that we want to update the value + Object modelValue = convertToModel(getInternalValue(), valueLocale); setValue(convertFromModel(modelValue)); } } diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java index 250fa3f771..467a76dfa6 100644 --- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java +++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java @@ -48,6 +48,7 @@ public class TestStreamVariableMapping extends TestCase { } public void testAddStreamVariable() { + owner.getUI().getConnectorTracker().registerConnector(owner); String targetUrl = cm.getStreamVariableTargetUrl(owner, variableName, streamVariable); assertTrue(targetUrl.startsWith("app://APP/UPLOAD/-1/" @@ -61,6 +62,7 @@ public class TestStreamVariableMapping extends TestCase { public void testRemoveVariable() { ConnectorTracker tracker = owner.getUI().getConnectorTracker(); + tracker.registerConnector(owner); cm.getStreamVariableTargetUrl(owner, variableName, streamVariable); assertNotNull(tracker.getStreamVariable(owner.getConnectorId(), variableName)); |