This code is from my class that extends Grid:
public GridMouseHandler gridMouseHandler = new GridMouseHandler(this);
Later on in the workings of one of the functions I add my mouse
handlers. For grids or flex tables they must currently be implemented
as dom handlers:
addDomHandler(gridMouseHandler,
MouseDownEvent.getType());
addDomHandler(gridMouseHandler, MouseUpEvent.getType());
addDomHandler(gridMouseHandler, MouseMoveEvent.getType());
My function that finds which cell the mouse event happened on:
public int[] getCellForEvent(MouseEvent<?> event) {
final Element td =
getEventTargetCell(Event.as(event.getNativeEvent()));
if (td == null) {
return null;
}
final Element tr = DOM.getParent(td);
final Element table = DOM.getParent(tr);
int returnEventPosition[] = new int[2];
returnEventPosition[rowPos] = DOM.getChildIndex(table, tr);
returnEventPosition[colPos] = DOM.getChildIndex(tr, td);
eventPosition[rowPos] = returnEventPosition[rowPos];
eventPosition[colPos] = returnEventPosition[colPos];
return returnEventPosition;
}
My GridMouseHandler class is just: public class GridMouseHandler
implements MouseDownHandler, MouseUpHandler, MouseMoveHandler { and
then implements the required methods such as onMouseUp, or
onMouseMove, and when the mouse moves you can have them call a
specific function. One of the functions you will want to call is your
own function for finding which cell the event happened on, and then
acting accordingly.
Using this same method you can do similar things for any of the mouse
handlers with Grid.
On Aug 18, 3:42 am, Aditya <[email protected]> wrote:
> Hi,
>
> I m trying to create a flextable which can handle mouseOver and
> mouseOut events..
>
> I want to change the style of row which receives mouseOver and adds
> style accordingly.
>
> same for mouseOut..
>
> Is anyone has implemented it...?
>
> Thank you.
>
> Regards,
>
> Aditya
--
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.