]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #6237, setting datasource no more calls discard() method
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 5 Jan 2011 13:03:00 +0000 (13:03 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 5 Jan 2011 13:03:00 +0000 (13:03 +0000)
svn changeset:16807/svn branch:6.5

src/com/vaadin/ui/AbstractField.java

index d2824539fde7e26766afdd298c3dcafa3851f035..27682c764d3478395eedf9f5d724b13f935235d6 100644 (file)
@@ -533,8 +533,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
     /**
      * <p>
      * Sets the specified Property as the data source for the field. All
-     * uncommitted changes to the field are discarded and the value is refreshed
-     * from the new data source.
+     * uncommitted changes are replaced with a value from the new data source.
      * </p>
      * 
      * <p>
@@ -546,6 +545,15 @@ public abstract class AbstractField extends AbstractComponent implements Field,
      * the commit can be done normally.
      * </p>
      * 
+     * <p>
+     * Note: before 6.5 we actually called discard() method in the beginning of
+     * the method. This was removed to simplify implementation, avoid excess
+     * calls to backing property and to avoid odd value change events that were
+     * previously fired (developer expects 0-1 value change events if this
+     * method is called). Some complex field implementations might now need to
+     * override this method to do housekeeping similar to discard().
+     * </p>
+     * 
      * @param newDataSource
      *            the new data source Property.
      */
@@ -554,12 +562,6 @@ public abstract class AbstractField extends AbstractComponent implements Field,
         // Saves the old value
         final Object oldValue = value;
 
-        // Discards all changes to old datasource
-        try {
-            discard();
-        } catch (final Buffered.SourceException ignored) {
-        }
-
         // Stops listening the old data source changes
         if (dataSource != null
                 && Property.ValueChangeNotifier.class