Java 类com.google.gwt.event.dom.client.HasMouseUpHandlers 实例源码

项目:platypus-js    文件:EventsExecutor.java   
public void setMouseReleased(JavaScriptObject aValue) {
    if (mouseReleased != aValue) {
        if (mouseUpReg != null) {
            mouseUpReg.removeHandler();
            mouseUpReg = null;
        }
        mouseReleased = aValue;
        if (mouseReleased != null) {
            MouseUpHandler handler = new MouseUpHandler() {
                @Override
                public void onMouseUp(MouseUpEvent event) {
                    // if (mouseState == MOUSE.PRESSED)
                    // Event.releaseCapture(event.getRelativeElement());
                    if (mouseReleased != null) {
                        event.stopPropagation();
                        mouseState = MOUSE.NULL;
                        executeEvent(mouseReleased, EventsPublisher.publish(event));
                    }
                }
            };
            if (component instanceof Widget)
                mouseUpReg = ((Widget) component).addDomHandler(handler, MouseUpEvent.getType());
            else if (component instanceof HasMouseUpHandlers)
                mouseUpReg = ((HasMouseUpHandlers) component).addMouseUpHandler(handler);
        }
    }
}