Exemple #1
0
 public void mouseDragged(MouseEvent e) {
   if (isEnabled()) {
     // System.out.println("LinkTool::mouseDragged");
     if (e.getSource() instanceof ONLGraphic)
       buttonAction.setIntermediate(e.getPoint(), (ONLGraphic) e.getSource());
   }
 }
    public void mouseMoved(MouseEvent ev) {
      JRootPane root = getRootPane();

      if (root.getWindowDecorationStyle() == JRootPane.NONE) {
        return;
      }

      Window w = (Window) ev.getSource();

      Frame f = null;
      Dialog d = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else if (w instanceof Dialog) {
        d = (Dialog) w;
      }

      // Update the cursor
      int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY()));

      if (cursor != 0
          && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0))
              || (d != null && d.isResizable()))) {
        w.setCursor(Cursor.getPredefinedCursor(cursor));
      } else {
        w.setCursor(lastCursor);
      }
    }
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     doubleClicked((JComponent) e.getSource());
   }
   super.mouseClicked(e);
 }
Exemple #4
0
  public void mouseClicked(MouseEvent e) {
    int x;
    int y;

    e.consume();

    if (mouseEventsEnabled) {

      x = Math.round(e.getX() / scale);
      y = Math.round(e.getY() / scale);

      // allow for the canvas margin
      y -= margin;

      // System.out.println("Mouse Click: (" + x + ", " + y + ")");

      if (e.getClickCount() < 2) {
        if (nativeSelectItem(x, y)) {
          parentFTAFrame.updateFrame();
        }
      } else {
        if (nativeSelectItem(x, y)) {
          parentFTAFrame.updateFrame();
        }

        editSelected();
        parentFTAFrame.updateFrame();
      }

      if (focusEventsEnabled) {
        // tell the main Canvas to point to this coordinate
        parentFTAFrame.setCanvasFocus(x, y);
      }
    }
  }
    public void mouseClicked(MouseEvent e) {
      JTableHeader h = (JTableHeader) e.getSource();
      TableColumnModel columnModel = h.getColumnModel();
      int viewColumn = columnModel.getColumnIndexAtX(e.getX());
      int column = columnModel.getColumn(viewColumn).getModelIndex();
      if (column != -1) {
        sorting_column = column;

        // 0 == priority icon column
        // 4 == priority text column
        if (column == 0) sorting_column = 4;

        if (e.isControlDown()) sorting_column = -1;
        else opposite = !opposite;

        TaskTable treetable = ((TaskTable) h.getTable());

        // java.util.Collection expanded = treetable.getExpandedTreeNodes();

        treetable.tableChanged();
        // treetable.setExpandedTreeNodes(expanded);
        // h.updateUI();
        h.resizeAndRepaint();
      }
    }
