aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java35
2 files changed, 36 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index 4b1476db32..59f11c5d5c 100644
--- a/server/src/com/vaadin/ui/AbstractField.java
+++ b/server/src/com/vaadin/ui/AbstractField.java
@@ -1345,7 +1345,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
private void localeMightHaveChanged() {
if (!equals(valueLocale, getLocale()) && dataSource != null
- && !isBuffered() && !isModified()) {
+ && !isModified()) {
// When we have a data source and the internal value is directly
// read from that we want to update the value
T newInternalValue = convertFromModel(getPropertyDataSource()
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
index 2f1b1f9dbc..cd77101ac3 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
@@ -44,6 +44,41 @@ public class AbstractFieldValueConversions extends TestCase {
assertEquals("abc", paulaBean.getFirstName());
}
+ public void testNonmodifiedBufferedFieldConversion() {
+ VaadinSession.setCurrent(new VaadinSession(null));
+ TextField tf = new TextField("salary");
+ tf.setBuffered(true);
+ tf.setLocale(new Locale("en", "US"));
+ ObjectProperty<Integer> ds = new ObjectProperty<Integer>(123456789);
+ tf.setPropertyDataSource(ds);
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123,456,789", tf.getValue());
+ tf.setLocale(new Locale("fi", "FI"));
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123" + FORMATTED_SPACE + "456" + FORMATTED_SPACE + "789",
+ tf.getValue());
+
+ }
+
+ public void testModifiedBufferedFieldConversion() {
+ VaadinSession.setCurrent(new VaadinSession(null));
+ TextField tf = new TextField("salary");
+ tf.setBuffered(true);
+ tf.setLocale(new Locale("en", "US"));
+ ObjectProperty<Integer> ds = new ObjectProperty<Integer>(123456789);
+ tf.setPropertyDataSource(ds);
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123,456,789", tf.getValue());
+ tf.setValue("123,123");
+ assertEquals((Integer) 123456789, ds.getValue());
+ assertEquals("123,123", tf.getValue());
+
+ tf.setLocale(new Locale("fi", "FI"));
+ assertEquals((Integer) 123456789, ds.getValue());
+ // Value should not be updated when field is buffered
+ assertEquals("123,123", tf.getValue());
+ }
+
public void testStringIdentityConversion() {
TextField tf = new TextField();
tf.setConverter(new Converter<String, String>() {