示例#1
0
 private void showCorrectPopup(Edge edge, MouseEvent arg0) {
   if (edge != null) {
     targetEdge = edge;
     edgeMenu.show(arg0.getComponent(), arg0.getX(), arg0.getY());
   } else {
     mouseX = arg0.getX();
     mouseY = arg0.getY();
     popupMenu.show(arg0.getComponent(), arg0.getX(), arg0.getY());
   }
 }
示例#2
0
  /** Show the status popup menu over this status button */
  private void showStatusMenu() {
    if (statusMenu.isVisible()) {
      return;
    }
    currentParent = StatusButton.this;
    txtStatus.setText(message);

    if (heightInvalid) {
      statusMenu.show(currentParent, 0, 0);
      statusMenu.setVisible(false);
      heightInvalid = false;
    }
    statusMenu.show(currentParent, 0, 0 - statusMenu.getHeight());
  }
  public void afficherPopupCogniton(MouseEvent e, GCogniton c) {

    popupGCognitons = new JPopupMenu("Cogniton");
    JMenuItem editerCogniton = new JMenuItem("Editer le Cogniton");
    editerCogniton.addActionListener(new ActionsMenuGCogniton(c, 0));
    editerCogniton.setIcon(new ImageIcon(this.getClass().getResource("../icones/pencil.png")));
    popupGCognitons.add(editerCogniton);
    JMenuItem editerInfluences = new JMenuItem("Editer les liens d'influence");
    editerInfluences.addActionListener(new ActionsMenuGCogniton(c, 1));
    editerInfluences.setIcon(new ImageIcon(this.getClass().getResource("../icones/arrow-out.png")));
    popupGCognitons.add(editerInfluences);
    JMenuItem editerConditions = new JMenuItem("Editer les liens conditionnels");
    editerConditions.addActionListener(new ActionsMenuGCogniton(c, 2));
    editerConditions.setIcon(
        new ImageIcon(this.getClass().getResource("../icones/lock--arrow.png")));
    popupGCognitons.add(editerConditions);
    JMenuItem editTriggeringAttributes = new JMenuItem("Edit triggering attributes");
    editTriggeringAttributes.addActionListener(new ActionsMenuGCogniton(c, 3));
    editTriggeringAttributes.setIcon(
        new ImageIcon(this.getClass().getResource("../icones/lock--arrow.png")));
    popupGCognitons.add(editTriggeringAttributes);
    JMenuItem editerChaine = new JMenuItem("Editer les liens inter-cognitons");
    editerChaine.setIcon(new ImageIcon(this.getClass().getResource("../icones/arrow-in-out.png")));
    popupGCognitons.add(editerChaine);
    JMenuItem supprimerCogniton = new JMenuItem("Supprimer");
    supprimerCogniton.setIcon(new ImageIcon(this.getClass().getResource("../icones/cross.png")));
    popupGCognitons.add(supprimerCogniton);
    popupGCognitons.show(this, (int) c.getXx() + e.getX(), (int) c.getYy() + e.getY());
  }
示例#4
0
 private void handleRightClick(MouseEvent e) {
   this.mouseExited(null);
   JPopupMenu menu =
       ContextMenuConstructor.getInstance()
           .getContextMenu(this, "mart", this.getSelectedComponents().size() > 1);
   menu.show(e.getComponent(), e.getX(), e.getY());
 }
  public void eventDispatched(AWTEvent event) {
    if (!isAssertTrigger(event)) {
      return;
    }

    MouseEvent mouse = (MouseEvent) event;

    GuiComponent guiComponent = factory.find(mouse);

    if (guiComponent == null) {
      return;
    }

    assertContext.setGuiComponent(guiComponent);
    assertContext.setPoint(mouse.getPoint());

    JPopupMenu menu = dialogManager.newPopupMenu();

    for (Iterator iterator = actionManager.actions(); iterator.hasNext(); ) {
      AbstractAssert assertAction = (AbstractAssert) iterator.next();
      String actionId = (String) assertAction.getValue(AbstractAssert.ACTION_ID);

      ActionViewUtil.connectActionTo(assertAction, menu.add(actionId));
      assertAction.update();

      if (!guiComponent.isFindable()
          && AbstractAssert.COMPONENT_ASSERT == assertAction.getAssertType()) {
        assertAction.setEnabled(false);
      }
    }

    menu.setBorder(BorderFactory.createLineBorder(Color.blue, 5));
    menu.show(guiComponent.getSwingComponent(), mouse.getX(), mouse.getY());
  }
