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

项目:circuitjs1    文件:CirSim.java   
public void onMouseWheel(MouseWheelEvent e) {
    e.preventDefault();

    // once we start zooming, don't allow other uses of mouse wheel for a while
    // so we don't accidentally edit a resistor value while zooming
    boolean zoomOnly = System.currentTimeMillis() < zoomTime+1000;

    if (!zoomOnly)
        scrollValues(e.getNativeEvent().getClientX(), e.getNativeEvent().getClientY(), e.getDeltaY());

    if (mouseElm instanceof MouseWheelHandler && !zoomOnly)
        ((MouseWheelHandler) mouseElm).onMouseWheel(e);
    else if (scopeSelected != -1)
        scopes[scopeSelected].onMouseWheel(e);
    else if (!dialogIsShowing()) {
        zoomCircuit(e.getDeltaY());
        zoomTime = System.currentTimeMillis();
}
}
项目:ImageViewer    文件:VImageViewer.java   
public VImageViewer() {
    /* Create widget's root panel */
    panelRoot = new FlowPanel();
    Style style = panelRoot.getElement().getStyle();
    style.setPosition(Position.RELATIVE);
    setStyleName(CLASSNAME);
    panelRoot.setStyleName(CLASSNAME + "-flow");
    style.setWidth(100, Unit.PCT);
    style.setHeight(100, Unit.PCT);

    /* Create image container */
    imageContainer = new FlowPanel();
    style = imageContainer.getElement().getStyle();
    style.setPosition(Position.ABSOLUTE);
    style.setOverflow(Overflow.HIDDEN);

    /* Add widgets */
    setWidget(panelRoot);
    panelRoot.add(imageContainer);

    /* Register handlers */
    addDomHandler(this, KeyDownEvent.getType());
    addDomHandler(this, ClickEvent.getType());
    addMouseWheelHandler(new MouseWheelHandler() {
        public void onMouseWheel(MouseWheelEvent event) {
            event.preventDefault();
            if (event.isNorth()) {
                moveImages(true);
            } else {
                moveImages(false);
            }
        }
    });
}
项目:appformer    文件:GridLienzoScrollHandlerTest.java   
@Test
public void testSetupContextSwitcher() {

    final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
    final LienzoPanel lienzoPanel = mock(LienzoPanel.class);
    final MouseWheelHandler wheelHandler = mock(MouseWheelHandler.class);
    final MouseMoveHandler moveHandler = mock(MouseMoveHandler.class);

    doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();
    doReturn(wheelHandler).when(gridLienzoScrollHandler).disablePointerEvents();
    doReturn(moveHandler).when(gridLienzoScrollHandler).enablePointerEvents();

    gridLienzoScrollHandler.setupContextSwitcher();

    verify(domElementContainer).addDomHandler(wheelHandler, MouseWheelEvent.getType());
    verify(gridLienzoPanel).addMouseMoveHandler(moveHandler);
}
项目: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);
            }
        }
    }
}
项目:putnami-web-toolkit    文件:ListItem.java   
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return this.addDomHandler(handler, MouseWheelEvent.getType());
}
项目:ineform    文件:GreenScrollPanel.java   
public GreenScrollPanel(boolean withHorizontalScroll) {
    mainPanel = new ResizeLayoutPanel() {
        @Override
        protected void onAttach() {
            super.onAttach();
            // hack to hide scrollbar in chrome when leaflet map is also
            // displayed (check GreenScrollImpl.onAttach too)
            if (isChrome()) {
                try {
                    ((Element) (getElement().getChild(1))).getStyle().setZIndex(-1000);
                    ((Element) (getElement().getChild(2))).getStyle().setZIndex(-1000);
                } catch (Exception e) {
                    GWT.log("", e);
                }
            }

        }
    };

    if (hasMacNanoScrollBar()) {
        this.impl = new ScrollPanel();
    } else {
        this.impl = new GreenScrollImpl(withHorizontalScroll);
    }

    mainPanel.setWidget(impl);

    impl.addDomHandler(new MouseWheelHandler() {

        @Override
        public void onMouseWheel(MouseWheelEvent event) {
            event.stopPropagation();
        }
    }, MouseWheelEvent.getType());

}
项目:QMAClone    文件:PopupCanvas.java   
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    eventHandlers.put(handler, (DomEvent.Type) MouseWheelEvent.getType());
    if (canvas != null) {
        canvas.addDomHandler(handler, MouseWheelEvent.getType());
    }
    return null;
}
项目:QMAClone    文件:MouseEventsCanvas.java   
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return addDomHandler(handler, MouseWheelEvent.getType());
}
项目:geomajas-project-client-gwt    文件:GraphicsWidget.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return widget.addMouseWheelHandler(handler);
}
项目:kie-wb-common    文件:DMNGridPanel.java   
private MouseWheelHandler destroyDOMElements() {
    return (event) -> gridLayer
            .getGridWidgets()
            .forEach(gridWidget -> gridWidget
                    .getModel()
                    .getColumns()
                    .stream()
                    .filter(gridColumn -> gridColumn instanceof HasDOMElementResources)
                    .map(gridColumn -> ((HasDOMElementResources) gridColumn))
                    .forEach(HasDOMElementResources::destroyResources));
}
项目:unitimes    文件:P.java   
@Override
public HandlerRegistration addMouseWheelHandler( MouseWheelHandler handler) {
    return addHandler(handler, MouseWheelEvent.getType());
}
项目:appinventor-extensions    文件:HandlerPanel.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
  return addDomHandler(handler, MouseWheelEvent.getType());
}
项目:mgwt-traffic-flow    文件:Canvas.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return html.addMouseWheelHandler(handler);
}
项目:r01fb    文件:TreeView.java   
@Override
public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
    return this.addDomHandler(handler,
                              MouseWheelEvent.getType());
}
项目:unitime    文件:P.java   
@Override
public HandlerRegistration addMouseWheelHandler( MouseWheelHandler handler) {
    return addHandler(handler, MouseWheelEvent.getType());
}
项目:fullmetalgalaxy    文件:WgtIntBox.java   
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler p_handler)
{
  return m_intBox.addMouseWheelHandler( p_handler );
}
项目:appformer    文件:Canvas.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return html.addMouseWheelHandler(handler);
}
项目:appformer    文件:GridLienzoScrollHandler.java   
MouseWheelHandler disablePointerEvents() {
    return event -> gridLienzoScrollUI().disablePointerEvents(getDomElementContainer());
}
项目:gwthtml5apps    文件:DropDockRootPanel.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
  return addDomHandler(handler, MouseWheelEvent.getType());
}
项目:putnami-web-toolkit    文件:AbstractInput.java   
@Override
public com.google.gwt.event.shared.HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return this.addDomHandler(handler, MouseWheelEvent.getType());
}
项目:putnami-web-toolkit    文件:Anchor.java   
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return this.addDomHandler(handler, MouseWheelEvent.getType());
}
项目:gwtoauthlogindemo    文件:ButtonCaption.java   
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
{
    return addMouseWheelHandler(handler);
}
项目:geomajas-project-client-gwt    文件:GraphicsWidget.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return eventWidget.addMouseWheelHandler(handler);
}
项目:geomajas-project-client-gwt2    文件:MapWidgetImpl.java   
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
    return addDomHandler(handler, MouseWheelEvent.getType());
}
项目:gwtbootstrap3    文件:AbstractButton.java   
@Override
public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
    return addDomHandler(handler, MouseWheelEvent.getType());
}
项目:gwtbootstrap3    文件:Label.java   
@Override
public HandlerRegistration addMouseWheelHandler(final MouseWheelHandler handler) {
    return addDomHandler(handler, MouseWheelEvent.getType());
}
项目:GwtGameUi    文件:RenderEngine.java   
@Override
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
  return addDomHandler(handler, com.google.gwt.event.dom.client.MouseWheelEvent.getType());
}
项目:geomajas-project-client-gwt    文件:MapWidget.java   
/**
 * Set a new mouse wheel controller on the map. If the zoom on scroll is currently enabled, it will be disabled
 * first.
 * 
 * @param controller
 *            The new mouse wheel controller to be applied on the map.
 * @since 1.6.0
 */
@Api
public void setMouseWheelController(MouseWheelHandler controller) {
    setZoomOnScrollEnabled(false);
    mouseWheelRegistration = graphics.addMouseWheelHandler(controller);
}