Author: [email protected]
Date: Mon Jun 15 08:53:50 2009
New Revision: 5558

Modified:
     
changes/jlabanca/scrolltable/user/src/com/google/gwt/user/client/ui/HTMLTable.java

Log:
Fixed an HTMLTable bug where getCellElement would add the row offset  
instead of subtracting it.

Patch by: jlabanca



Modified:  
changes/jlabanca/scrolltable/user/src/com/google/gwt/user/client/ui/HTMLTable.java
==============================================================================
---  
changes/jlabanca/scrolltable/user/src/com/google/gwt/user/client/ui/HTMLTable.java
       
(original)
+++  
changes/jlabanca/scrolltable/user/src/com/google/gwt/user/client/ui/HTMLTable.java
       
Mon Jun 15 08:53:50 2009
@@ -19,6 +19,7 @@
  import com.google.gwt.dom.client.TableRowElement;
  import com.google.gwt.event.dom.client.ClickEvent;
  import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DomEvent;
  import com.google.gwt.event.dom.client.HasClickHandlers;
  import com.google.gwt.event.shared.HandlerRegistration;
  import com.google.gwt.user.client.DOM;
@@ -438,8 +439,8 @@
       * @return the element
       */
      private native Element getCellElement(Element table, int row, int col)  
/*-{
-         return table.rows[row].cells[col];
-       }-*/;
+      return table.rows[row].cells[col];
+    }-*/;
    }

    /**
@@ -814,7 +815,7 @@
     *
     * @param listener listener to add
     * @deprecated add a click handler instead and use
-   *             {...@link HTMLTable#getCellForEvent(ClickEvent)} to get the  
cell
+   *             {...@link HTMLTable#getCellForEvent(DomEvent)} to get the  
cell
     *             information (remember to check for a null return value)
     */
    @Deprecated
@@ -876,13 +877,13 @@
     * @param event A click event of indeterminate origin
     * @return The appropriate cell, or null
     */
-  public Cell getCellForEvent(ClickEvent event) {
+  public Cell getCellForEvent(DomEvent<?> event) {
      TableCellElement td =  
getEventTargetCell(Event.as(event.getNativeEvent())).cast();
      if (td == null) {
        return null;
      }
      TableRowElement tr = td.getParentElement().cast();
-    return new Cell(tr.getRowIndex() + rowOffset, td.getCellIndex());
+    return new Cell(tr.getRowIndex() - rowOffset, td.getCellIndex());
    }

    /**

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

Reply via email to