示例#6
0
  // If the user double clicks on a stock with the LMB, graph the stock.
  // If the user right clicks over the table, open up a popup menu.
  private void handleMouseClicked(MouseEvent event) {

    Point point = event.getPoint();

    // Right click on the table - raise menu
    if (event.getButton() == MouseEvent.BUTTON3) {
      JPopupMenu menu = new JPopupMenu();

      popupGraphSymbols = MenuHelper.addMenuItem(this, menu, Locale.getString("GRAPH"));
      popupGraphSymbols.setEnabled(getSelectedRowCount() > 0);

      popupTableSymbols = MenuHelper.addMenuItem(this, menu, Locale.getString("TABLE"));
      popupTableSymbols.setEnabled(getSelectedRowCount() > 0);

      menu.show(this, point.x, point.y);
    }

    // Left double click on the table - graph stock
    else if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) {
      int[] selectedRows = getSelectedRows();
      List symbols = new ArrayList();
      for (int i = 0; i < selectedRows.length; i++) {
        Symbol symbol = (Symbol) model.getValueAt(selectedRows[i], EODQuoteModel.SYMBOL_COLUMN);

        symbols.add(symbol);
      }

      // Graph the highlighted symbols
      CommandManager.getInstance().graphStockBySymbol(symbols);
    }
  }
示例#7
0
  public void actionPerformed(ActionEvent e) {

    if (e.getSource() instanceof JButton) {
      JButton b = (JButton) e.getSource();
      if (b == robotButton) {
        // show popup menu for selecting robots
        robotMenu.show(b, b.getWidth(), 0);
      } else {
        if (!typeMap.containsKey(b))
          // error?
          return;
        // retrieve the type of data selected
        retrieveType(typeMap.get(b));
      }
    } else if (e.getSource() instanceof JMenuItem) {
      JMenuItem m = (JMenuItem) e.getSource();
      if (!robotMap.containsKey(m))
        // error?
        return;
      // select the given robot for future data retrievals
      selectedRobot = robotMap.get(m);
      robotButton.setText(selectedRobot.name());
      robotMenu.setVisible(false);
    }
  }
    /**
     * If the user has signalled the opening of a context menu, the event gets redirected to this
     * method. Here we open a file link menu if the user is pointing at a file link icon. Otherwise
     * a general context menu should be shown.
     *
     * @param e The triggering mouse event.
     */
    public void processPopupTrigger(MouseEvent e) {
      BibtexEntry entry = sortedEntries.get(entryTable.rowAtPoint(e.getPoint()));
      BasePanel p = entryHome.get(entry);
      int col = entryTable.columnAtPoint(e.getPoint());
      JPopupMenu menu = new JPopupMenu();
      int count = 0;

      if (col == FILE_COL) {
        // We use a FileListTableModel to parse the field content:
        Object o = entry.getField(GUIGlobals.FILE_FIELD);
        FileListTableModel fileList = new FileListTableModel();
        fileList.setContent((String) o);
        // If there are one or more links, open the first one:
        for (int i = 0; i < fileList.getRowCount(); i++) {
          FileListEntry flEntry = fileList.getEntry(i);
          String description = flEntry.getDescription();
          if ((description == null) || (description.trim().length() == 0))
            description = flEntry.getLink();
          menu.add(
              new ExternalFileMenuItem(
                  p.frame(),
                  entry,
                  description,
                  flEntry.getLink(),
                  flEntry.getType().getIcon(),
                  p.metaData(),
                  flEntry.getType()));
          count++;
        }
      }

      if (count > 0) menu.show(entryTable, e.getX(), e.getY());
    }
