Trying to extend a FlexTable to add OnMouseMove events.

Works fine except that I need to create getCellForEvent(MouseMoveEvent
e). Inside this method, I would need to create a HTMLTable.Cell. But
the constructor is protected!

(In general, I find the heavy usage of "final" and "private/protected"
in the GWT library to be quite a hassle.)

What is the best way to tackle this problem cleanly?

***

public class EventableFlexTable extends FlexTable {

  public HandlerRegistration addMouseMoveHandler(MouseMoveHandler
handler) {
    sinkEvents(Event.ONMOUSEMOVE);
    return addHandler(handler, MouseMoveEvent.getType());
  }

  public Cell getCellForEvent(MouseMoveEvent event) {
    Element td = getEventTargetCell(Event.as(event.getNativeEvent()));
    if (td == null) {
      return null;
    }

    Element tr = DOM.getParent(td);
    Element body = DOM.getParent(tr);
    int row = DOM.getChildIndex(body, tr);
    int column = DOM.getChildIndex(tr, td);

    return new Cell(row, column);    // *** doesn't compile ****
  }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to