]> source.dussan.org Git - vaadin-framework.git/commitdiff
#8102 Changing data source type from Double -> Number can keep the
authorArtur Signell <artur@vaadin.com>
Thu, 22 Dec 2011 12:14:04 +0000 (14:14 +0200)
committerArtur Signell <artur@vaadin.com>
Thu, 22 Dec 2011 12:14:04 +0000 (14:14 +0200)
converter
while changing from Number -> Double cannot. Fixed reversed logic.

src/com/vaadin/ui/AbstractField.java

index 4f944ce17bebc1463da9b0befa0f2cc645d88444..4217f5f6fe0637d07e9c97b89882375d89f5baf5 100644 (file)
@@ -730,9 +730,13 @@ public abstract class AbstractField<T> extends AbstractComponent implements
 
         // Check if the current converter is compatible.
         if (newDataSource != null
-                && (getConverter() == null || !getConverter().getModelType()
-                        .isAssignableFrom(newDataSource.getType()))) {
-            // Set a new converter if there is a new data source and the
+                && (getConverter() == null || !newDataSource.getType()
+                        .isAssignableFrom(getConverter().getModelType()))) {
+            // Changing from e.g. Number -> Double should set a new converter,
+            // changing from Double -> Number can keep the old one (Property
+            // accepts Number)
+
+            // Set a new converter if there is a new data source and
             // there is no old converter or the old is incompatible.
             setConverter(newDataSource.getType());
         }