示例#9
0
  private void jtableMouseReleased(java.awt.event.MouseEvent evt) {
    if (!evt.isPopupTrigger()) return;
    boolean autoSeleced = false;
    try {
      autoSeleced = DD.getAppBoolean(DD.AUTOMATIC_TESTERS_RATING_BY_SYSTEM);
    } catch (P2PDDSQLException e) {
      e.printStackTrace();
    }
    if (autoSeleced) {
      Application_GUI.warning(
          "you need to select manual rating mode to use this option", "Manual Rating");
      return;
    }
    int row; // =this.getSelectedRow();
    int col; // =this.getSelectedColumn();

    // if ( !SwingUtilities.isLeftMouseButton( evt )) return;
    Point point = evt.getPoint();
    row = this.rowAtPoint(point);
    col = this.columnAtPoint(point);
    this.getSelectionModel().setSelectionInterval(row, row);
    if (row >= 0) row = this.convertRowIndexToModel(row);
    JPopupMenu popup = getPopup(row, col);
    if (popup == null) return;
    popup.show((Component) evt.getSource(), evt.getX(), evt.getY());
    //	getModel().update(null, null);
  }
示例#10
0
 /**
  * Statische Funktion welche das Popup f�r den Tabellenkopf erstellt und anzeigt.
  *
  * @param table Die Tabelle zu welcher das Popup geh�rt.
  * @param ctrl Ben�tigte Referenz zum GUI Controller
  * @param e Das MouseEvent welches das Popup �ffnet
  */
 public static void createTableHeaderPopup(JTable table, ViewController ctrl, MouseEvent e) {
   createColumnCheckBoxes(ctrl);
   if (menuPopUp != null) {
     menuPopUp.setVisible(false);
   }
   menuPopUp = new JPopupMenu();
   JMenu m_columns = new JMenu("Columns"); // $NON-NLS-1$
   JMenuItem mi_hide = new JMenuItem(Messages.getString("PopUpMenu.1")); // $NON-NLS-1$
   JMenuItem mi_showALL = new JMenuItem(Messages.getString("PopUpMenu.2")); // $NON-NLS-1$
   selectedColumn =
       ctrl.getTable(ctrl.getSelectedTab()).getColumnModel().getColumnIndexAtX(e.getX());
   if (ctrl.getUserInputData().getOriginalIndex(selectedColumn, ctrl.getSelectedTab()) == 0
       || ctrl.getUserInputData().getOriginalIndex(selectedColumn, ctrl.getSelectedTab()) == 1) {
     mi_hide.setEnabled(false);
   }
   mi_hide.addActionListener(ctrl);
   mi_hide.setActionCommand("hide"); // $NON-NLS-1$
   mi_showALL.addActionListener(ctrl);
   mi_showALL.setActionCommand("showall"); // $NON-NLS-1$
   menuPopUp.add(mi_hide);
   menuPopUp.add(m_columns);
   for (int x = 0; x < columns.length; x++) {
     m_columns.add(
         columns[ctrl.getUserInputData().getColumnOrder(ctrl.getSelectedTab()).get(x).intValue()]);
   }
   menuPopUp.add(mi_showALL);
   menuPopUp.show(table.getTableHeader(), e.getX(), e.getY());
 }
示例#11
0
 private void maybeShowGroupPopup(MouseEvent e, JIDStatusGroup jidStatusGroup) {
   if (e.isPopupTrigger()) {
     currentJIDStatusGroup = jidStatusGroup;
     currentGroup = jidStatusGroup.getName();
     groupPopupMenu.show(e.getComponent(), e.getX(), e.getY());
   }
 }
