public void mouseEvt(MouseEvent evt) {
   if (evt.isPopupTrigger()) {
     propDialog.setVisible(true);
     propDialog.toFront();
     evt.consume();
   }
 }
Beispiel #2
0
 private void maybeShowGroupPopup(MouseEvent e, JIDStatusGroup jidStatusGroup) {
   if (e.isPopupTrigger()) {
     currentJIDStatusGroup = jidStatusGroup;
     currentGroup = jidStatusGroup.getName();
     groupPopupMenu.show(e.getComponent(), e.getX(), e.getY());
   }
 }
  protected void processMouseEvent(final MouseEvent e) {
    if (e.isPopupTrigger() && e.getComponent().isShowing()) {
      super.processMouseEvent(e);
      return;
    }

    if (UIUtil.isCloseClick(e)) {
      myDecorator.fireHiddenSide();
      return;
    }

    if (e.getButton() == MouseEvent.BUTTON1) {
      if (MouseEvent.MOUSE_PRESSED == e.getID()) {
        myPressedPoint = e.getPoint();
        myPressedWhenSelected = isSelected();
        myDragCancelled = false;
      } else if (MouseEvent.MOUSE_RELEASED == e.getID()) {
        finishDragging();
        myPressedPoint = null;
        myDragButtonImage = null;
      }
    }

    super.processMouseEvent(e);
  }
Beispiel #4
0
 // This fixes the problem where when on the mac you have to ctrl left click to
 // get popup triggers the caret has code that only looks at button number.
 // see radar # 3125390
 @Override
 public void mousePressed(final MouseEvent e) {
   if (!e.isPopupTrigger()) {
     super.mousePressed(e);
     shouldSelectAllOnFocus = false;
   }
 }
