Reviewers: tlaubach_google.com,

Description:
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.


Please review this at http://gwt-code-reviews.appspot.com/1500805/

Affected files:
  M user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java


Index: user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java
===================================================================
--- user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java (revision 10473) +++ user/src/com/google/gwt/user/cellview/client/AbstractCellTable.java (working copy)
@@ -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