* annoying). Doing it this way fixes it.
*/
hasHandlers_.addHandler(ClickEvent.getType(), clickHandler);
final HandlerRegistration mouseDown = addDomHandler(new MouseDownHandler()
{
public void onMouseDown(MouseDownEvent event)
{
event.preventDefault();
event.stopPropagation();
down_ = true;
}
}, MouseDownEvent.getType());
final HandlerRegistration mouseOut = addDomHandler(new MouseOutHandler()
{
public void onMouseOut(MouseOutEvent event)
{
event.preventDefault();
event.stopPropagation();
down_ = false;
}
}, MouseOutEvent.getType());
final HandlerRegistration mouseUp = addDomHandler(new MouseUpHandler()
{
public void onMouseUp(MouseUpEvent event)
{
event.preventDefault();
event.stopPropagation();
if (down_)
{
down_ = false;
NativeEvent clickEvent = Document.get().createClickEvent(
1,
event.getScreenX(),
event.getScreenY(),
event.getClientX(),
event.getClientY(),
event.getNativeEvent().getCtrlKey(),
event.getNativeEvent().getAltKey(),
event.getNativeEvent().getShiftKey(),
event.getNativeEvent().getMetaKey());
DomEvent.fireNativeEvent(clickEvent, hasHandlers_);
}
}
}, MouseUpEvent.getType());
return new HandlerRegistration()
{
public void removeHandler()
{
mouseDown.removeHandler();
mouseOut.removeHandler();
mouseUp.removeHandler();
}
};
}