Exemple #6
0
    public void mouseDragged(MouseEvent e) {
      int mods = e.getModifiersEx();
      Point dragEnd = e.getPoint();
      boolean shift = (mods & MouseEvent.SHIFT_DOWN_MASK) > 0;
      boolean ctrl = (mods & MouseEvent.CTRL_DOWN_MASK) > 0;
      boolean alt = shift & ctrl;
      ctrl = ctrl & (!alt);
      shift = shift & (!alt);
      boolean nomods = !(shift | ctrl | alt);

      if (dragBegin == null) dragBegin = dragEnd;

      nodrag = false;

      if ((mods & InputEvent.BUTTON3_DOWN_MASK) > 0 || true) {
        double dx = dragEnd.getX() - dragBegin.getX();
        double dy = dragEnd.getY() - dragBegin.getY();

        synchronized (JImage.this) {
          t.preConcatenate(AffineTransform.getTranslateInstance(dx, dy));
        }

        dragBegin = dragEnd;
        repaint();
      }
    }
    private void adjustFocusAndSelection(MouseEvent e) {
      if (shouldIgnore(e)) {
        return;
      }

      Point p = e.getPoint();
      int row = grid.rowAtPoint(p);
      int column = grid.columnAtPoint(p);

      // The autoscroller can generate drag events outside range.
      if ((column == -1) || (row == -1)) {
        System.err.println("Out of bounds");
        return;
      }

      if (grid.editCellAt(row, column, e)) {
        setDispatchComponent(e);
        repostEvent(e);
      } else {
        grid.requestFocus();
      }

      GridCellEditor editor = grid.getCurrentCellEditor();
      if (editor == null || editor.shouldSelectCell(e)) {
        // Update selection model
        setValueIsAdjusting(true);
        grid.changeSelection(row, column, e.isControlDown(), e.isShiftDown());
      }
    }
    public void mouseClicked(MouseEvent ev) {
      Window w = (Window) ev.getSource();
      Frame f = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else {
        return;
      }

      Point convertedPoint = SwingUtilities.convertPoint(w, ev.getPoint(), getTitlePane());

      int state = f.getExtendedState();
      if (getTitlePane() != null && getTitlePane().contains(convertedPoint)) {
        if ((ev.getClickCount() % 2) == 0 && ((ev.getModifiers() & InputEvent.BUTTON1_MASK) != 0)) {
          if (f.isResizable()) {
            if ((state & Frame.MAXIMIZED_BOTH) != 0) {
              f.setExtendedState(state & ~Frame.MAXIMIZED_BOTH);
            } else {
              f.setExtendedState(state | Frame.MAXIMIZED_BOTH);
            }
            return;
          }
        }
      }
    }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   FinderTableModel model = getDataModel();
   ICFSecurityISOTimezoneObj o =
       (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o);
   ((ICFSecuritySwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   PickerTableModel model = getDataModel();
   ICFInternetISOCountryObj o =
       (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER);
   invokeWhenChosen.choseISOCountry(o);
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
Exemple #11
0
 public void mouseDragged(MouseEvent e) {
   if (ltool.isEnabled()) {
     // System.out.println("LinkTool.ComponentListener::mouseDragged");
     // translate point to real coordinates since point is in relation to the source component
     setIntermediate(
         e.getPoint(), ((ONLComponentButton) e.getSource()).getONLComponent().getGraphic());
   }
 }
    public void mousePressed(MouseEvent e) {
      if (e.getClickCount() == 2) {
        JList list = (JList) e.getSource();
        int index = list.locationToIndex(e.getPoint());

        optionPane.setInputValue(list.getModel().getElementAt(index));
      }
    }
    public void mouseClicked(MouseEvent e) {
      int selRow = tree.getRowForLocation(e.getX(), e.getY());
      TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());

      if (e.getClickCount() == 2) {
        myDoubleClick(selRow, selPath);
      }
    }
 /**
  * Handles mouse moved events.
  *
  * @param e the mouse event
  */
 public void mouseMoved(MouseEvent e) {
   TreePath path = tree.getPathForLocation(e.getX(), e.getY());
   if (path == null) return;
   if (e.getX() > tree.getPathBounds(path).x + hotspot - 3
       || e.getX() < tree.getPathBounds(path).x + 2) tree.setCursor(Cursor.getDefaultCursor());
   else {
     tree.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   }
 }
Exemple #15
0
    public void mouseReleased(MouseEvent e) {
      int mods = e.getModifiersEx();

      if (nodrag && e.getButton() == MouseEvent.BUTTON3) {
        popupMenu.show(JImage.this, (int) e.getPoint().getX(), (int) e.getPoint().getY());
      }

      nodrag = true;
      dragBegin = null;
    }
  private void updateRolloverColumn(MouseEvent e) {
    if (header.getDraggedColumn() == null && header.contains(e.getPoint())) {

      int col = header.columnAtPoint(e.getPoint());
      if (col != rolloverColumn) {
        rolloverColumn = col;
        header.repaint();
      }
    }
  }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   ListTableModel model = getDataModel();
   ICFInternetVersionObj o = (ICFInternetVersionObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = null;
   String classCode = o.getClassCode();
   if (classCode.equals("VERN")) {
     frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MJVR")) {
     frame =
         swingSchema
             .getMajorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMajorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MNVR")) {
     frame =
         swingSchema
             .getMinorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMinorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else {
     frame = null;
   }
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
  public void mouseExited(MouseEvent e) {
    // if the popup menu for is visible, don't register this,
    // because the popup being set visible will fire a mouseExited() event
    if ((popup != null) && popup.isVisible()) return;

    if (state[OPEN] != INACTIVE) {
      setState(OPEN, INACTIVE, true);
    }
    status = "";
    handleMouse(e.getX(), e.getY());
  }
    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());
      }
    }
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     JTable table = (JTable) e.getSource();
     ListTableModel<PatientModel> tableModel = getTableModel();
     PatientModel value = (PatientModel) tableModel.getObject(table.getSelectedRow());
     if (value != null) {
       openKarte();
     }
   }
 }
  public void mouseMoved(MouseEvent e) {
    // mouse events before paint();
    if (state == null) return;

    if (state[OPEN] != INACTIVE) {
      // avoid flicker, since there will probably be an update event
      setState(OPEN, INACTIVE, false);
    }
    // System.out.println(e);
    // mouseMove(e);
    handleMouse(e.getX(), e.getY());
  }
