示例#1
0
 /** Unconfigures a JCheckBoxMenuItem for an Action. */
 public static void unconfigureJCheckBoxMenuItem(JCheckBoxMenuItem mi, Action a) {
   /*PropertyChangeListener propertyHandler = (PropertyChangeListener) mi.getClientProperty("actionPropertyHandler");
   if (propertyHandler != null) {
       a.removePropertyChangeListener(propertyHandler);
   mi.putClientProperty("actionPropertyHandler", null);
   }*/
   mi.setAction(null);
 }
示例#2
0
 private JCheckBoxMenuItem getChckbxmntmShowInlinePhotos() {
   if (chckbxmntmShowInlinePhotos == null) {
     chckbxmntmShowInlinePhotos = new JCheckBoxMenuItem();
     chckbxmntmShowInlinePhotos.setSelected(true);
     chckbxmntmShowInlinePhotos.setAction(new ToggleInlinePhotoEnabled(picodeMain));
   }
   return chckbxmntmShowInlinePhotos;
 }
示例#3
0
    public TimelimitTasksPopupMenu(final TimelimitTaskView taskview) {
      this.add(miPerform);
      this.add(miRemove);
      this.add(miFinish);

      miPerform.setAction(actPerformTask);
      miFinish.setAction(actFinishTask);
      miRemove.setAction(actRemoveTask);
    }
示例#4
0
 /** Configures a JCheckBoxMenuItem for an Action. */
 public static void configureJCheckBoxMenuItem(final JCheckBoxMenuItem mi, final Action a) {
   /*mi.setSelected((Boolean) a.getValue(ActionUtil.SELECTED_KEY));
   PropertyChangeListener propertyHandler = new PropertyChangeListener() {
       public void propertyChange(PropertyChangeEvent evt) {
           if (evt.getPropertyName().equals(ActionUtil.SELECTED_KEY)) {
               mi.setSelected((Boolean) a.getValue(ActionUtil.SELECTED_KEY));
           }
       }
   };
   a.addPropertyChangeListener(propertyHandler);
   mi.putClientProperty("actionPropertyHandler", propertyHandler);
   */
   mi.setAction(a);
 }
示例#5
0
  private JMenu createViewMenu() {

    List<JComponent> menuItems = new ArrayList<JComponent>();
    MenuAction menuAction = null;

    // Preferences
    menuAction =
        new MenuAction("Preferences...", null, KeyEvent.VK_P) {
          @Override
          public void actionPerformed(ActionEvent e) {
            UIUtilities.invokeOnEventThread(
                new Runnable() {
                  public void run() {
                    IGV.getInstance().doViewPreferences();
                  }
                });
          }
        };
    menuAction.setToolTipText(PREFERENCE_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction =
        new MenuAction("Color Legends ...", null, KeyEvent.VK_H) {
          @Override
          public void actionPerformed(ActionEvent e) {
            (new LegendDialog(IGV.getMainFrame())).setVisible(true);
          }
        };
    menuAction.setToolTipText(SHOW_HEATMAP_LEGEND_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuItems.add(new JSeparator());

    menuAction =
        new MenuAction("Show Name Panel", null, KeyEvent.VK_A) {
          @Override
          public void actionPerformed(ActionEvent e) {

            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) e.getSource();
            if (menuItem.isSelected()) {
              IGV.getInstance().getMainPanel().expandNamePanel();
            } else {
              IGV.getInstance().getMainPanel().collapseNamePanel();
            }
            IGV.getInstance().doRefresh();
          }
        };
    boolean isShowing = IGV.getInstance().getMainPanel().isExpanded();
    JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem();
    menuItem.setSelected(isShowing);
    menuItem.setAction(menuAction);
    menuItems.add(menuItem);

    JMenuItem panelWidthmenuItem = new JMenuItem();
    menuAction =
        new MenuAction("Set Name Panel Width...", null, KeyEvent.VK_A) {
          @Override
          public void actionPerformed(ActionEvent e) {
            MainPanel mainPanel = IGV.getInstance().getMainPanel();
            String currentValue = String.valueOf(mainPanel.getNamePanelWidth());
            String newValue =
                MessageUtils.showInputDialog("Enter track name panel width: ", currentValue);
            if (newValue != null) {
              try {
                Integer w = Integer.parseInt(newValue);
                if (w <= 0 || w == 1000) throw new NumberFormatException();
                PreferenceManager.getInstance().put(PreferenceManager.NAME_PANEL_WIDTH, newValue);
                mainPanel.setNamePanelWidth(w);
              } catch (NumberFormatException ex) {
                MessageUtils.showErrorMessage(
                    "Error: value must be a positive integer < 1000.", ex);
              }
            }
          }
        };
    panelWidthmenuItem.setAction(menuAction);
    menuItems.add(panelWidthmenuItem);

    // Hide or Show the attribute panels
    boolean isShow =
        PreferenceManager.getInstance().getAsBoolean(PreferenceManager.SHOW_ATTRIBUTE_VIEWS_KEY);
    IGV.getInstance().doShowAttributeDisplay(isShow); // <= WEIRD doing IGV.getInstance() here!

    menuAction =
        new MenuAction("Show Attribute Display", null, KeyEvent.VK_A) {
          @Override
          public void actionPerformed(ActionEvent e) {

            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) e.getSource();
            PreferenceManager.getInstance().setShowAttributeView(menuItem.getState());
            IGV.getInstance().getMainPanel().invalidate();
            IGV.getInstance().doRefresh();
          }
        };
    menuItem = MenuAndToolbarUtils.createMenuItem(menuAction, isShow);
    menuItems.add(menuItem);

    menuAction =
        new MenuAction("Select Attributes to Show...", null, KeyEvent.VK_S) {

          @Override
          public void actionPerformed(ActionEvent e) {
            IGV.getInstance().doSelectDisplayableAttribute();
          }
        };
    menuAction.setToolTipText(SELECT_DISPLAYABLE_ATTRIBUTES_TOOLTIP);
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction =
        new MenuAction("Show Header Panel", null, KeyEvent.VK_A) {
          @Override
          public void actionPerformed(ActionEvent e) {

            JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) e.getSource();
            if (menuItem.isSelected()) {
              IGV.getInstance().getMainPanel().restoreHeader();
            } else {
              IGV.getInstance().getMainPanel().removeHeader();
            }
            IGV.getInstance().doRefresh();
          }
        };
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction, true));

    menuItems.add(new JSeparator());
    menuAction =
        new MenuAction("Reorder Panels...", null, KeyEvent.VK_S) {

          @Override
          public void actionPerformed(ActionEvent e) {
            ReorderPanelsDialog dlg = new ReorderPanelsDialog(IGV.getMainFrame());
            dlg.setVisible(true);
          }
        };
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuItems.add(new JSeparator());
    menuItems.add(new HistoryMenu("Go to"));

    // Add to IGVPanel menu
    MenuAction dataMenuAction = new MenuAction("View", null, KeyEvent.VK_V);
    viewMenu = MenuAndToolbarUtils.createMenu(menuItems, dataMenuAction);
    return viewMenu;
  }
