/**
   * @param nodeView The clicked NodeView
   * @param menu popup menu to add the Bypass menu
   */
  public void addNodeContextMenuItems(NodeView nodeView, JPopupMenu menu) {
    NodeBypass nb = new NodeBypass();

    if (menu == null) menu = new JPopupMenu();

    /*
     * Add Node ID as label.
     */
    final String nodeID = nodeView.getNode().getIdentifier();
    final JLabel nodeLabel = new JLabel(nodeID);

    nodeLabel.setForeground(new Color(10, 50, 250, 150));
    nodeLabel.setFont(new Font("SansSerif", Font.BOLD, 18));
    nodeLabel.setBorder(new EmptyBorder(5, 10, 5, 5));
    menu.add(nodeLabel);

    menu.add(nb.addMenu(nodeView.getNode()));
  }
Example #2
0
  /**
   * Constructs the popup menu that will be injected into the popup menu of the node
   *
   * @param nodeView the node view that was clicked on in the graph view
   */
  protected JMenu getPopupMenu(NodeView nodeView) {
    /* Get a handle to the control panel. If the control panel is not shown yet,
     * we don't put anything in the context menu */
    ControlPanel panel = ControlPanel.getShownInstance();
    if (panel == null) return null;

    JMenu menu = new JMenu(ClusterONE.applicationName);
    menu.add(new GrowClusterAction(nodeView.getNode()));
    menu.add(GrowClusterAction.getGlobalInstance());

    return menu;
  }