Beispiel #5
0
    private void showJPopupMenu(MouseEvent e) {
      try {
        if (e.isPopupTrigger() && menu != null) {
          if (window == null) {

            if (isWindows) {
              window = new JDialog((Frame) null);
              ((JDialog) window).setUndecorated(true);
            } else {
              window = new JWindow((Frame) null);
            }
            window.setAlwaysOnTop(true);
            Dimension size = menu.getPreferredSize();

            Point centerPoint = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
            if (e.getY() > centerPoint.getY()) window.setLocation(e.getX(), e.getY() - size.height);
            else window.setLocation(e.getX(), e.getY());

            window.setVisible(true);

            menu.show(((RootPaneContainer) window).getContentPane(), 0, 0);

            // popup works only for focused windows
            window.toFront();
          }
        }
      } catch (Exception ignored) {
      }
    }
  private void maybeShowPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
      _mnuAllFilteredSelectedOrder.setEnabled(_modeManager.getMode().isQueryBuilder());

      _popUp.show(e.getComponent(), e.getX(), e.getY());
    }
  }
 public void mouseReleased(final MouseEvent e) {
   if (e.isPopupTrigger()) {
     Point pt =
         SwingUtilities.convertPoint((Component) e.getSource(), e.getX(), e.getY(), frame);
     popup.show(frame, pt.x, pt.y);
     return;
   }
 }
    private void maybeShowPopup(MouseEvent e) {

      if (e.isPopupTrigger()) {
        popup = new JPopupMenu();
        CalendarCardPanel cc = new CalendarCardPanel(ClientContext.getEventColorTable());
        cc.addPropertyChangeListener(CalendarCardPanel.PICKED_DATE, this);
        cc.setCalendarRange(new int[] {-12, 0});
        popup.insert(cc, 0);
        popup.show(e.getComponent(), e.getX(), e.getY());
      }
    }
 void forwardEventToParent(MouseEvent e) {
   getParent()
       .dispatchEvent(
           new MouseEvent(
               getParent(),
               e.getID(),
               e.getWhen(),
               e.getModifiers(),
               e.getX(),
               e.getY(),
               e.getXOnScreen(),
               e.getYOnScreen(),
               e.getClickCount(),
               e.isPopupTrigger(),
               MouseEvent.NOBUTTON));
 }
  /**
   * Propagates certain mouse events, such as MOUSE_CLICKED, MOUSE_RELEASED etc. to the deepest
   * component.
   *
   * @param e The MouseEvent to be propagated.
   */
  protected void propagateMouseListenerEvent(MouseEvent e) {
    if (POPUP_IS_MODAL == false) {

      Component deepestComponent = getDeepestComponent(e.getPoint());

      if (deepestComponent != null) {
        MouseListener[] mouseListeners = deepestComponent.getMouseListeners();

        int eventID;

        // Get the event type
        eventID = e.getID();

        Point pt = e.getPoint();

        Point convertedPt = SwingUtilities.convertPoint(glassPane, e.getPoint(), deepestComponent);

        MouseEvent evt =
            new MouseEvent(
                deepestComponent,
                e.getID(),
                System.currentTimeMillis(),
                e.getModifiers(),
                convertedPt.x,
                convertedPt.y,
                e.getClickCount(),
                e.isPopupTrigger(),
                e.getButton());

        // Distibute the event to the component's listeners.
        for (int i = 0; i < mouseListeners.length; i++) {

          // Forward the appropriate mouse event
          if (eventID == MouseEvent.MOUSE_PRESSED) {
            mouseListeners[i].mousePressed(evt);
          } else if (eventID == MouseEvent.MOUSE_RELEASED) {
            mouseListeners[i].mouseReleased(evt);
          } else if (eventID == MouseEvent.MOUSE_CLICKED) {
            mouseListeners[i].mouseClicked(evt);
          }
        }
      }
    }
  }
 private void dispatchEvent(MouseEvent me) {
   if (rect != null && rect.contains(me.getX(), me.getY())) {
     Point pt = me.getPoint();
     pt.translate(-offset, 0);
     comp.setBounds(rect);
     comp.dispatchEvent(
         new MouseEvent(
             comp,
             me.getID(),
             me.getWhen(),
             me.getModifiers(),
             pt.x,
             pt.y,
             me.getClickCount(),
             me.isPopupTrigger(),
             me.getButton()));
     if (!comp.isValid()) container.repaint();
   }
 }
    public void mabeShowPopup(MouseEvent e) {

      if (e.isPopupTrigger()) {

        final JPopupMenu contextMenu = new JPopupMenu();

        int row = view.getTable().rowAtPoint(e.getPoint());
        ListTableModel<PatientModel> tModel = getTableModel();
        PatientModel obj = tModel.getObject(row);
        int selected = view.getTable().getSelectedRow();

        if (row == selected && obj != null) {
          contextMenu.add(
              new JMenuItem(new ReflectAction("カルテを開く", PatientSearchImpl.this, "openKarte")));
          contextMenu.addSeparator();
          // s.oh^ 2014/08/19 ID権限
          // contextMenu.add(new JMenuItem(copyAction));
          // contextMenu.add(new JMenuItem(new ReflectAction("受付登録", PatientSearchImpl.this,
          // "addAsPvt")));
          // contextMenu.addSeparator();
          if (!Project.isOtherCare()) {
            contextMenu.add(new JMenuItem(copyAction));
            contextMenu.add(
                new JMenuItem(new ReflectAction("受付登録", PatientSearchImpl.this, "addAsPvt")));
            contextMenu.addSeparator();
          }
          // s.oh$
        }

        JCheckBoxMenuItem item = new JCheckBoxMenuItem("年齢表示");
        contextMenu.add(item);
        item.setSelected(ageDisplay);
        item.addActionListener(
            (ActionListener)
                EventHandler.create(
                    ActionListener.class, PatientSearchImpl.this, "switchAgeDisplay"));

        contextMenu.show(e.getComponent(), e.getX(), e.getY());
      }
    }
    public void mouseReleased(MouseEvent e) {
      if (e.isPopupTrigger()) {
        DefaultTreeModel model = (DefaultTreeModel) m_tree.getModel();
        TreePath path = m_tree.getSelectionPath();
        if (path != null) {
          DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();

          if (node == model.getRoot()) {
            mi_add.setEnabled(true);
            mi_edit.setEnabled(false);
            mi_delete.setEnabled(false);
          } else {
            mi_add.setEnabled(true);
            mi_edit.setEnabled(true);
            mi_delete.setEnabled(true);
          }

          Rectangle rectangle = m_tree.getPathBounds(path);
          if (rectangle.contains(e.getPoint())) m_popupMenu.show(m_tree, e.getX(), e.getY());
        }
      }
    }
  protected void propagateMouseMotionListenerEvents(MouseEvent e) {
    if (FORWARD_MOUSE_MOTION_EVENTS == true) {
      // Get the correct component
      Component deepestComponent = getDeepestComponent(e.getPoint());

      if (deepestComponent != null) {
        // Distribute the event to the components listeners
        MouseMotionListener[] mouseMotionListeners = deepestComponent.getMouseMotionListeners();

        // Get the event type
        int eventID = e.getID();

        Point pt = e.getPoint();

        Point convertedPt = SwingUtilities.convertPoint(glassPane, e.getPoint(), deepestComponent);

        MouseEvent evt =
            new MouseEvent(
                deepestComponent,
                e.getID(),
                System.currentTimeMillis(),
                e.getModifiers(),
                convertedPt.x,
                convertedPt.y,
                e.getClickCount(),
                e.isPopupTrigger(),
                e.getButton());

        for (int i = 0; i < mouseMotionListeners.length; i++) {
          if (eventID == MouseEvent.MOUSE_MOVED) {
            mouseMotionListeners[i].mouseMoved(e);
          } else if (eventID == MouseEvent.MOUSE_DRAGGED) {
            mouseMotionListeners[i].mouseDragged(e);
          }
        }
      }
    }
  }
  /**
   * Re-dispatches glass pane mouse events only in case they occur on the security panel.
   *
   * @param glassPane the glass pane
   * @param e the mouse event in question
   */
  private void redispatchMouseEvent(Component glassPane, MouseEvent e) {
    Point glassPanePoint = e.getPoint();

    Point securityPanelPoint =
        SwingUtilities.convertPoint(glassPane, glassPanePoint, securityPanel);

    Component component;
    Point componentPoint;

    if (securityPanelPoint.y > 0) {
      component = securityPanel;
      componentPoint = securityPanelPoint;
    } else {
      Container contentPane =
          callRenderer.getCallContainer().getCallWindow().getFrame().getContentPane();

      Point containerPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, contentPane);

      component =
          SwingUtilities.getDeepestComponentAt(contentPane, containerPoint.x, containerPoint.y);

      componentPoint = SwingUtilities.convertPoint(contentPane, glassPanePoint, component);
    }

    if (component != null)
      component.dispatchEvent(
          new MouseEvent(
              component,
              e.getID(),
              e.getWhen(),
              e.getModifiers(),
              componentPoint.x,
              componentPoint.y,
              e.getClickCount(),
              e.isPopupTrigger()));

    e.consume();
  }
