Java Code Examples for com.google.gwt.event.dom.client.MouseMoveHandler

The following are top voted examples for showing how to use com.google.gwt.event.dom.client.MouseMoveHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: appformer   File: VerticalSplit.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 2
Project: appformer   File: HorizontalSplit.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 3
Project: appformer   File: BaseDOMElement.java   Source Code and License 6 votes vote down vote up
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());
}
 
Example 4
Project: appformer   File: GridLienzoScrollHandlerTest.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 5
Project: geomajas-project-client-gwt   File: CompositeGeometryIndexController.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 6
Project: geomajas-project-client-gwt2   File: CompositeGeometryIndexController.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 7
Project: vaadincanvas   File: CanvasConnector.java   Source Code and License 6 votes vote down vote up
@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);
				}
			}
		});
}
 
Example 8
Project: appformer   File: StencilPaletteBuilder.java   Source Code and License 5 votes vote down vote up
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());
}
 
Example 9
Project: platypus-js   File: EventsExecutor.java   Source Code and License 5 votes vote down vote up
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);
			}
		}
	}
}
 
Example 10
Project: qafe-platform   File: EventFactory.java   Source Code and License 5 votes vote down vote up
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);
		}
	};
}
 
Example 11
Project: QMAClone   File: PopupCanvas.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 12
Project: geomajas-project-client-gwt   File: CompositeGeometryIndexController.java   Source Code and License 5 votes vote down vote up
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);
		}
	}
}
 
Example 13
Project: geomajas-project-client-gwt2   File: CompositeGeometryIndexController.java   Source Code and License 5 votes vote down vote up
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);
		}
	}
}
 
Example 14
Project: wires   File: StencilPaletteBuilder.java   Source Code and License 5 votes vote down vote up
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() );
}
 
Example 15
Project: unitimes   File: P.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return addHandler(handler, MouseMoveEvent.getType());
}
 
Example 16
Project: appinventor-extensions   File: HandlerPanel.java   Source Code and License 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
  return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 17
Project: Wiab.pro   File: ImplPanel.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
  return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 18
Project: mgwt-traffic-flow   File: Canvas.java   Source Code and License 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return html.addMouseMoveHandler(handler);
}
 
Example 19
Project: r01fb   File: TreeView.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) {
	return this.addDomHandler(handler,
							  MouseMoveEvent.getType());
}
 
Example 20
Project: gerrit   File: DocWidget.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
  return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 21
Project: unitime   File: P.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return addHandler(handler, MouseMoveEvent.getType());
}
 
Example 22
Project: appformer   File: Canvas.java   Source Code and License 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
    return html.addMouseMoveHandler(handler);
}
 
Example 23
Project: appformer   File: GridLienzoScrollHandler.java   Source Code and License 4 votes vote down vote up
MouseMoveHandler enablePointerEvents() {
    return event -> gridLienzoScrollUI().enablePointerEvents(getDomElementContainer());
}
 
Example 24
Project: putnami-web-toolkit   File: AbstractInput.java   Source Code and License 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return this.addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 25
Project: putnami-web-toolkit   File: ListItem.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return this.addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 26
Project: putnami-web-toolkit   File: Anchor.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return this.addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 27
Project: gwtoauthlogindemo   File: ButtonCaption.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
{
    return addMouseMoveHandler(handler);
}
 
Example 28
Project: QMAClone   File: MouseEventsCanvas.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 29
Project: geomajas-project-client-gwt   File: CompositeGeometryIndexController.java   Source Code and License 4 votes vote down vote up
public void addMouseMoveHandler(MouseMoveHandler handler) {
	moveHandlers.add(handler);
}
 
Example 30
Project: geomajas-project-client-gwt   File: GraphicsWidget.java   Source Code and License 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return widget.addMouseMoveHandler(handler);
}
 
Example 31
Project: geomajas-project-client-gwt2   File: CompositeGeometryIndexController.java   Source Code and License 4 votes vote down vote up
public void addMouseMoveHandler(MouseMoveHandler handler) {
	moveHandlers.add(handler);
}
 
Example 32
Project: geomajas-project-client-gwt2   File: MapWidgetImpl.java   Source Code and License 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 33
Project: gwtbootstrap3   File: AbstractButton.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) {
    return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 34
Project: gwtbootstrap3   File: Label.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(final MouseMoveHandler handler) {
    return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 35
Project: swarm   File: BaseButton.java   Source Code and License 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
  return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example 36
Project: GwtGameUi   File: RenderEngine.java   Source Code and License 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
  return addDomHandler(handler, com.google.gwt.event.dom.client.MouseMoveEvent.getType());
}