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

The following are top voted examples for showing how to use com.google.gwt.event.dom.client.MouseMoveEvent. 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: LAS   File: WindowBox.java   Source Code and License 7 votes vote down vote up
@Override
protected void continueDragging(MouseMoveEvent event) {
	if (this.dragMode >= 0 && this.resizable) {
		this.updateCursor(this.dragMode);
		
           int dx = event.getClientX() - this.dragX;
           int dy = event.getClientY() - this.dragY;
           
           this.dragX = event.getClientX();
           this.dragY = event.getClientY();
           
           dragResizeWidget(this, dx, dy);
	} else {
	    // this updates the cursor when dragging is NOT activated
	    if (!this.minimized) {
	        int dm = calcDragMode(event.getClientX(),event.getClientY());
		    this.updateCursor(dm);
	    }
		super.continueDragging(event);
	}
}
 
Example 2
Project: WebConsole   File: ConsoleDisplay.java   Source Code and License 6 votes vote down vote up
public ConsoleDisplay() {
	super(new AbsolutePanel(), CLASS_NAME);
	getElement().setId("consoleDisplayWrapper");
	
	// Create display panel where screen is actually loaded
	display = new AbsolutePanel();
	display.addStyleName("portrait");
	display.getElement().setId("consoleDisplay");
	
	// Add display to the wrapper
	((AbsolutePanel)getWidget()).add(display, 0, 0);
			
	// Add move handlers which are only used on this display component
	if(BrowserUtils.isMobile) {
		this.addDomHandler(this, TouchMoveEvent.getType());
	} else {
		this.addDomHandler(this, MouseMoveEvent.getType());
		this.addDomHandler(this, MouseOutEvent.getType());
	}
}
 
Example 3
Project: WebConsole   File: ConsoleDisplay.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	event.preventDefault();
	event.stopPropagation();
	lastMoveEvent = new PressMoveEvent(event);
	ConsoleUnitEventManager.getInstance().getEventBus().fireEvent(lastMoveEvent);
}
 
Example 4
Project: WebConsole   File: ListItem.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
       // There's a weird bug in Chrome on Windows 10 64bit that causes a mouse move event to fire on mouse down so this tries to workaround it
       // https://bugs.chromium.org/p/chromium/issues/detail?id=721341
	if (startEvent != null && (startEvent.getClientX() != event.getClientX() || startEvent.getClientY() != event.getClientY())) {
		event.preventDefault();
		event.stopPropagation();
		propagateEvent(new PressMoveEvent(event));
	}
}
 
Example 5
Project: Wiab.pro   File: SearchPanelWidget.java   Source Code and License 6 votes vote down vote up
@UiHandler("self")
void handleMouseMove(MouseMoveEvent e) {
  Element top = self.getElement();    
  Element target;
  target = e.getNativeEvent().getEventTarget().cast();
  while (!top.equals(target)) {
    if (DigestDomImpl.KIND_DIGEST.equals(target.getAttribute(BuilderHelper.KIND_ATTRIBUTE)) ) {
      handleTouch(byId.get(target.getAttribute(DigestDomImpl.DIGEST_ID_ATTRIBUTE)) );
      return;
    }
    target = target.getParentElement();
    if (target == null) {
      break;
    }
  }    
  handleTouch(null);    
}
 
Example 6
Project: Wiab.pro   File: EventDispatcherPanel.java   Source Code and License 6 votes vote down vote up
@Override
boolean dispatch(MouseMoveEvent event, Element target) {
  //firing MouseCome and MouseLeave events basing on MouseMove
  if (target != prevTarget) {
    if (prevTarget != null) {
      //create and dispatch new MouseLeaveEvent for previous context
      mouseComeLeaveHandlers.dispatch(
          new MouseLeaveEvent(prevEvent, prevTarget, target), prevTarget);
    }
    if (target != null) {
      //create and dispatch new MouseComeLeaveEvent for current context
      mouseComeLeaveHandlers.dispatch(new MouseComeEvent(event, target, prevTarget), target);
    }
    prevTarget = target;
  }
  prevEvent = event;

  super.dispatch(event, target);

  return true;
}
 
