public VerticalSplit() { super(); addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (mouseDown) { double leftWidthPct = ((event.getClientX() - getContentAbsoluteLeft() - offset) / getContentWidth()) * 100; double rightWidthPct = 100 - leftWidthPct; setLeftAreaWidth(leftWidthPct); setRightAreaWidth(rightWidthPct); getElement().getStyle().setLeft(leftArea.getOffsetWidth() - 3, Style.Unit.PX); onResize.execute(); event.preventDefault(); } } }, MouseMoveEvent.getType()); }
public HorizontalSplit() { super(); addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (mouseDown) { double topHeightPct = ((event.getClientY() - getContentAbsoluteTop() - offset) / getContentHeight()) * 100; double bottomHeightPct = 100 - topHeightPct; setTopAreaHeight(topHeightPct); setBottomHeight(bottomHeightPct); getElement().getStyle().setTop(topArea.getOffsetHeight() - 6, Style.Unit.PX); onResize.execute(); event.preventDefault(); } } }, MouseMoveEvent.getType()); }
protected void setupDelegatingMouseMoveHandler() { final Style style = widgetContainer.getElement().getStyle(); widgetContainer.addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(final MouseMoveEvent event) { //The DOM Element changes the Cursor, so set to the state determined by the MouseEvent Handlers on GridLayer style.setCursor(gridLayer.getGridWidgetHandlersState().getCursor()); gridLayer.onNodeMouseMove(new NodeMouseMoveEvent(event) { @Override public int getX() { //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas. return super.getX() + widgetContainer.getElement().getOffsetLeft(); } @Override public int getY() { //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas. return super.getY() + widgetContainer.getElement().getOffsetTop(); } }); } }, MouseMoveEvent.getType()); }
@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); }
public void addMapHandler(AbstractGeometryIndexMapHandler handler) { handler.setIndex(index); handler.setService(service); handler.setEventParser(this); if (handler instanceof MapDownHandler) { downHandlers.add((MapDownHandler) handler); } if (handler instanceof MapUpHandler) { upHandlers.add((MapUpHandler) handler); } if (handler instanceof MapDragHandler) { dragHandlers.add((MapDragHandler) handler); } if (handler instanceof MouseOverHandler) { overHandlers.add((MouseOverHandler) handler); } if (handler instanceof MouseOutHandler) { outHandlers.add((MouseOutHandler) handler); } if (handler instanceof MouseMoveHandler) { moveHandlers.add((MouseMoveHandler) handler); } if (handler instanceof DoubleClickHandler) { doubleClickHandlers.add((DoubleClickHandler) handler); } }
@Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); // Only add a mouse move handler if someone is interested in, as // otherwise // they would generate a large amount of server side traffic. if (stateChangeEvent.hasPropertyChanged("listenMouseMove") && getState().listenMouseMove) getWidget().addMouseMoveHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (getState().listenMouseMove) { MouseEventDetails med = MouseEventDetailsBuilder .buildMouseEventDetails(event.getNativeEvent(), getWidget().getElement()); rpc.mouseMoved(med); } } }); }
private void attachDragProxyHandlers(final LienzoPanel floatingPanel, final ShapeDragProxy proxy) { final Style style = floatingPanel.getElement().getStyle(); final HandlerRegistration[] handlerRegs = new HandlerRegistration[2]; //MouseMoveEvents handlerRegs[0] = RootPanel.get().addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(final MouseMoveEvent mouseMoveEvent) { style.setLeft(mouseMoveEvent.getX() - (floatingPanel.getWidth() / 2), Style.Unit.PX); style.setTop(mouseMoveEvent.getY() - (floatingPanel.getHeight() / 2), Style.Unit.PX); proxy.onDragPreview(mouseMoveEvent.getX(), mouseMoveEvent.getY()); } }, MouseMoveEvent.getType()); //MouseUpEvent handlerRegs[1] = RootPanel.get().addDomHandler(new MouseUpHandler() { @Override public void onMouseUp(final MouseUpEvent mouseUpEvent) { handlerRegs[0].removeHandler(); handlerRegs[1].removeHandler(); RootPanel.get().remove(floatingPanel); proxy.onDragComplete(mouseUpEvent.getX(), mouseUpEvent.getY()); } }, MouseUpEvent.getType()); }
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); } } } }
public static MouseMoveHandler createOnMouseMoveListener(final EventListenerGVO ev, final List<InputVariableGVO> input) { return new MouseMoveHandler() { public void onMouseMove(MouseMoveEvent event) { Map<String,String> mouseInfo = getMouseInfo(event); CallbackHandler.createCallBack(event.getSource(), QAMLConstants.EVENT_ONMOUSE_MOVE, ev, input, mouseInfo); } }; }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { eventHandlers.put(handler, (DomEvent.Type) MouseMoveEvent.getType()); if (canvas != null) { canvas.addDomHandler(handler, MouseMoveEvent.getType()); } return null; }
public void onMouseMove(MouseMoveEvent event) { if (service.getIndexStateService().isEnabled(index)) { super.onMouseMove(event); // Make sure we don't forget dragging. for (MouseMoveHandler handler : moveHandlers) { handler.onMouseMove(event); } } }
private void attachDragProxyHandlers( final LienzoPanel floatingPanel, final ShapeDragProxy proxy ) { final Style style = floatingPanel.getElement().getStyle(); final HandlerRegistration[] handlerRegs = new HandlerRegistration[ 2 ]; //MouseMoveEvents handlerRegs[ 0 ] = RootPanel.get().addDomHandler( new MouseMoveHandler() { @Override public void onMouseMove( final MouseMoveEvent mouseMoveEvent ) { style.setLeft( mouseMoveEvent.getX() - ( floatingPanel.getWidth() / 2 ), Style.Unit.PX ); style.setTop( mouseMoveEvent.getY() - ( floatingPanel.getHeight() / 2 ), Style.Unit.PX ); proxy.onDragPreview( mouseMoveEvent.getX(), mouseMoveEvent.getY() ); } }, MouseMoveEvent.getType() ); //MouseUpEvent handlerRegs[ 1 ] = RootPanel.get().addDomHandler( new MouseUpHandler() { @Override public void onMouseUp( final MouseUpEvent mouseUpEvent ) { handlerRegs[ 0 ].removeHandler(); handlerRegs[ 1 ].removeHandler(); RootPanel.get().remove( floatingPanel ); proxy.onDragComplete( mouseUpEvent.getX(), mouseUpEvent.getY() ); } }, MouseUpEvent.getType() ); }
@Override public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return addHandler(handler, MouseMoveEvent.getType()); }
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return addDomHandler(handler, MouseMoveEvent.getType()); }
@Override public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return addDomHandler(handler, MouseMoveEvent.getType()); }
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return html.addMouseMoveHandler(handler); }
@Override public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) { return this.addDomHandler(handler, MouseMoveEvent.getType()); }
MouseMoveHandler enablePointerEvents() { return event -> gridLienzoScrollUI().enablePointerEvents(getDomElementContainer()); }
@Override public com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return this.addDomHandler(handler, MouseMoveEvent.getType()); }
@Override public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return this.addDomHandler(handler, MouseMoveEvent.getType()); }
@Override public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return addMouseMoveHandler(handler); }
public void addMouseMoveHandler(MouseMoveHandler handler) { moveHandlers.add(handler); }
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return widget.addMouseMoveHandler(handler); }
@Override public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) { return addDomHandler(handler, MouseMoveEvent.getType()); }
@Override public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { return addDomHandler(handler, com.google.gwt.event.dom.client.MouseMoveEvent.getType()); }