コード例 #1
0
ファイル: IGVMenuBar.java プロジェクト: kshakir/IGV
  private JMenu createGenomeSpaceMenu() {

    JMenu menu = new JMenu("GenomeSpace");

    MenuAction menuAction = null;
    menuAction = new LoadFromGSMenuAction("Load File from GenomeSpace...", KeyEvent.VK_U, igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.addSeparator();
    menuAction =
        new LoadGenomeFromGSMenuAction("Load Genome from GenomeSpace...", KeyEvent.VK_Z, igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.addSeparator();

    menuAction = new GSSaveSessionMenuAction("Save Session to GenomeSpace...", igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new GSOpenSessionMenuAction("Load Session from GenomeSpace...", igv);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.add(new JSeparator());
    menuAction =
        new MenuAction("Logout") {
          @Override
          public void actionPerformed(ActionEvent e) {
            GSUtils.logout();
            if (MessageUtils.confirm(
                "You must shutdown IGV to complete the GenomeSpace logout. Shutdown now?")) {
              doExitApplication();
            }
          }
        };
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.add(new JSeparator());
    menuAction =
        new MenuAction("Register... ") {

          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              BrowserLauncher.openURL(GENOMESPACE_REG_PAGE);
            } catch (IOException ex) {
              log.error("Error opening browser", ex);
            }
          }
        };
    menuAction.setToolTipText(GENOMESPACE_REG_TOOLTIP);
    menu.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menu.setVisible(
        PreferenceManager.getInstance().getAsBoolean(PreferenceManager.GENOME_SPACE_ENABLE));

    return menu;
  }
コード例 #2
0
ファイル: IGVMenuBar.java プロジェクト: kshakir/IGV
  private JMenu createExtrasMenu() {

    List<JComponent> menuItems = new ArrayList<JComponent>();

    MenuAction menuAction = null;

    final JCheckBoxMenuItem exomeModeItem = new JCheckBoxMenuItem("Exome mode");
    exomeModeItem.setSelected(FrameManager.isExomeMode());
    exomeModeItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            FrameManager.setExomeMode(exomeModeItem.isSelected(), true);
            igv.resetFrames();
          }
        });
    menuItems.add(exomeModeItem);
    menuItems.add(new JSeparator());

    // Preferences reset
    menuAction = new ResetPreferencesAction("Reset Preferences", IGV.getInstance());
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuItems.add(new JSeparator());

    menuAction =
        new MenuAction("Variant list ...  *EXPERIMENTAL*") {
          @Override
          public void actionPerformed(ActionEvent e) {
            VariantListManager.openNavigator(IGV.getMainFrame());
          }
        };
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuItems.add(new JSeparator());

    // Set frame dimensions
    menuAction =
        new MenuAction("Set window dimensions", null, KeyEvent.VK_C) {

          @Override
          public void actionPerformed(ActionEvent e) {
            String value = JOptionPane.showInputDialog("Enter dimensions, e.g. 800x400");
            if (value != null) {
              String[] vals = value.split("x");
              if (vals.length == 2) {
                int w = Integer.parseInt(vals[0]);
                int h = Integer.parseInt(vals[1]);
                IGV.getMainFrame().setSize(w, h);
              }
            }
          }
        };
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    // Save entire window
    menuAction =
        new MenuAction("Save Screenshot ...", null, KeyEvent.VK_A) {

          @Override
          public void actionPerformed(ActionEvent e) {
            IGV.getInstance().saveImage(IGV.getInstance().getContentPane());
          }
        };

    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction = new ExportTrackNamesMenuAction("Export track names...", IGV.getInstance());
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    menuAction =
        new MenuAction("Scatter Plot ...") {
          @Override
          public void actionPerformed(ActionEvent e) {
            final ReferenceFrame defaultFrame = FrameManager.getDefaultFrame();
            String chr = defaultFrame.getChrName();
            int start = (int) defaultFrame.getOrigin();
            int end = (int) defaultFrame.getEnd();
            int zoom = defaultFrame.getZoom();
            ScatterPlotUtils.openPlot(chr, start, end, zoom);
          }
        };
    menuItems.add(MenuAndToolbarUtils.createMenuItem(menuAction));

    MenuAction extrasMenuAction = new MenuAction("Extras");
    JMenu menu = MenuAndToolbarUtils.createMenu(menuItems, extrasMenuAction);

    //
    JMenu lfMenu = new JMenu("L&F");
    LookAndFeel lf = UIManager.getLookAndFeel();
    for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {

      final String lfName = info.getName();
      JMenuItem cb = new JMenuItem(lfName);
      // cb.setSelected(info.getClassName().equals(lf.getClass().getName());
      cb.addActionListener(
          new AbstractAction() {

            public void actionPerformed(ActionEvent actionEvent) {
              for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {

                if (lfName.equals(info.getName())) {
                  try {
                    UIManager.setLookAndFeel(info.getClassName());
                  } catch (Exception e) {
                    e.printStackTrace();
                  }
                  break;
                }
              }
            }
          });
      lfMenu.add(cb);
    }
    menu.add(lfMenu);

    menu.setVisible(false);

    return menu;
  }
コード例 #3
0
ファイル: IGVMenuBar.java プロジェクト: kshakir/IGV
 public void enableExtrasMenu() {
   extrasMenu.setVisible(true);
 }