*
* @param clickListener listener for click-events.
*/
public void setClickListener(final ClickListener clickListener) {
JSObject callbacks = JSObject.createJSObject();
if(clickListener != null) {
EventHandler clickHandler = new EventHandler() {
@Override
public void onHandle(EventObject eventObject) {
clickListener.onClick(new ClickEvent(eventObject));
}
};
callbacks.setProperty("rightclick", clickHandler.getJSObject());
callbacks.setProperty("click", clickHandler.getJSObject());
EventHandler doubleClickHandler = new EventHandler() {
@Override
public void onHandle(EventObject eventObject) {
clickListener.onDoubleClick(new ClickEvent(eventObject));
}
};
callbacks.setProperty("dblclick", doubleClickHandler.getJSObject());
}
getJSObject().setProperty("callbacks", callbacks);