Beispiel #16
0
 /**
  * Returns whether or not the 'edit cursor' popup is to be shown.
  *
  * @param aEvent the event to test, may be <code>null</code>.
  * @return <code>true</code> if the 'edit cursor' popup is to be shown, <code>false</code>
  *     otherwise.
  */
 private boolean isCursorPopupTrigger(final MouseEvent aEvent) {
   return !aEvent.isConsumed() && aEvent.isPopupTrigger();
 }
 private void nameContactNotesTableMouseReleased(MouseEvent e) {
   if (e.isPopupTrigger()) {
     insertContactNotePopUpMenu.show(e.getComponent(), e.getX(), e.getY());
   }
 }
Beispiel #18
0
 public void mouseReleased(MouseEvent aEvent) {
   if (aEvent.isPopupTrigger())
     contextMenu.show((Component) aEvent.getSource(), aEvent.getX(), aEvent.getY());
 }
Beispiel #19
0
 private void maybeShowPopup(MouseEvent e) {
   if (e.isPopupTrigger() && back.size() > 1) popup.show(e.getComponent(), e.getX(), e.getY());
 }
Beispiel #20
0
 public void mouseReleased(MouseEvent e) {
   if (e.isPopupTrigger()) {
     Popup popup = new Popup();
     popup.show(e.getComponent(), e.getX(), e.getY());
   }
 }
 private void maybeShowPopup(MouseEvent e) {
   if (e.isPopupTrigger()) {
     popup.show(e.getComponent(), e.getX(), e.getY());
   }
 }
 private void maybeShowPopup(MouseEvent e) {
   if (e.isPopupTrigger()) {
     popup.show(e.getComponent(), e.getX(), e.getY());
     isPopupOnScreen(popup, fullScreenBounds);
   }
 }
 @Override
 public void mouseReleased(MouseEvent e) {
   if (e.isPopupTrigger()) {
     contextMenu.show(e.getComponent(), e.getX(), e.getY());
   }
 }
 public void mousePressed(MouseEvent e) {
   if (e.isPopupTrigger()) doPop(e);
 }
    private MouseEvent transformMouseEvent(MouseEvent event) {
      if (event == null) {
        throw new IllegalArgumentException("MouseEvent is null");
      }
      MouseEvent newEvent;
      if (event instanceof MouseWheelEvent) {
        MouseWheelEvent mouseWheelEvent = (MouseWheelEvent) event;
        newEvent =
            new MouseWheelEvent(
                mouseWheelEvent.getComponent(),
                mouseWheelEvent.getID(),
                mouseWheelEvent.getWhen(),
                mouseWheelEvent.getModifiers(),
                mouseWheelEvent.getX(),
                mouseWheelEvent.getY(),
                mouseWheelEvent.getClickCount(),
                mouseWheelEvent.isPopupTrigger(),
                mouseWheelEvent.getScrollType(),
                mouseWheelEvent.getScrollAmount(),
                mouseWheelEvent.getWheelRotation());
      } else {
        newEvent =
            new MouseEvent(
                event.getComponent(),
                event.getID(),
                event.getWhen(),
                event.getModifiers(),
                event.getX(),
                event.getY(),
                event.getClickCount(),
                event.isPopupTrigger(),
                event.getButton());
      }
      if (view != null && at.getDeterminant() != 0) {
        Rectangle viewBounds = getTransformedSize();
        Insets insets = JXTransformer.this.getInsets();
        int xgap = (getWidth() - (viewBounds.width + insets.left + insets.right)) / 2;
        int ygap = (getHeight() - (viewBounds.height + insets.top + insets.bottom)) / 2;

        double x = newEvent.getX() + viewBounds.getX() - insets.left;
        double y = newEvent.getY() + viewBounds.getY() - insets.top;
        Point2D p = new Point2D.Double(x - xgap, y - ygap);

        Point2D tp;
        try {
          tp = at.inverseTransform(p, null);
        } catch (NoninvertibleTransformException ex) {
          // can't happen, we check it before
          throw new AssertionError("NoninvertibleTransformException");
        }
        // Use transformed coordinates to get the current component
        mouseCurrentComponent =
            SwingUtilities.getDeepestComponentAt(view, (int) tp.getX(), (int) tp.getY());
        if (mouseCurrentComponent == null) {
          mouseCurrentComponent = JXTransformer.this;
        }
        Component tempComponent = mouseCurrentComponent;
        if (mouseDraggedComponent != null) {
          tempComponent = mouseDraggedComponent;
        }

        Point point =
            SwingUtilities.convertPoint(view, (int) tp.getX(), (int) tp.getY(), tempComponent);
        newEvent.setSource(tempComponent);
        newEvent.translatePoint(point.x - event.getX(), point.y - event.getY());
      }
      return newEvent;
    }