Example 7
Project: x-cure-chat   File: UserStatusManager.java   Source Code and License 6 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
	//Store the last time the mouse was moved
	lastUserActivityMillisec = System.currentTimeMillis();
	//If the user is in the forced away mode then we make him go back to the old mode
	if( isInForcedAway ) {
		isInForcedAway = false;
		userStatusQueue.setCurrentUserStatus( userStatusQueue.getPreviousUserStatus() );
	} else {
		//In case we can do automatic status enforcement
		if( userStatusQueue.canDoUserStatusInforcement() ) {
			//The actual user status that comes from the server with the room updates is know
			if( actualChatUserStatus != null ) {
				//The actual visible user status is not the same as set in the local user interface
				if( actualChatUserStatus != userStatusQueue.getCurrentUserStatus() ) {
					//Force the server status update, forcing the update in any case
					userStatusQueue.forceUserStatusToTheServer( userStatusQueue.getCurrentUserStatus() );
				}
			}
		}
	}
}
 
Example 8
Project: circuitjs1   File: CirSim.java   Source Code and License 6 votes vote down vote up
public void onMouseMove(MouseMoveEvent e) {
	e.preventDefault();
	mouseCursorX=e.getX();
	mouseCursorY=e.getY();
	if (mouseDragging) {
		mouseDragged(e);
		return;
	}
	mouseSelect(e);
}
 
Example 9
Project: firefly   File: PlotMover.java   Source Code and License 6 votes vote down vote up
@Override
        public void onMouseMove(WebPlotView pv, ScreenPt spt, MouseMoveEvent ev) {
            if (_mouseDown) {
                dragTimer.cancel();
                dragTimer.setupCall(spt,ev.getScreenX(), ev.getScreenY());
                _lastX= ev.getScreenX();
                _lastY= ev.getScreenY();
                dragTimer.schedule(10);
//                drag(spt,false);
//                _mouseInfo.setEnableAllPersistent(true);
            }
        }
 
Example 10
Project: djvu-html5   File: UIHider.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	if (previousX == event.getX() && previousY == event.getY())
		return;
	previousX = event.getX();
	previousY = event.getY();
	showUI();
}
 
Example 11
Project: appformer   File: DockResizeBar.java   Source Code and License 6 votes vote down vote up
private double calculateDockSize(MouseMoveEvent event,
                                 DocksBar docksBar) {
    UberfireDockPosition position = docksBar.getPosition();
    if (position == UberfireDockPosition.WEST) {
        return docksBar.getExpandedBarSize() + (event.getClientX() - getAbsoluteLeft());
    }
    if (position == UberfireDockPosition.EAST) {
        return docksBar.getExpandedBarSize() + (getAbsoluteLeft() - event.getClientX());
    }
    if (position == UberfireDockPosition.SOUTH) {
        return docksBar.getExpandedBarSize() + (getAbsoluteTop() - event.getClientY());
    }
    return docksBar.getExpandedBarSize();
}
 