示例#12
0
文件: MapFrame.java 项目: rheinz/josm
    @Override
    public void actionPerformed(ActionEvent e) {
      JPopupMenu menu = new JPopupMenu();
      for (HideableButton b : buttons) {
        final HideableButton t = b;
        menu.add(
            new JCheckBoxMenuItem(
                new AbstractAction() {
                  {
                    putValue(NAME, t.getActionName());
                    putValue(SMALL_ICON, t.getIcon());
                    putValue(SELECTED_KEY, t.isButtonVisible());
                    putValue(SHORT_DESCRIPTION, tr("Hide or show this toggle button"));
                  }

                  @Override
                  public void actionPerformed(ActionEvent e) {
                    if ((Boolean) getValue(SELECTED_KEY)) {
                      t.showButton();
                    } else {
                      t.hideButton();
                    }
                    validateToolBarsVisibility();
                  }
                }));
      }
      Rectangle bounds = button.getBounds();
      menu.show(button, bounds.x + bounds.width, 0);
    }
示例#13
0
  // handle a right click on a file
  protected void handleRightClick(MouseEvent e, int selRow, TreePath selPath) {
    DefaultMutableTreeNode node = getTreeNode(selPath);
    FileNode fnode = getFileNode(node);
    if (fnode != null) {
      // default operates on files only
      final File file = fnode.getFile();
      if ((file != null) && file.isFile()) {
        JPopupMenu popupMenu = new JPopupMenu();
        popupMenu.setLightWeightPopupEnabled(false);

        ActionListener al =
            new ActionListener() {

              @Override
              public void actionPerformed(ActionEvent arg0) {
                notifyFileListeners(file.getPath());
              }
            };

        JMenuItem openItem = new JMenuItem("Open: " + file.getPath());
        openItem.addActionListener(al);
        popupMenu.add(openItem);

        popupMenu.show(this, e.getX(), e.getY());
      }

      // notifyFileListeners(fnode.getFile().getPath());
    }
  }
示例#14
0
  /**
   * Show a popup containing a list of all of the hidden tabs - selecting one will reveal that tab
   */
  private void showHiddenTabPopup() {
    JPopupMenu menu = new JPopupMenu();
    if (getMousePosition() == null) {
      // Startup
      return;
    }
    // Sort the list so the tabs are always in alphabetic order
    Collections.sort(
        this.removedTabList,
        new Comparator<Component>() {
          @Override
          public int compare(Component o1, Component o2) {
            return o1.getName().compareTo(o2.getName());
          }
        });

    for (Component c : this.removedTabList) {
      if (c instanceof AbstractPanel) {
        final AbstractPanel ap = (AbstractPanel) c;
        JMenuItem mi = new JMenuItem(ap.getName());
        mi.setIcon(ap.getIcon());
        mi.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                setVisible(ap, true);
                ap.setTabFocus();
              }
            });
        menu.add(mi);
      }
    }
    menu.show(this, this.getMousePosition().x, this.getMousePosition().y);
  }
 private void showColumnSelectionPopup(final JPopupMenu headerPopup, final JButton cornerButton) {
   initColumnSelectorItems();
   headerPopup.show(
       cornerButton,
       cornerButton.getWidth() - headerPopup.getPreferredSize().width,
       cornerButton.getHeight());
 }
  /**
   * Shows the PopUp
   *
   * @param e MouseEvent
   */
  protected void showPopUpMenu(MouseEvent e) {
    if (!(e.getSource() instanceof JList)) {
      return;
    }

    JList list = (JList) e.getSource();

    int i = list.locationToIndex(e.getPoint());
    list.setSelectedIndex(i);

    JPopupMenu menu = new JPopupMenu();

    Rating selRating = (Rating) list.getSelectedValue();

    JMenuItem item = new JMenuItem(mLocalizer.msg("showDetails", "Show Details"));
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            view();
          }
        });
    item.setFont(item.getFont().deriveFont(Font.BOLD));

    menu.add(item);
    menu.add(new ListAction(this, selRating.getTitle()));
    menu.add(new ShowDetailsAction(selRating.getRatingId()));

    menu.show(list, e.getX(), e.getY());
  }