Exemple #22
0
 /**
  * Allow to close the editor with a middle click on his tab.
  *
  * @param e The event.
  */
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getButton() == MouseEvent.BUTTON2 && countEditors() > 0) {
     Point clic = e.getPoint();
     int idx = indexAtLocation(clic.x, clic.y);
     if (idx != -1) {
       // Middle click on a tab was clicked: close it.
       AbstractEditorPanel editor = (AbstractEditorPanel) getComponentAt(idx);
       removeEditor(editor, true);
     }
   }
 }
  protected void internalDoubleClick(MouseEvent e) {
    if (!(e.getComponent() instanceof JComponent)) return;
    JComponent inComponent = (JComponent) e.getComponent();

    if (inComponent instanceof JTable) {
      JTable thisTable = (JTable) inComponent;
      int rowPoint = thisTable.rowAtPoint(new Point(e.getX(), e.getY()));
      Searcher whichSearch = (Searcher) thisTable.getValueAt(rowPoint, -1);

      whichSearch.execute();
    }
  }
Exemple #24
0
 public void mousePressed(MouseEvent e) {
   if (ctx != null) {
     // save the current selection set operator
     prevSetOp = ctx.getSetOperator(tm).getSetOperator();
     // set the selection set operator
     ctx.getSetOperator(tm).setFromInputEventMask(e.getModifiers());
   }
   start = e.getPoint();
   current = e.getPoint();
   selecting = true;
   repaint();
 }
    public void mousePressed(MouseEvent e) {
      if (e == null || e.isConsumed()) {
        return;
      }

      if (!this.isEnabled()) {
        return;
      }

      if (e.getButton() == MouseEvent.BUTTON1) {
        this.handleSelect();
      }
    }
Exemple #26
0
  public void mousePressed(MouseEvent e) {
    
    // jdf
    if (!isEnabled())
      return;
    
    final int x = e.getX();
    final int y = e.getY();

    int sel = findSelection(x, y);
    ///if (sel == -1) return false;
    if (sel == -1) return;
    currentRollover = -1;

    switch (sel) {
    case RUN:
      editor.handleRun(e.isShiftDown());
      break;

//    case STOP:
//      editor.handleStop();
//      break;
//
    case OPEN:
      popup = menu.getPopupMenu();
      popup.show(EditorToolbar.this, x, y);
      break;

    case NEW:
      if (shiftPressed) {
        editor.base.handleNew();
      } else {
      editor.base.handleNewReplace();
      }
      break;

    case SAVE:
      editor.handleSave(false);
      break;

    case EXPORT:
      boolean t = e.isControlDown();
      editor.handleExport(e.isShiftDown(),autoOpenSerialMonitor ? !t : t); // Control is down if autoOpenSerialMonitor is true in preferences
      break;

    case SERIAL:
      editor.handleSerial();
      handleMouse(e);
      break;
    }
  }
 @Override
 public void mousePressed(MouseEvent e) {
   Object o = e.getSource();
   if (o instanceof TableCellEditor) {
     actionPerformed(null);
   } else if (o instanceof JButton) {
     // DEBUG: view button click -> control key down + edit button(same cell) press -> remain
     // selection color
     ButtonModel m = ((JButton) e.getComponent()).getModel();
     if (m.isPressed() && table.isRowSelected(table.getEditingRow()) && e.isControlDown()) {
       setBackground(table.getBackground());
     }
   }
 }
