I have a Cell that handles both “click” and “dblclick”.
One behaviour for click, different behaviour for dblclick.
When double click on the cell it fires 3 events.
click, click, and dblclick.
Is there a way to filter the “click” events?
As an example:
...
public TestCell(EventBus eventBus){
super("click","keydown", "dblclick");
}
...
public onBrowserEvent( ... ){
String eventType = event.getType();
if("click".equals(eventType)){
//do smthg.
}
if("dblclick".equals(eventType)){
//do smthg different.
}
}
Thankyou.
…and if you didn’t want to handle
dblclick, you wouldn’t understand why GWT/the browser gives you only only one click out of 2…As @adel-boutros said, this is just how it’s supposed to work, and you have to live with it.
Check the
event.detailfor the number of clicks. Unfortunately, you’ll have to use JSNI, as GWT doesn’t seem to expose the field in Java.