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

项目:platypus-js    文件:EventsExecutor.java   
public void setMouseWheelMoved(JavaScriptObject aValue) {
    if (mouseWheelMoved != aValue) {
        if (mouseWheelReg != null) {
            mouseWheelReg.removeHandler();
            mouseWheelReg = null;
        }
        mouseWheelMoved = aValue;
        if (mouseWheelMoved != null) {
            MouseWheelHandler handler = new MouseWheelHandler() {
                @Override
                public void onMouseWheel(MouseWheelEvent event) {
                    if (mouseWheelMoved != null) {
                        event.stopPropagation();
                        executeEvent(mouseWheelMoved, EventsPublisher.publish(event));
                    }
                }
            };
            if (component instanceof Widget) {
                mouseWheelReg = ((Widget) component).addDomHandler(handler, MouseWheelEvent.getType());
            } else if (component instanceof HasMouseWheelHandlers) {
                mouseWheelReg = ((HasMouseWheelHandlers) component).addMouseWheelHandler(handler);
            }
        }
    }
}