Ejemplo n.º 1
0
 public void mouseWheelMoved(ShrimpMouseEvent e) {
   // @tag Shrimp.MouseWheel
   if (handleAnyMouseEvent(e)) {
     for (Iterator iter = mouseWheelEvents.iterator(); iter.hasNext(); ) {
       UserEvent userEvent = (UserEvent) iter.next();
       if ((isShiftPressed == userEvent.isShiftRequired())
           && (isCtrlPressed == userEvent.isControlRequired())
           && (isAltPressed == userEvent.isAltRequired())) {
         if (e.isUpWheelRotation() && (userEvent.getKeyOrButton() == UserEvent.MOUSE_WHEEL_UP)) {
           if (userEvent.getAction().mustStartAndStop()) {
             startAction(userEvent.getAction());
             stopAction(userEvent.getAction());
           } else {
             startAction(userEvent.getAction());
           }
         } else if (e.isDownWheelRotation()
             && (userEvent.getKeyOrButton() == UserEvent.MOUSE_WHEEL_DOWN)) {
           if (userEvent.getAction().mustStartAndStop()) {
             startAction(userEvent.getAction());
             stopAction(userEvent.getAction());
           } else {
             startAction(userEvent.getAction());
           }
         }
       }
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * @see
  *     ca.uvic.csr.shrimp.DisplayBean.event.ShrimpMouseListener#mouseReleased(ca.uvic.csr.shrimp.DisplayBean.event.ShrimpMouseEvent)
  */
 public void mouseReleased(ShrimpMouseEvent e) {
   if (!handleAnyMouseEvent(e)) {
     return;
   }
   if (e.isLeftMouseButton()) {
     processMouseRelease(UserEvent.LEFT_MOUSE_BUTTON);
   } else if (e.isMiddleMouseButton()) {
     processMouseRelease(UserEvent.MIDDLE_MOUSE_BUTTON);
   } else if (e.isRightMouseButton()) {
     processMouseRelease(UserEvent.RIGHT_MOUSE_BUTTON);
   }
 }
Ejemplo n.º 3
0
  /** This method handles all of the mouse events first */
  public boolean handleAnyMouseEvent(ShrimpMouseEvent e) {
    if (tool == null) {
      return false;
    }
    // tool.clearOutputText();

    try {
      selectorBean = (SelectorBean) tool.getBean(ShrimpTool.SELECTOR_BEAN);
    } catch (BeanNotFoundException bnfe) {
      bnfe.printStackTrace();
      return false;
    }

    // in case the system didn't throw all the events, this clears the modifiers for us
    if (e.getModifiers() == 0) {
      isCtrlPressed = false;
      isShiftPressed = false;
      isAltPressed = false;
    }

    // set the current target
    Object targetObj = e.getTarget();
    if (targetObj != null) {
      selectorBean.setSelected(SelectorBeanConstants.TARGET_OBJECT, targetObj);
    } else {
      selectorBean.clearSelected(SelectorBeanConstants.TARGET_OBJECT);
    }

    // set the current mouse coordinates
    Vector coords = new Vector();
    coords.addElement(new Double(e.getX()));
    coords.addElement(new Double(e.getY()));
    selectorBean.setSelected(SelectorBeanConstants.MOUSE_COORDINATES, coords);

    return true;
  }
Ejemplo n.º 4
0
 /**
  * @see
  *     ca.uvic.csr.shrimp.DisplayBean.event.ShrimpMouseListener#mousePressed(ca.uvic.csr.shrimp.DisplayBean.event.ShrimpMouseEvent)
  */
 public void mousePressed(ShrimpMouseEvent e) {
   if (!handleAnyMouseEvent(e)) {
     return;
   }
   if (e.isLeftMouseButton()) {
     processMousePress(
         UserEvent.LEFT_MOUSE_BUTTON,
         UserEvent.DOUBLE_CLICK__LEFT_MOUSE_BUTTON,
         e.getClickCount());
   } else if (e.isMiddleMouseButton()) {
     processMousePress(
         UserEvent.MIDDLE_MOUSE_BUTTON,
         UserEvent.DOUBLE_CLICK__MIDDLE_MOUSE_BUTTON,
         e.getClickCount());
   } else if (e.isRightMouseButton()) {
     processMousePress(
         UserEvent.RIGHT_MOUSE_BUTTON,
         UserEvent.DOUBLE_CLICK__RIGHT_MOUSE_BUTTON,
         e.getClickCount());
   }
 }