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

项目:platypus-js    文件:EventsExecutor.java   
public void setMouseMoved(JavaScriptObject aValue) {
    if (mouseMoved != aValue) {
        if (mouseMoveReg != null) {
            mouseMoveReg.removeHandler();
            mouseMoveReg = null;
        }
        mouseMoved = aValue;
        if (mouseMoved != null) {
            MouseMoveHandler handler = new MouseMoveHandler() {
                @Override
                public void onMouseMove(MouseMoveEvent event) {
                    if (mouseMoved != null || mouseDragged != null) {
                        event.stopPropagation();
                        if (mouseState == MOUSE.NULL || mouseState == MOUSE.MOVED) {
                            mouseState = MOUSE.MOVED;
                            executeEvent(mouseMoved, EventsPublisher.publish(event));
                        } else if (mouseState == MOUSE.PRESSED || mouseState == MOUSE.DRAGGED) {
                            mouseState = MOUSE.DRAGGED;
                            executeEvent(mouseDragged, EventsPublisher.publish(event));
                        }
                    }
                }

            };
            if (component instanceof Widget) {
                mouseMoveReg = ((Widget) component).addDomHandler(handler, MouseMoveEvent.getType());
            } else if (component instanceof HasMouseMoveHandlers) {
                mouseMoveReg = ((HasMouseMoveHandlers) component).addMouseMoveHandler(handler);
            }
        }
    }
}
项目:obsolete-web-boards-gwt    文件:EditDisplay.java   
@Override
protected void initAreas(Board board) {
    SVGElement area = (SVGElement) svg.getElementById("area");
    NodeList<Element> nodeList = area.getElementsByTagName("path");
    for (int i = 0; i < nodeList.getLength(); ++i) {
        SVGElement item = (SVGElement) nodeList.getItem(i);
        OMElement node = OMElement.convert(item);
        ((HasMouseMoveHandlers) node).addMouseMoveHandler(this);
        ((HasMouseDownHandlers) node).addMouseDownHandler(this);
    }
}