List of usage examples for java.awt AWTEvent MOUSE_MOTION_EVENT_MASK
long MOUSE_MOTION_EVENT_MASK
To view the source code for java.awt AWTEvent MOUSE_MOTION_EVENT_MASK.
Click Source Link
From source file:org.eclipse.jubula.rc.swing.driver.RobotAwtImpl.java
/** * Implementation of the mouse move. The mouse is moved into the graphics component. * @param graphicsComponent The component to move to * @param constraints The more specific constraints. Use this, for example * when you want the click point to be relative to a part * of the component (e.g. tree node, table cell, etc) * rather than the overall component itself. May be * <code>null</code>. * @param xPos xPos in component * @param yPos yPos in component// w ww. ja v a2 s. c o m * @param xAbsolute true if x-position should be absolute * @param yAbsolute true if y-position should be absolute * @param clickOptions The click options * @throws StepExecutionException If the click delay is interrupted or the * event confirmation receives a timeout. */ private void moveImpl(Object graphicsComponent, final Rectangle constraints, final int xPos, final boolean xAbsolute, final int yPos, final boolean yAbsolute, ClickOptions clickOptions) throws StepExecutionException { if (clickOptions.isScrollToVisible()) { ensureComponentVisible((Component) graphicsComponent, constraints); m_eventFlusher.flush(); } Component component = (Component) graphicsComponent; Rectangle bounds = null; bounds = new Rectangle(getLocation(component, new Point(0, 0))); bounds.width = component.getWidth(); bounds.height = component.getHeight(); if (constraints != null) { bounds.x += constraints.x; bounds.y += constraints.y; bounds.height = constraints.height; bounds.width = constraints.width; } Point p = PointUtil.calculateAwtPointToGo(xPos, xAbsolute, yPos, yAbsolute, bounds); // Move if necessary if (isMouseMoveRequired(p)) { if (log.isDebugEnabled()) { log.debug("Moving mouse to: " + p); //$NON-NLS-1$ } IRobotEventConfirmer confirmer = null; if (clickOptions.isConfirmClick()) { InterceptorOptions options = new InterceptorOptions( new long[] { AWTEvent.MOUSE_MOTION_EVENT_MASK }); confirmer = m_interceptor.intercept(options); } Point startpoint = m_mouseMotionTracker.getLastMousePointOnScreen(); if (startpoint == null) { // If there is no starting point the center of the root component is used Component root = SwingUtilities.getRoot(component); Component c = (root != null) ? root : component; startpoint = getLocation(c, null); } Point[] mouseMove = MouseMovementStrategy.getMovementPath(startpoint, p, clickOptions.getStepMovement(), clickOptions.getFirstHorizontal()); for (int i = 0; i < mouseMove.length; i++) { m_robot.mouseMove(mouseMove[i].x, mouseMove[i].y); m_eventFlusher.flush(); } if (confirmer != null) { confirmer.waitToConfirm(component, new MouseMovedAwtEventMatcher()); } } }