Revision: 10477
Author:   jlaba...@google.com
Date:     Thu Jul 28 08:15:51 2011
Log: Reverting behavior in AbstractCellTable so it calls Column#onBrowserEvent() if the target Cell is in a Column. AbstractCellTable now supports any HasCell implementation, not just Columns, and a recent change modified the behavior to fire the event to the Cell directly, instead of going through Column#onBrowserEvent(). However, overriding onBrowserEvent() is common, and this behavior was a breaking change. The fix checks if the HasCell is a column and uses the legacy Column#onBrowserEvent() method.

Review at http://gwt-code-reviews.appspot.com/1500805

Review by: tlaub...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=10477

Modified:
 /trunk/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java

=======================================
--- /trunk/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java Thu Jul 28 04:03:54 2011 +++ /trunk/user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java Thu Jul 28 08:15:51 2011
@@ -2370,20 +2370,29 @@
       return;
     }

-    // Create a FieldUpdater.
-    final FieldUpdater<T, C> fieldUpdater = column.getFieldUpdater();
-    final int index = context.getIndex();
- ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : new ValueUpdater<C>() {
-      @Override
-      public void update(C value) {
-        fieldUpdater.update(index, rowValue, value);
-      }
-    };
-
-    // Fire the event to the cell.
     C cellValue = column.getValue(rowValue);
boolean cellWasEditing = cell.isEditing(context, parentElem, cellValue); - cell.onBrowserEvent(context, parentElem, column.getValue(rowValue), event, valueUpdater);
+    if (column instanceof Column) {
+      /*
+ * If the HasCell is a Column, let it handle the event itself. This is
+       * here for legacy support.
+       */
+      Column<T, C> col = (Column<T, C>) column;
+      col.onBrowserEvent(context, parentElem, rowValue, event);
+    } else {
+      // Create a FieldUpdater.
+      final FieldUpdater<T, C> fieldUpdater = column.getFieldUpdater();
+      final int index = context.getIndex();
+ ValueUpdater<C> valueUpdater = (fieldUpdater == null) ? null : new ValueUpdater<C>() {
+        @Override
+        public void update(C value) {
+          fieldUpdater.update(index, rowValue, value);
+        }
+      };
+
+      // Fire the event to the cell.
+ cell.onBrowserEvent(context, parentElem, column.getValue(rowValue), event, valueUpdater);
+    }

     // Reset focus if needed.
     cellIsEditing = cell.isEditing(context, parentElem, cellValue);

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to