Is there a way in GWT to stop event propagation? In Firefox there's a
javascript stopPropagation() function, is there an analogue to that in
the GWT world?
Our problem: we've got a CheckBox within a FocusPanel, both of which
source click events. When somebody clicks on the checkbox, our listener
receives two onClick calls - one for the checkbox and one for the
FocusPanel. But we only want to trap the event from the CheckBox in
this situation; we only want to get the FocusPanel click event when the
user clicks outside of the checkbox.
Since the CheckBox event always arrives first (at least in our limited
testing), it would be nice to catch that event and somehow prevent
further processing. Is there a way to do that in GWT? Any tips, ideas
or other info would be much appreciated..
Cheers,
Ossie
NoMouseEventPropCheckBox extends CheckBox {
public void onBrowserEvent(Event event) {
// Cancel bubbling for all mouse events. This will hide them from all
// widgets above this one in the containment hierarchy.
if ((DOM.eventGetType(event) & Event.MOUSEEVENTS) != 0)
DOM.eventCancelBubble(event, true);
// Don't forget to allow the normal event handling to occur.
super.onBrowserEvent(event);
}
}
Thanks,
Henry