示例#17
0
 private void showSliderActions(MouseEvent evt, final int sliderIndex) {
   final JPopupMenu menu = new JidePopupMenu();
   boolean showPopupMenu = false;
   JMenuItem menuItem;
   if (canChangeSliderCount()) {
     menuItem = createMenuItemAddNewSlider(sliderIndex, evt);
     if (menuItem != null) {
       menu.add(menuItem);
       showPopupMenu = true;
     }
     if (getSliderCount() > 2 && sliderIndex != INVALID_INDEX) {
       menuItem = createMenuItemDeleteSlider(sliderIndex);
       menu.add(menuItem);
       showPopupMenu = true;
     }
   }
   if (getSliderCount() > 2
       && sliderIndex > 0
       && sliderIndex < getSliderCount() - 1
       && isSliderEditable(sliderIndex)) {
     menuItem = createMenuItemCenterSampleValue(sliderIndex);
     menu.add(menuItem);
     menuItem = createMenuItemCenterColorValue(sliderIndex);
     menu.add(menuItem);
     showPopupMenu = true;
   }
   if (showPopupMenu) {
     menu.show(evt.getComponent(), evt.getX(), evt.getY());
   }
 }
  private void helpButtonActionPerformed(java.awt.event.ActionEvent evt) {
    JPopupMenu jp = new JPopupMenu();

    JMenuItem mi = new JMenuItem("Help"); // No i18n
    JPanel panel = new JPanel();

    String msgTxt =
        "<html>Drops redundant events/alerts. <br>The suppressed/dropped Events/alerts will not <br>be added to the database. <br>You can choose to suppress all events/alerts <br>or only those that occur after a <br>certain period of time. <br>Refer Admin Guide for details.</html>"; // No i18n

    /*JTextArea ep = new JTextArea();
    ep.setColumns(20);
    ep.setLineWrap(true);
    ep.setRows(10);
    ep.setBackground(new java.awt.Color(200, 200, 200));
    ep.setWrapStyleWord(true);*/
    JLabel ep = new JLabel();
    ep.setSize(300, 200);
    ep.setText(msgTxt);
    panel.add(ep);

    mi.setLayout(new BorderLayout());
    mi.setPreferredSize(panel.getPreferredSize());
    mi.setFocusPainted(false);
    mi.add(panel, BorderLayout.CENTER);
    jp.setLayout(new BorderLayout());
    jp.add(mi, BorderLayout.CENTER);
    jp.show(helpButton, -60, -60);
  }
  public void vPathwayEvent(VPathwayEvent e) {
    switch (e.getType()) {
      case ELEMENT_CLICKED_DOWN:
        if (e.getAffectedElement() instanceof Citation) {
          Citation c = (Citation) e.getAffectedElement();
          PathwayElementDialog d =
              swingEngine
                  .getPopupDialogHandler()
                  .getInstance(c.getParent().getPathwayElement(), false, null, null);
          d.selectPathwayElementPanel(PathwayElementDialog.TAB_LITERATURE);
          d.setVisible(true);
          break;
        }
      case ELEMENT_CLICKED_UP:
        assert (e.getVPathway() != null);
        assert (e.getVPathway().getWrapper() instanceof VPathwaySwing);

        if (e.getMouseEvent().isPopupTrigger()) {
          Component invoker = (VPathwaySwing) e.getVPathway().getWrapper();
          MouseEvent me = e.getMouseEvent();
          JPopupMenu m = getMenuInstance(swingEngine, e.getAffectedElement());
          if (m != null) {
            m.show(invoker, me.getX(), me.getY());
          }
        }
        break;
    }
  }
 private void doPopup(MouseEvent e) {
   // Check if there is any thing is selected
   boolean isSelected = false;
   if (changedList != null) {
     if (changedList.getSelection().size() > 0) isSelected = true;
   }
   if (!isSelected && newList != null) {
     if (newList.getSelection().size() > 0) isSelected = true;
   }
   if (!isSelected && deleteInDBList != null) {
     if (deleteInDBList.getSelection().size() > 0) isSelected = true;
   }
   if (!isSelected && deleteList != null)
     if (deleteList.getSelection().size() > 0) isSelected = true;
   if (!isSelected && localHasMoreIEList != null) {
     if (localHasMoreIEList.getSelection().size() > 0) isSelected = true;
   }
   if (!isSelected) return;
   JPopupMenu popup = new JPopupMenu();
   popup.add(updateFromDBAction);
   popup.add(commitToDBAction);
   popup.add(showComparisonAction);
   popup.add(clearRecordAction);
   JComponent comp = (JComponent) e.getSource();
   popup.show(comp, e.getX(), e.getY());
 }