示例#6
0
  public static AMenuBar getJMenu() {
    AMenuBar mb = new AMenuBar();
    JMenu menu = new JMenu("File");
    mb.add(menu);
    menu.add(new JMenuItem(new NewAction()));
    menu.add(new JMenuItem(new SnapWindowAction()));
    menu.add(new JMenuItem(new SnapClipboardAction()));
    menu.add(new JSeparator());
    menu.add(new JMenuItem(new OpenAction()));
    menu.add(new JMenuItem(new SaveAction()));
    menu.add(new JSeparator());
    menu.add(new JMenuItem(new CloseAction()));
    menu.add(new JMenuItem(new QuitAction()));

    menu = new JMenu("Edit");
    mb.add(menu);
    menu.add(new JMenuItem(new UndoAction()));
    menu.add(new JMenuItem(new RedoAction()));
    menu.add(new JSeparator());
    menu.add(new JMenuItem(new CopyAction()));
    menu.add(new JMenuItem(new PasteAction()));

    menu = new JMenu("Select");
    mb.add(menu);
    menu.add(new JMenuItem(new SelectAllAction()));
    menu.add(new JMenuItem(new SelectNoneAction()));
    menu.add(new JMenuItem(new SelectInvertAction()));

    menu = new JMenu("View");
    mb.add(menu);
    JCheckBoxMenuItem cb = new JCheckBoxMenuItem();
    cb.setSelected(true);
    cb.setAction(new ShowToolbarAction(cb));
    menu.add(cb);
    menu.add(new JMenuItem(ShowLastPoxAction.getInstance()));
    menu.add(new JMenuItem(ShowPaintPoxAction.getInstance()));
    menu.add(new JMenuItem(ShowGrabPoxAction.getInstance()));

    mb.add(menu = new JMenu("Image"));
    menu.add(new JMenuItem(new ResizeImageAction()));

    mb.add(menu = new JMenu("Layers"));
    menu.add(new JMenuItem(new ResizeLayerAction()));
    JMenu sub;
    menu.add(sub = new JMenu("Layer Type"));
    for (ZLayerType t : ZLayerType.values()) {
      sub.add(t.toString());
    }

    menu = new JMenu("Tools");
    mb.add(menu);
    addTools(menu, ZToolInfo.getToolInfo("paint"));
    // addTools(menu, ToolModel.getTools("paint"));
    menu.add(new JSeparator());
    // addTools(menu, ToolModel.getTools("structured"));
    menu.add(new JSeparator());
    addTools(menu, ZToolInfo.getToolInfo("selection"));
    // addTools(menu, ToolModel.getTools("selection"));
    menu.add(new JSeparator());
    addTools(menu, ZToolInfo.getToolInfo("editing"));

    menu = new JMenu("Filters");
    mb.add(menu);
    menu.add(new JMenuItem(new BrightnessContrastAction()));
    menu.add(new JMenuItem(new GaussianBlurAction()));
    menu.add(new JMenuItem(new WienerDeconvolutionAction()));
    menu.add(new JMenuItem(new UnsharpMaskAction()));
    menu.add(new JMenuItem(new DCTDenoiseAction()));
    menu.add(new JMenuItem(new QWTDenoiseAction()));

    return mb;
  }