Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve the "real" target element of an event in GWT

Tags:

gwt

quick question on GWT from a newbie. Considering the following code:

FlowPanel block = buildMyBlock(); // buildMyBlock builds a FlowPanel with different widgets in it
block.addDomHandler(
    new ClickHandler()
    {
        @Override
        public void onClick(ClickEvent event)
        {
            // do some stuff
        }
    },
    ClickEvent.getType());

in the onClick() method, I'd like to be able to make different treatments depending on the internal elements that have been clicked inside block Is it possible? And how ?

like image 709
pierroz Avatar asked Jun 29 '12 14:06

pierroz


1 Answers

You can use Element.as(event.getNativeEvent().getEventTarget()) to retrieve the actual target of the event.

like image 63
Thomas Broyer Avatar answered Nov 13 '22 06:11

Thomas Broyer