From 21bf33e29323d65b3e7c3b7ecdfba39db69d8e00 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 18 Sep 2012 17:40:12 +0300 Subject: 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 --- server/src/com/vaadin/ui/Label.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'server/src/com/vaadin/ui') 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, ((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 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 -- cgit v1.2.3