Example 12
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 13
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 14
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 15
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testMouseMoveEvent_RightEdge() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(-200);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(0.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(0.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 16
Project: hexa.tools   File: ResizablePanelBad.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove( MouseMoveEvent event )
{
	if( !fResizing )
		return;

	updateSize( event.getNativeEvent().getEventTarget(), event.getScreenX() - startX, event.getScreenY() - startY );

	event.stopPropagation();
	event.preventDefault();
}
 
Example 17
Project: hexa.tools   File: LayeredAbsoluteStackPanel.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove( MouseMoveEvent event )
{
	if( m_callback == null )
		return;

	event.preventDefault();

	int x = event.getRelativeX( m_canvas.getElement() );

	m_callback.onMouseMove( m_cookie, x );
}
 
Example 18
Project: gantt   File: SvgArrowWidget.java   Source Code and License 6 votes vote down vote up
protected void addMoveHandler() {
    if (msTouchSupported) {
        moveRegisteration = addDomHandler(pointerMoveHandler,
                PointerMoveEvent.getType());
        touchCancelRegisteration = addDomHandler(pointerCancelHandler,
                PointerCancelEvent.getType());
    } else if (touchSupported) {
        moveRegisteration = addDomHandler(touchMoveHandler,
                TouchMoveEvent.getType());
        touchCancelRegisteration = addDomHandler(touchCancelHandler,
                TouchCancelEvent.getType());
    } else {
        moveRegisteration = addDomHandler(mouseMoveHandler,
                MouseMoveEvent.getType());
    }
}
 
Example 19
Project: geomajas-project-client-gwt2   File: GeometryIndexInsertController.java   Source Code and License 6 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
	if (service.getEditingState() == GeometryEditState.INSERTING) {
		Coordinate location = getLocation(event, RenderSpace.WORLD);
		if (snappingEnabled) {
			Coordinate result = snappingService.snap(location);
			if (snappingService.hasSnapped()) {
				service.setTentativeMoveLocation(result);
			} else {
				service.setTentativeMoveLocation(location);
				service.getIndexStateService().snappingEndAll();
			}
		} else {
			service.setTentativeMoveLocation(location);
			service.getIndexStateService().snappingEndAll();
		}
	}
}
 
Example 20
Project: geomajas-project-client-gwt2   File: ZoomStepControl.java   Source Code and License 6 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
	if (dragging) {
		int y = event.getY();
		if (y < minY) {
			y = minY;
		}
		if (y > maxY) {
			y = maxY;
		}
		zoomHandle.getElement().getStyle().setTop(y, Unit.PX);
		handleY += (y - currentY);
		zoomToY(handleY);
		currentY = y;
		event.stopPropagation();
	}
}
 
Example 21
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 22
Project: gwt-mousemanager   File: MouseHandlerManager.java   Source Code and License 6 votes vote down vote up
/**
 * Update event caches to keep track of the latest event of each instance.
 * @param the event to cache
 */
private void updateEventCaches(Event<?> event){
	if(event == null){
		return;
	}
	if(event instanceof DoubleClickEvent){
		doubleClickEvent = new org.gz.gwt.mousemanager.client.event.DoubleClickEvent((DoubleClickEvent)event, target);
	}
	if(event instanceof ClickEvent){
		clickEvent = new org.gz.gwt.mousemanager.client.event.ClickEvent((ClickEvent)event, target);
	}		
	if(event instanceof MouseUpEvent){
		mouseUpEvent = new org.gz.gwt.mousemanager.client.event.MouseUpEvent((MouseUpEvent)event, target);
	}
	if(event instanceof MouseDownEvent){
		mouseDownEvent = new org.gz.gwt.mousemanager.client.event.MouseDownEvent((MouseDownEvent)event, target);
	} 
	if(event instanceof MouseMoveEvent){
		mouseMoveEvent = new org.gz.gwt.mousemanager.client.event.MouseMoveEvent((MouseMoveEvent)event, target);
	}
	if(event instanceof MouseOverEvent){
		mouseOverEvent = new org.gz.gwt.mousemanager.client.event.MouseOverEvent((MouseOverEvent)event, target);
	}
	if(event instanceof MouseOutEvent){
		mouseOutEvent = new org.gz.gwt.mousemanager.client.event.MouseOutEvent((MouseOutEvent)event, target);
	}
	if(event instanceof MouseWheelEvent){
		mouseWheelEvent = new org.gz.gwt.mousemanager.client.event.MouseWheelEvent((MouseWheelEvent)event, target);
	}
	if(event instanceof ContextMenuEvent){
		contextMenuEvent = new org.gz.gwt.mousemanager.client.event.ContextMenuEvent();
	}
}
 
Example 23
Project: swarm   File: SurfaceView.java   Source Code and License 6 votes vote down vote up
/**
 * @param note
 *          the note to render
 */
public NoteView(Note note) {
  this.note = note;
  setStyleName("note");
  note.setObserver(this);

  final Element elem = getElement();
  elem.getStyle().setProperty("position", "absolute");
  titleElement = elem.appendChild(Document.get().createDivElement());
  titleElement.setClassName("note-title");

  content.setStyleName("note-content");
  content.addValueChangeHandler(this);
  setWidget(content);

  render();

  addDomHandler(this, MouseDownEvent.getType());
  addDomHandler(this, MouseMoveEvent.getType());
  addDomHandler(this, MouseUpEvent.getType());
}
 
