Exemplo n.º 1
0
  /** Intialize me */
  private void init() {
    myTables = new ArrayList();
    tableTabbedPane = new JTabbedPane();
    tableTabbedPane.setPreferredSize(new Dimension(450, 200));
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    fileMenu.add(GuiUtils.makeMenuItem("New Row", this, "addNewRow"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Open", this, "doOpen"));
    fileMenu.add(GuiUtils.makeMenuItem("Import", this, "doImport"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Export to File", this, "doSaveAs"));
    fileMenu.add(GuiUtils.makeMenuItem("Export to Plugin", this, "exportToPlugin"));
    fileMenu.add(
        GuiUtils.makeMenuItem("Export Selected to Plugin", this, "exportSelectedToPlugin"));
    fileMenu.addSeparator();
    fileMenu.add(GuiUtils.makeMenuItem("Close", this, "doClose"));

    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    helpMenu.add(GuiUtils.makeMenuItem("Parameter Defaults Help", this, "showHelp"));
    JComponent bottom = GuiUtils.wrap(GuiUtils.makeButton("Close", this, "doClose"));
    contents = GuiUtils.topCenterBottom(menuBar, GuiUtils.inset(tableTabbedPane, 2), bottom);
    setMenuBar(menuBar);
    loadResources(resources);
  }
Exemplo n.º 2
0
  /**
   * initialize the symbols menu
   *
   * @param m menu
   */
  public void initSymbolsMenu(JMenu m) {
    m.removeAll();
    for (int i = 0; i < glyphs.size(); i++) {
      final MetSymbol metSymbol = (MetSymbol) glyphs.get(i);
      JMenuItem mi = GuiUtils.makeMenuItem(metSymbol.getLabel(), this, "showProperties", metSymbol);
      mi.addMouseListener(
          new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
              highlightedMetSymbol = null;
              StationModelCanvas.this.repaint();
            }

            public void mouseReleased(MouseEvent e) {
              highlightedMetSymbol = null;
              StationModelCanvas.this.repaint();
            }

            public void mouseEntered(MouseEvent e) {
              highlightedMetSymbol = metSymbol;
              StationModelCanvas.this.repaint();
            }

            public void mouseExited(MouseEvent e) {
              highlightedMetSymbol = null;
              StationModelCanvas.this.repaint();
            }
          });
      m.add(mi);
    }
  }
Exemplo n.º 3
0
 /**
  * Make the edit menu
  *
  * @param editMenu edit menu
  * @return edit menu
  */
 public JMenu makeEditMenu(JMenu editMenu) {
   editMenu.add(GuiUtils.makeDynamicMenu("Symbols", this, "initSymbolsMenu"));
   editMenu.add(
       GuiUtils.makeMenuItem("Set properties on selected", this, "setPropertiesOnSelected"));
   editMenu.addSeparator();
   return super.makeEditMenu(editMenu);
 }
Exemplo n.º 4
0
    /**
     * Make the edit menu
     *
     * @param popup The popup
     * @param row The row
     */
    void makeEditableMenu(JPopupMenu popup, final int row) {

      JMenuItem mi;
      popup.add(GuiUtils.makeMenuItem("Add New Field", this, "addNewRow"));
      ParamInfo paramInfo = getInfo(row);
      if (paramInfo == null) {
        return;
      }

      popup.add(GuiUtils.makeMenuItem("Edit Settings", this, "editRow", paramInfo));

      mi = new JMenuItem("Delete Settings For Parameter");
      mi.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              removeRow(row);
            }
          });
      popup.add(mi);
    }
Exemplo n.º 5
0
 /**
  * SHow the popup menu
  *
  * @param where component to show near to
  * @param x x
  * @param y y
  */
 public void showPopup(JComponent where, int x, int y) {
   List items = new ArrayList();
   getPopupMenuItems(items);
   items.add(GuiUtils.MENU_SEPARATOR);
   items.add(GuiUtils.makeMenuItem("Properties...", this, "showProperties"));
   //        addGroupMenuItems(items);
   if (items.size() == 0) {
     return;
   }
   GuiUtils.makePopupMenu(items).show(where, x, y);
 }
Exemplo n.º 6
0
  protected void getSaveMenuItems(List items, boolean forMenuBar) {
    super.getSaveMenuItems(items, forMenuBar);

    // DAVEP: Remove the parameter set save options for now...
    //        items.add(GuiUtils.makeMenuItem("Save Image Parameter Set (TEST)", this,
    //        "popupPersistImageParameters"));
    //
    //        items.add(GuiUtils.makeMenuItem("Save Image Parameter Set", this,
    //        "popupSaveImageParameters"));

    items.add(GuiUtils.makeMenuItem("Save As Local Data Source", this, "saveDataToLocalDisk"));
  }
Exemplo n.º 7
0
 /**
  * Make the popup menu
  *
  * @param popup The popup menu
  * @param row The row the user clicked on
  */
 void makePopupMenu(JPopupMenu popup, final int row) {
   ParamInfo info = getInfo(row);
   if (isEditable) {
     makeEditableMenu(popup, row);
   } else {
     JMenuItem mi = new JMenuItem("Copy Row to Users Defaults");
     mi.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent ae) {
             try {
               copyToUsers(getInfo(row));
             } catch (Exception exc) {
               LogUtil.printException(log_, "Copying row: " + row + " to users table.", exc);
             }
           }
         });
     popup.add(mi);
   }
   if (info != null) {
     popup.add(
         GuiUtils.makeMenuItem(
             "Export to Plugin", getIdv().getPluginManager(), "addObject", info));
   }
 }
Exemplo n.º 8
0
 /**
  * Get the menu items for the popup menu
  *
  * @param items List of items to add to
  * @return The items list
  */
 protected List getPopupMenuItems(List items) {
   items.add(GuiUtils.makeMenuItem("Remove " + getTypeName(), this, "removeDisplayComponent"));
   return items;
 }