示例#21
0
    public void actionPerformed(ActionEvent ae) {
      updatePanel();

      Message message = messagePanel.getMessage();
      if (message != null) {
        JTextPane textPane = messagePanel.getTextPane();
        int pos = textPane.getCaretPosition();
        Message.Element element = message.findElement(pos);
        if (logger.isInfoEnabled()) logger.info("Complete element {}.", element);

        boolean showPopup = false;
        if (element.getType() == Message.Element.Type.HashTag) {
          populateHashTags(element);
          showPopup = true;
        } else if (element.getType() == Message.Element.Type.Recipient) {
          populateRecipients(element);
          showPopup = true;
        }
        if (showPopup) {
          try {
            Rectangle viewPos = textPane.modelToView(pos);
            int x = viewPos.x;
            int y = viewPos.y + viewPos.height;

            popup.show(textPane, x, y);
          } catch (BadLocationException e) {
            e
                .printStackTrace(); // To change body of catch statement use File | Settings | File
                                    // Templates.
          }
        }
      }
    }
示例#22
0
文件: Tray.java 项目: Tyf0n/musique
    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) {
      }
    }
示例#23
0
    public void actionPerformed(ActionEvent e) {
      JTextField tf = getTextField();
      final String text = tf.getText();
      final int caretIndex = tf.getCaretPosition();
      String pre = text.substring(0, caretIndex);
      java.util.List<TreeNode> nodes = null; // m_root.search(pre);
      // Collections.sort(nodes);
      if (nodes.isEmpty()) {
        return;
      }

      JPopupMenu jp = new JPopupMenu("options");

      JMenuItem lastItem = null;
      for (TreeNode node : nodes) {
        String nodeName = node.toString();
        String insertion = nodeName.substring(leaf(pre, ".").length());
        lastItem = createInsertAction(nodeName, caretIndex, insertion);
        jp.add(lastItem);
      }
      if (nodes.size() == 0) {
        return;
      }
      if (nodes.size() == 1) {
        lastItem.getAction().actionPerformed(null);
      } else {
        Point pos = tf.getCaret().getMagicCaretPosition();
        pos = pos != null ? pos : new Point(2, 2);
        jp.show(tf, pos.x, pos.y);
      }
    }
示例#24
0
 private void mousePressedInIconsArea(MouseEvent e) {
   EditorMessageIconRenderer iconRenderer = getIconRendererUnderMouse(e);
   if (iconRenderer != null) {
     if (e.getButton() == MouseEvent.BUTTON3) {
       JPopupMenu popupMenu = iconRenderer.getPopupMenu();
       if (popupMenu != null && e.getID() == MouseEvent.MOUSE_PRESSED) {
         e.consume();
         Component component = e.getComponent();
         popupMenu.show(component == null ? myEditorComponent : component, e.getX(), e.getY());
       }
       return;
     }
     AnAction action = iconRenderer.getClickAction();
     if (e.getButton() == MouseEvent.BUTTON1 && action != null) {
       if (e.getID() == MouseEvent.MOUSE_CLICKED) {
         AnActionEvent actionEvent =
             new AnActionEvent(
                 e,
                 new LeftEditorHighlighterDataContext(myEditorComponent, iconRenderer.getNode()),
                 ICON_AREA,
                 action.getTemplatePresentation(),
                 ActionManager.getInstance(),
                 e.getModifiers());
         action.update(actionEvent);
         action.actionPerformed(actionEvent);
       }
       e.consume();
     }
   }
 }
  public static void showPopupMenu(
      final JPopupMenu popup, final Component component, int x, int y) {
    final Point p = new Point(x, y);
    SwingUtilities.convertPointToScreen(p, component);
    final Dimension size = popup.getPreferredSize();
    final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();

    boolean horiz = false;
    boolean vert = false;

    final int origX = x;

    if ((p.x + size.width > screen.width) && (size.width < screen.width)) {
      x += (screen.width - p.x - size.width);
      horiz = true;
    }

    if ((p.y + size.height > screen.height) && (size.height < screen.height)) {
      y += (screen.height - p.y - size.height);
      vert = true;
    }

    if (horiz && vert) {
      x = origX - size.width - 2;
    }
    popup.show(component, x, y);
  }