Example 24
Project: swarm   File: SurfaceView.java   Source Code and License 6 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
  if (dragging) {
    setPixelPosition(event.getX() + getAbsoluteLeft() - dragOffsetX,
        event.getY() + getAbsoluteTop() - dragOffsetY);
    event.preventDefault();
  }
}
 
Example 25
Project: obsolete-web-boards-gwt   File: EditDisplay.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	if (event.isControlKeyDown()) {
		Element newSource = event.getRelativeElement();
		if (source != newSource && source != null) {
			Hex from = Hex.fromSVGId(source.getId());
			Hex to = Hex.fromSVGId(newSource.getId());
			drawLine(from, to);
			if (path.isEmpty()) {
				path.add(source);
			}
			path.add(newSource);
		}
		setCurrent(newSource);
	}
}
 
Example 26
Project: obsolete-web-boards-gwt   File: SVGZoomAndPanHandler.java   Source Code and License 6 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent e) {
	if (mouseDown) {
		panning = true;
		float x = mouse.x;
		float y = mouse.y;
		OMSVGPoint start = toUsertSpace(x, y);
		OMSVGPoint pos = toUsertSpace(e.getClientX(), e.getClientY());
		OMSVGRect viewBox = svg.getViewBox().getBaseVal();
		viewBox.setX(offset.x + (start.getX() - pos.getX()));
		viewBox.setY(offset.y + (start.getY() - pos.getY()));
	} else {
		panning = false;
		updateMousePosition(e);
	}
}
 
Example 27
Project: WebConsole   File: ListItem.java   Source Code and License 5 votes vote down vote up
private void registerHandlers() {
	if(BrowserUtils.isMobile) {
		registerHandler(this.addDomHandler(this, TouchStartEvent.getType()));
		registerHandler(this.addDomHandler(this, TouchEndEvent.getType()));
		registerHandler(this.addDomHandler(this, TouchMoveEvent.getType()));
	} else {
		registerHandler(this.addDomHandler(this, MouseDownEvent.getType()));
		registerHandler(this.addDomHandler(this, MouseUpEvent.getType()));
		registerHandler(this.addDomHandler(this, MouseOutEvent.getType()));
		registerHandler(this.addDomHandler(this, MouseMoveEvent.getType()));
	}
}
 
Example 28
Project: Wiab.pro   File: MouseComeLeaveEvent.java   Source Code and License 5 votes vote down vote up
/**
 * Creates new mouse come event basing on the source mouse move event.
 */
public MouseComeLeaveEvent(MouseMoveEvent srcEvent, Element contextElement,
    Element anotherElement) {
  this.srcEvent = srcEvent;
  this.contextElement = contextElement;
  this.anotherElement = anotherElement;
}
 
Example 29
Project: gwt-chronoscope   File: ChartMouseMoveHandler.java   Source Code and License 5 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
  ChartState chartInfo = getChartState(event);
  Chart chart = chartInfo.chart;
  XYPlot plot = chart.getPlot();
  int x = getLocalX(event);
  int y = getLocalY(event);

  CompoundUIAction uiAction = chartInfo.getCompoundUIAction();
  if (uiAction.isSelecting(plot)) {
    chart.setAnimating(true);
    plot.setHighlight(uiAction.getStartX(), x);
  } else if (uiAction.getSource() != null && uiAction
      .isDragging(uiAction.getSource())) {
    int dragThd = uiAction.isDragStarted(plot) ? 1
        : (uiAction.getSource() instanceof Overlay ? 5 : 10);

    boolean dragThresholdReached = Math.abs(uiAction.getStartX() - x)
        > dragThd;
    if (dragThresholdReached) {
      if (uiAction.getSource() instanceof Overlay) {
        if (!uiAction.isDragStarted(plot)) {
          plot.fireEvent(new ChartDragStartEvent(plot, x));
          uiAction.setDragStarted(true);
          uiAction.setDragStartX(uiAction.getStartX());
        }
        ((Overlay) uiAction.getSource()).fire(new ChartDragEvent(plot, x));
        chart.setHover(x,y);
      } else {
        chart.setAnimating(true);
        chart.scrollPixels(uiAction.getStartX() - x);
      }
      uiAction.setStartX(x);
      event.stopPropagation();
      event.preventDefault();
    }
  } else if ((null != plot) && (null != plot.getBounds()) && (plot.getBounds().inside(x, y))) {
    if (chart.setHover(x, y)) {
      chart.setCursor(Cursor.CLICKABLE);
    } else {
      chart.setCursor(Cursor.DRAGGABLE);
    }
  }

  chartInfo.setHandled(true);
}
 
