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

项目:platypus-js    文件:EventsExecutor.java   
public void setMousePressed(JavaScriptObject aValue) {
    if (mousePressed != aValue) {
        if (mouseDownReg != null) {
            mouseDownReg.removeHandler();
            mouseDownReg = null;
        }
        mousePressed = aValue;
        if (mousePressed != null) {
            MouseDownHandler handler = new MouseDownHandler() {
                @Override
                public void onMouseDown(MouseDownEvent event) {
                    if (mousePressed != null) {
                        event.stopPropagation();
                        // Event.setCapture(event.getRelativeElement());
                        mouseState = MOUSE.PRESSED;
                        executeEvent(mousePressed, EventsPublisher.publish(event));
                    }
                }
            };
            if (component instanceof Widget) {
                mouseDownReg = ((Widget) component).addDomHandler(handler, MouseDownEvent.getType());
            } else if (component instanceof HasMouseDownHandlers) {
                mouseDownReg = ((HasMouseDownHandlers) component).addMouseDownHandler(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);
    }
}