Exemple #28
0
 public void mousePressed(MouseEvent e) {
   if (ltool.isEnabled()) {
     startComponent = ((ONLComponentButton) e.getSource()).getONLComponent();
     if (startComponent instanceof GigEDescriptor) {
       ExpCoordinator.print(
           new String(
               "LinkTool.ComponentListener.mousePressed gige startComponent:"
                   + startComponent.getLabel()),
           TEST_GIGE);
       startComponent = ((GigEDescriptor) startComponent).getUnlinkedPort();
       if (startComponent != null)
         ExpCoordinator.print(
             new String("  unlinked port: " + startComponent.getLabel()), TEST_GIGE);
       else ExpCoordinator.print("  unlinked port: null", TEST_GIGE);
     }
     if (startComponent instanceof HardwareHost)
       startComponent = ((HardwareHost) startComponent).getPort(0);
     endComponent = null;
     if (startComponent.isLinkable() && (!startComponent.isLinked())) {
       LinkDescriptor ld =
           ltool.createLinkDescriptor(
               startComponent); // new LinkDescriptor(ltool.getNextLabel(), startComponent,
                                // ltool.currentBW, ltool.expCoordinator);
       linkGraphic = (LinkGraphic) ld.getGraphic();
       if (linkGraphic.getONLComponent() == null)
         ExpCoordinator.print("LinkTool.ComponentListener::mousePressed onlcomp == null", 2);
       // linkGraphic = new LinkGraphic();
       // linkGraphic.setPoint1(startComponent.getGraphic());
       linkGraphic.setVisible(true);
       ltool
           .getTopologyPanel()
           .addLink(linkGraphic); // expCoordinator.getMainWindow().getTopologyPanel()
       // System.out.println("LinkTool.ComponentListener::mousePressed component " +
       // startComponent.getLabel());
       setIntermediate(
           e.getPoint(), ((ONLComponentButton) e.getSource()).getONLComponent().getGraphic());
     } else {
       ExpCoordinator.print(
           new String(
               "LinkTool::mousePressed startComponent "
                   + startComponent.getLabel()
                   + " is Linked"),
           2);
       startComponent = null;
       ltool.setEnabled(false);
     }
   }
 }
Exemple #29
0
 public void mouseReleased(MouseEvent e) {
   current = e.getPoint();
   // intersect with graph
   Rectangle selrect =
       new Rectangle(start.x, start.y, current.x - start.x, current.y - start.y);
   int[] gi = gs.getIndicesAt(selrect, graph.getXAxis(), graph.getYAxis());
   DefaultListSelectionModel rsm = new DefaultListSelectionModel();
   if (gi != null) {
     rsm.setValueIsAdjusting(true);
     for (int j = 0; j < gi.length; j++) {
       // find node and select segs for node and all descendents
       int nodeidx = gi[j] / 2;
       TreeNode tn = nodemap[nodeidx];
       selectTraverse(tn, rsm);
     }
     rsm.setValueIsAdjusting(false);
   }
   if (ctx != null) {
     // Merge this selection with the table selection list
     // using the current set selection operator
     ColumnMap cmap = ctx.getColumnMap(tm, 0);
     if (cmap != null) {
       cmap.selectValues(rsm);
     }
   }
   if (ctx != null) {
     // restore the original selection set operator
     ctx.getSetOperator(tm).setSetOperator(prevSetOp);
   }
   repaint();
 }
    @Override
    public void mouseReleased(MouseEvent evt) {
      if (evt.getClickCount() % 2 != 0 && !GUIUtilities.isMiddleButton(evt.getModifiers())) return;

      int row = parentDirectories.locationToIndex(evt.getPoint());
      if (row != -1) {
        Object obj = parentDirectories.getModel().getElementAt(row);
        if (obj instanceof VFSFile) {
          VFSFile dirEntry = (VFSFile) obj;
          if (!GUIUtilities.isPopupTrigger(evt)) {
            browser.setDirectory(dirEntry.getPath());
            if (browser.getMode() == VFSBrowser.BROWSER) focusOnFileView();
          }
        }
      }
    }