示例#26
0
  /** Shows popup with forward history entries */
  private void showForwardHistory(MouseEvent e) {

    JPopupMenu forwardMenu = new JPopupMenu("Forward History");

    if (historyModel == null) {
      return;
    }

    Locale locale = ((JHelp) getControl()).getModel().getHelpSet().getLocale();
    Enumeration items = historyModel.getForwardHistory().elements();
    JMenuItem mi = null;
    int index = historyModel.getIndex() + 1;
    // while(items.hasMoreElements()){
    for (int i = 0; items.hasMoreElements(); i++) {
      HelpModelEvent item = (HelpModelEvent) items.nextElement();
      if (item != null) {
        String title = item.getHistoryName();
        if (title == null) {
          title = HelpUtilities.getString(locale, "history.unknownTitle");
        }
        mi = new JMenuItem(title);
        // mi.setToolTipText(item.getURL().getPath());
        mi.addActionListener(new HistoryActionListener(i + index));
        forwardMenu.add(mi);
      }
    }
    // if(e.isPopupTrigger())
    forwardMenu.show(e.getComponent(), e.getX(), e.getY());
  }
  private void maybeShowPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {
      _mnuAllFilteredSelectedOrder.setEnabled(_modeManager.getMode().isQueryBuilder());

      _popUp.show(e.getComponent(), e.getX(), e.getY());
    }
  }
示例#28
0
 // this is bordering on comical its so confusing.
 // this method runs for the hubnet client editor.
 // im not yet sure if it runs anywhere else.
 // that seems like bugs waiting to happen. JC - 12/20/10
 protected void doPopup(java.awt.event.MouseEvent e) {
   javax.swing.JPopupMenu menu = new javax.swing.JPopupMenu();
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.button"), "BUTTON", e.getX(), e.getY()));
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.slider"), "SLIDER", e.getX(), e.getY()));
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.switch"), "SWITCH", e.getX(), e.getY()));
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.chooser"), "CHOOSER", e.getX(), e.getY()));
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.input"), "INPUT", e.getX(), e.getY()));
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.monitor"), "MONITOR", e.getX(), e.getY()));
   WidgetCreationMenuItem plot =
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.plot"), "PLOT", e.getX(), e.getY());
   // if there are no plots in this model, then you can't have a plot in a hubnet client.
   if (workspace.plotManager().plots().size() == 0) {
     plot.setEnabled(false);
   }
   menu.add(plot);
   menu.add(
       new WidgetCreationMenuItem(
           I18N.guiJ().get("tabs.run.widgets.note"), "NOTE", e.getX(), e.getY()));
   menu.show(this, e.getX(), e.getY());
 }
示例#29
0
 private void showPopup(MouseEvent e) {
   if (e.isPopupTrigger()
       && (e.getModifiers() & (MouseEvent.SHIFT_MASK | MouseEvent.CTRL_MASK)) == 0) {
     //      popupNode = getNodeAt(e.getX(), e.getY());
     //      nodeItem.setEnabled(popupNode != null);
     popupMenu.show(this, e.getX(), e.getY());
   }
 }
 public void show(Component invoker, int x, int y) {
   if (invoker != null) {
     y += invoker.getHeight(); // add the height of the invoker to
     // locate the popup at the bottom of
     // this invoker
   }
   super.show(invoker, x, y);
 }