Example 30
Project: circuitjs1   File: Scrollbar.java   Source Code and License 5 votes vote down vote up
public void onMouseMove(MouseMoveEvent e){
//		GWT.log("Move");
		e.preventDefault();
		doMouseMove(e.getX());
	}
 
Example 31
Project: che   File: View.java   Source Code and License 5 votes vote down vote up
private void continueDragging(MouseMoveEvent event) {
  if (dragging) {
    int absX = event.getX() + contentContainer.getAbsoluteLeft();
    int absY = event.getY() + contentContainer.getAbsoluteTop();

    // if the mouse is off the screen to the left, right, or top, don't
    // move the dialog box. This would let users lose dialog boxes, which
    // would be bad for modal popups.
    if (absX < clientLeft || absX >= windowWidth || absY < clientTop) {
      return;
    }

    setPopupPosition(absX - dragStartX, absY - dragStartY);
  }
}
 
Example 32
Project: firefly   File: SelectAreaCmd.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove(WebPlotView pv, ScreenPt spt, MouseMoveEvent ev) {
    if (_mouseDown) {
        drag(pv, spt);
    }
    else {
        changePointer(pv,spt);
    }
}
 
Example 33
Project: firefly   File: PopupPane.java   Source Code and License 5 votes vote down vote up
private void setCursorShape(MouseMoveEvent ev) {
    if (_expandW==null) return;
    int x= getAbsoluteX(ev);
    int y= getAbsoluteY(ev);
    PopupRegion r= findRegion(x,y);
    if (r==PopupRegion.SE_CORNER) {
        GwtUtil.setStyle(popup, "cursor", "se-resize");
    }
    else if (r==PopupRegion.SW_CORNER) {
        GwtUtil.setStyle(popup, "cursor", "sw-resize");
    }
    else {
        GwtUtil.setStyle(popup, "cursor", "auto");
    }
}
 
Example 34
Project: djvu-html5   File: UIHider.java   Source Code and License 5 votes vote down vote up
public UIHider(int uiHideDelay, Widget textLayer) {
	this.uiHideDelay = uiHideDelay;
	textLayer.addDomHandler(this, MouseMoveEvent.getType());
	textLayer.addDomHandler(this, KeyDownEvent.getType());
	textLayer.addDomHandler(this, ScrollEvent.getType());
	textLayer.addDomHandler(this, TouchStartEvent.getType());
}
 
Example 35
Project: djvu-html5   File: PanListener.java   Source Code and License 5 votes vote down vote up
public PanListener(Widget widget) {
	this.widget = widget;
	widget.addDomHandler(this, MouseDownEvent.getType());
	widget.addDomHandler(this, MouseUpEvent.getType());
	widget.addDomHandler(this, MouseMoveEvent.getType());
	widget.addDomHandler(this, TouchStartEvent.getType());
	widget.addDomHandler(this, TouchEndEvent.getType());
	widget.addDomHandler(this, TouchMoveEvent.getType());
}
 
Example 36
Project: djvu-html5   File: PanListener.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	if (isMouseDown) {
		pan(event.getX() - x, event.getY() - y);
		x = event.getX();
		y = event.getY();
	}
}
 
Example 37
Project: fullmetalgalaxy   File: WgtBoard.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent p_event)
{
  AnBoardPosition position = convertPixPositionToHexPosition( new AnPair(
      p_event.getX(), p_event.getY() ) );
  if( (position.getX() != m_hexagonHightlightPosition.getX())
      || (position.getY() != m_hexagonHightlightPosition.getY()) )
  {
    m_hexagonHightlightPosition = position;
    m_layerSelect.moveHightLightHexagon( m_hexagonHightlightPosition );
  }
}
 
