diff options
author | Artur Signell <artur@vaadin.com> | 2012-09-18 17:40:12 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-09-18 18:09:54 +0300 |
commit | 21bf33e29323d65b3e7c3b7ecdfba39db69d8e00 (patch) | |
tree | f0e28d6ae02603798fa8e1469cf6e8cc36187bec /server/src | |
parent | 3fa3f434f2627adee9ba5883a34c6c4bca4c9949 (diff) | |
download | vaadin-framework-21bf33e29323d65b3e7c3b7ecdfba39db69d8e00.tar.gz vaadin-framework-21bf33e29323d65b3e7c3b7ecdfba39db69d8e00.zip |
Ensure propertyDataSource can be set back to null (#9618)
Added additional tests for Label with a data source.
Note that the locale dependent tests still fail because of #8192
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/ui/Label.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index bdac278b1f..9434e92186 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -260,15 +260,20 @@ public class Label extends AbstractComponent implements Property<String>, ((Property.ValueChangeNotifier) dataSource).removeListener(this); } - if (!ConverterUtil.canConverterHandle(getConverter(), String.class, - newDataSource.getType())) { + if (newDataSource != null + && !ConverterUtil.canConverterHandle(getConverter(), + String.class, newDataSource.getType())) { // Try to find a converter Converter<String, ?> c = ConverterUtil.getConverter(String.class, newDataSource.getType(), getSession()); setConverter(c); } dataSource = newDataSource; - getState().text = getDataSourceValue(); + if (dataSource != null) { + // Update the value from the data source. If data source was set to + // null, retain the old value + getState().text = getDataSourceValue(); + } // Listens the new data source if possible if (dataSource != null |