Example 38
Project: fullmetalgalaxy   File: WgtBoardTorus.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent p_event)
{
  AnBoardPosition position = convertPixPositionToHexPosition( new AnPair(
      p_event.getX(), p_event.getY() ) );
  if( (position.getX() != m_hexagonHightlightPosition.getX())
      || (position.getY() != m_hexagonHightlightPosition.getY()) )
  {
    m_hexagonHightlightPosition = position;
    m_layerSelect.moveHightLightHexagon( m_hexagonHightlightPosition );
  }
}
 
Example 39
Project: fullmetalgalaxy   File: WgtScroll.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent p_event)
{
  p_event.preventDefault();
  onMove(Element.as(p_event.getNativeEvent().getEventTarget()), p_event.getClientX(), p_event.getClientY());
}
 
Example 40
Project: appformer   File: GridLienzoScrollHandlerTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testEnablePointerEvents() {

    final MouseMoveEvent mouseMoveEvent = mock(MouseMoveEvent.class);
    final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);
    final GridLienzoScrollUI scrollUI = mock(GridLienzoScrollUI.class);

    doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();
    doReturn(scrollUI).when(gridLienzoScrollHandler).gridLienzoScrollUI();
    doNothing().when(scrollUI).disablePointerEvents(any());

    gridLienzoScrollHandler.enablePointerEvents().onMouseMove(mouseMoveEvent);

    verify(scrollUI).enablePointerEvents(domElementContainer);
}
 
Example 41
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_LeftEdge() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(1200);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(1000.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(0.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 42
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_TopEdge() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(0);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(1200);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(0.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(1000.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 43
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_BottomEdge() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(0);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(-200);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(0.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(0.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 44
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_LeftEdge_Scaled50pct() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(1200);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    transform.scale(0.5,
                    0.5);
    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(500.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(0.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 45
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_RightEdge_Scaled50pct() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(-200);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    transform.scale(0.5,
                    0.5);
    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(0.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(0.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 46
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_TopEdge_Scaled50pct() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(0);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(1200);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    transform.scale(0.5,
                    0.5);
    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(0.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(500.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 47
Project: appformer   File: BoundaryMousePanMediatorTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testMouseMoveEvent_BottomEdge_Scaled50pct() {
    final MouseDownEvent md0 = mock(MouseDownEvent.class);
    when(md0.getRelativeX(any(Element.class))).thenReturn(0);
    when(md0.getRelativeY(any(Element.class))).thenReturn(0);
    final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);

    final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);
    when(mm1.getRelativeX(any(Element.class))).thenReturn(0);
    when(mm1.getRelativeY(any(Element.class))).thenReturn(-200);
    final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);

    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);

    transform.scale(0.5,
                    0.5);
    mediator.handleEvent(nmd0);
    mediator.handleEvent(nmm1);

    verify(viewport,
           times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(0.0,
                 result.getTranslateX(),
                 0.0);
    assertEquals(0.0,
                 result.getTranslateY(),
                 0.0);
}
 
Example 48
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 49
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 50
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 51
Project: hexa.tools   File: ResizablePanelBad.java   Source Code and License 5 votes vote down vote up
public ResizablePanelBad( String titleText, Widget contentWidget )
{
	Element main = DOM.createDiv();
	setElement( main );

	setStylePrimaryName( ResizablePanel.CSS.main() );

	ImageResource closeImage = ImageResources.INSTANCE.close();
	titleSize = Math.max( closeImage.getHeight(), closeImage.getWidth() ) + 5;

	String html = template.replaceAll( "#HANDLER_SIZE#", "" + resizeHandlerSize ).replaceAll( "#TITLE_SIZE#", "" + titleSize ).replaceAll( "#CONTENT_TOP#", "" + (resizeHandlerSize + titleSize) ).replaceAll( "#TITLE_RIGHT#", "" + (resizeHandlerSize + titleSize) );
	main.setInnerHTML( html );

	topLeft = (Element) main.getChild( 0 );
	top = (Element) main.getChild( 1 );
	topRight = (Element) main.getChild( 2 );
	right = (Element) main.getChild( 3 );
	bottomRight = (Element) main.getChild( 4 );
	bottom = (Element) main.getChild( 5 );
	bottomLeft = (Element) main.getChild( 6 );
	left = (Element) main.getChild( 7 );
	title = (Element) main.getChild( 8 );
	close = (Element) main.getChild( 9 ).getChild( 0 );
	close.setAttribute( "src", closeImage.getSafeUri().asString() );
	content = (Element) main.getChild( 10 );

	addDomHandler( this, MouseMoveEvent.getType() );
	addDomHandler( this, MouseUpEvent.getType() );
	addDomHandler( this, MouseDownEvent.getType() );
	
	title.setInnerText( titleText );
	
	this.contentWidget = contentWidget;
}
 
Example 52
Project: hexa.tools   File: DialogBoxForNormalWidget.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove( MouseMoveEvent event )
{
	if( isMoving )
	{
		main.getStyle().setLeft( movingOriginX + event.getClientX() - movingMouseOffsetX, Unit.PX );
		main.getStyle().setTop( movingOriginY + event.getClientY() - movingMouseOffsetY, Unit.PX );
	}
}
 
Example 53
Project: QMAClone   File: StrokeCanvas.java   Source Code and License 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	final int x = event.getX();
	final int y = event.getY();
	// System.out.println("onMouseMove(" + x + "," + y + ")");

	if (lastStroke != null) {
		addPointToLastStroke(x, y);

		updateCanvas();
	}
}
 
Example 54
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 55
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 56
Project: geomajas-project-client-gwt   File: EditGeometryBaseController.java   Source Code and License 5 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
	super.onMouseMove(event);
	if (service.getEditingState() == GeometryEditState.IDLE) {
		idleController.onMouseMove(event);
	} else if (service.getEditingState() == GeometryEditState.DRAGGING) {
		dragController.onMouseMove(event);
	} else if (service.getEditingState() == GeometryEditState.INSERTING) {
		insertController.onMouseMove(event);
	}
}
 
Example 57
Project: geomajas-project-client-gwt   File: MeasureDistanceController.java   Source Code and License 5 votes vote down vote up
/** Update the drawing while moving the mouse. */
public void onMouseMove(MouseMoveEvent event) {
	if (isMeasuring() && distanceLine.getOriginalLocation() != null) {
		updateMeasure(event, false);
		dispatchState(State.MOVE);
	}
}
 
Example 58
Project: geomajas-project-client-gwt   File: OverviewMapController.java   Source Code and License 5 votes vote down vote up
/**
 * Only moving rectangle or reticle during drag.
 */
@Override
public void onMouseMove(MouseMoveEvent event) {
	if (dragging) {
		Coordinate current = getScreenPosition(event);
		getOverviewMap().movePov(current.getX() - previous.getX(), current.getY() - previous.getY());
		previous = current;
	}
}
 
Example 59
Project: geomajas-project-client-gwt   File: LineStringEditController.java   Source Code and License 5 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
	FeatureTransaction featureTransaction = getFeatureTransaction();
	if (featureTransaction != null && parent.getEditMode() == EditMode.DRAG_MODE && dragTargetId != null) {
		TransactionGeomIndex index = TransactionGeomIndexUtil.getIndex(dragTargetId);

		Feature feature = dragTransaction.getNewFeatures()[index.getFeatureIndex()];
		FeatureOperation op = new SetCoordinateOp(index, getWorldPosition(event));
		op.execute(feature);

		mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
		mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
	} else if (featureTransaction != null && parent.getEditMode() == EditMode.INSERT_MODE) {
		updateTempLine(featureTransaction, event);
	}
}
 
Example 60
Project: geomajas-project-client-gwt   File: PointEditController.java   Source Code and License 5 votes vote down vote up
public void onMouseMove(MouseMoveEvent event) {
	if (getFeatureTransaction() != null && parent.getEditMode() == EditMode.DRAG_MODE && dragTargetId != null) {
		TransactionGeomIndex index = TransactionGeomIndexUtil.getIndex(dragTargetId);

		Feature feature = dragTransaction.getNewFeatures()[index.getFeatureIndex()];
		FeatureOperation op = new SetCoordinateOp(index, getWorldPosition(event));
		op.execute(feature);

		mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
		mapWidget.render(dragTransaction, RenderGroup.VECTOR, RenderStatus.ALL);
	}
}