/**
  * Create an new controllerContentPane is non-exist.
  *
  * @param controller data access controller
  * @return ControllerContentPane content pane
  */
 private ControllerContentPane getControllerContentPane(DataAccessController controller) {
   ControllerContentPane dataContentPane =
       (ControllerContentPane) inspectorContext.getDataContentPane(controller);
   if (dataContentPane == null) {
     dataContentPane = new ControllerContentPane(controller);
     inspectorContext.addDataContentPane(controller, dataContentPane);
   }
   return dataContentPane;
 }
  @EventSubscriber(eventClass = ShowWelcomePaneEvent.class)
  public synchronized void onShowWelcomePaneEvent(ShowWelcomePaneEvent evt) {
    logger.debug("Welcome pane is to be displayed");

    setContentPane(inspectorContext.getWelcomePane());
    setLocked(false);
  }
 @EventSubscriber(eventClass = DatabaseSearchEvent.class)
 public void onDatabaseSearchEvent(DatabaseSearchEvent evt) {
   if (DatabaseSearchEvent.Status.SHOW.equals(evt.getStatus())) {
     logger.debug(
         "Database search pane is to be displayed, event status: " + evt.getStatus().name());
     // show database search pane
     setContentPane(inspectorContext.getDatabaseSearchPane());
     // lock the central content panel
     setLocked(true);
     // deselect the foreground data access controller
     inspectorContext.setForegroundDataAccessController(null);
   } else if (DatabaseSearchEvent.Status.HIDE.equals(evt.getStatus())) {
     logger.debug(
         "Database search pane is to be replaced by the welcome pane, event status: "
             + evt.getStatus().name());
     // hide database search pane
     showWelcomePane();
   }
 }
 /** Open welcome pane */
 private void showWelcomePane() {
   OpenWelcomePaneTask task = new OpenWelcomePaneTask();
   task.setGUIBlocker(new DefaultGUIBlocker(task, GUIBlocker.Scope.NONE, null));
   inspectorContext.addTask(task);
 }
Exemplo n.º 5
0
  /** make menu bar a separate component */
  private void buildMenuToolBar() {
    // get property manager
    PrideInspectorContext context = (PrideInspectorContext) getDesktopContext();

    // create all the actions
    // file open action
    Icon openFileIcon = GUIUtilities.loadIcon(context.getProperty("open.file.icon.small"));
    String openFileDesc = context.getProperty("open.file.title");
    String openFileTooltip = context.getProperty("open.file.tooltip");
    PrideAction openFileAction = new OpenFileAction(openFileDesc, openFileIcon);

    // database open action
    Icon openDbIcon = GUIUtilities.loadIcon(context.getProperty("open.database.icon.small"));
    String openDbDesc = context.getProperty("open.database.title");
    String openDbTooltip = context.getProperty("open.database.tooltip");
    PrideAction openDbAction = new OpenDatabaseAction(openDbDesc, openDbIcon);

    // open reviewer
    Icon openReviewerIcon =
        GUIUtilities.loadIcon(context.getProperty("reviewer.download.icon.small"));
    String openReviewerDesc = context.getProperty("reviewer.download.title");
    String openReviewerTooltip = context.getProperty("reviewer.download.tooltip");
    PrideAction openReviewerAction = new OpenReviewAction(openReviewerDesc, openReviewerIcon);

    // close
    String closeDesc = context.getProperty("close.source.title");
    String closeAllDesc = context.getProperty("close.all.soruce.title");
    PrideAction closeAction = new CloseControllerAction(closeDesc, null);
    PrideAction closeAllAction = new CloseAllControllersAction(closeAllDesc, null);
    context.addPropertyChangeListenerToDataAccessMonitor((PropertyChangeListener) closeAction);
    context.addPropertyChangeListenerToDataAccessMonitor((PropertyChangeListener) closeAllAction);

    // try pride xml sample
    String openPrideXmlExampleDesc = context.getProperty("open.pride.xml.example.title");
    File prideXmlExampleFile =
        getExampleFiles(context.getProperty("pride.inspector.pride.example.file"));
    java.util.List<File> prideXmlFiles = new ArrayList<File>();
    if (prideXmlExampleFile != null) {
      prideXmlFiles.add(prideXmlExampleFile);
    }
    PrideAction openPrideXmlExampleAction =
        new OpenFileAction(openPrideXmlExampleDesc, null, prideXmlFiles);
    openPrideXmlExampleAction.setEnabled(
        prideXmlExampleFile != null && prideXmlExampleFile.exists());

    // try mzml sample
    String openMzMLExampleDesc = context.getProperty("open.mzml.example.title");
    File mzMLExampleFile =
        getExampleFiles(context.getProperty("pride.inspector.mzml.example.file"));
    java.util.List<File> mzMLFiles = new ArrayList<File>();
    if (mzMLExampleFile != null) {
      mzMLFiles.add(mzMLExampleFile);
    }
    PrideAction openMzMLExampleAction = new OpenFileAction(openMzMLExampleDesc, null, mzMLFiles);
    openMzMLExampleAction.setEnabled(mzMLExampleFile != null && mzMLExampleFile.exists());

    // help
    Icon helpIcon = GUIUtilities.loadIcon(context.getProperty("help.icon.small"));
    String helpDesc = context.getProperty("help.title");
    String helpTooltip = context.getProperty("help.tooltip");
    PrideAction helpAction = new OpenHelpAction(helpDesc, helpIcon);

    // faq
    String faqDesc = context.getProperty("faq.title");
    PrideAction faqAction = new OpenFAQAction(faqDesc, null);

    // pride website
    String prideWeb = context.getProperty("open.pride.website.title");
    String prideWebUrl = context.getProperty("pride.website");
    PrideAction prideWebAction = new OpenUrlAction(prideWeb, null, prideWebUrl);

    // pride website
    String inspectorWeb = context.getProperty("open.pride.inspector.website.title");
    String inspectorWebUrl = context.getProperty("pride.inspector.website");
    PrideAction inspectorWebAction = new OpenUrlAction(inspectorWeb, null, inspectorWebUrl);

    // feedback
    String feedbackDesc = context.getProperty("feedback.title");
    PrideAction feedBackAction = new FeedbackAction(feedbackDesc, null);

    // export
    String exportDesc = context.getProperty("export.title");
    PrideAction exportAction = new ExportSpectrumAction(exportDesc, null);
    context.addPropertyChangeListenerToDataAccessMonitor((PropertyChangeListener) exportAction);

    // export identification
    String exportIdentDesc = context.getProperty("export.identification.title");
    PrideAction exportIdentAction = new ExportIdentificationPeptideAction(exportIdentDesc, null);

    // export spectrum description
    String exportSpectrumDesc = context.getProperty("export.spectrum.desc.title");
    PrideAction exportSpectrumDescAction = new ExportSpectrumDescAction(exportSpectrumDesc, null);

    // export identification description
    String exportIdentDescTitle = context.getProperty("export.identification.desc.title");
    PrideAction exportIdentDescAction =
        new ExportIdentificationDescAction(exportIdentDescTitle, null);

    // export peptide description
    String exportPeptideDescTitle = context.getProperty("export.peptide.desc.title");
    PrideAction exportPeptideAction = new ExportPeptideDescAction(exportPeptideDescTitle, null);

    // make experiment public
    String makeExpPublicTitle = context.getProperty("make.experiment.public.title");
    PrideAction makeExpPublicAction = new MakeExperimentPublicAction(makeExpPublicTitle, null);

    String createReviewerTitle = context.getProperty("create.reviewer.title");
    PrideAction createReviewerAction = new CreateReviewerAction(createReviewerTitle, null);

    // check update
    String updateDescTitle = context.getProperty("check.update.desc.title");
    PrideAction updateAction = new UpdateAction(updateDescTitle, null);

    // about
    String aboutDesc = context.getProperty("about.title");
    PrideAction aboutAction = new AboutAction(aboutDesc, null);

    // exit
    String exitDesc = context.getProperty("exit.title");
    PrideAction exitAction = new ExitAction(exitDesc, null);

    // menu items
    menuBar = new JMenuBar();

    // file menu
    JMenu fileMenu =
        MenuFactory.createMenu(
            "File",
            openFileAction,
            openDbAction,
            openReviewerAction,
            MenuFactory.ACTION_SEPARATOR,
            closeAction,
            closeAllAction,
            MenuFactory.ACTION_SEPARATOR,
            exitAction);
    fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F);
    menuBar.add(fileMenu);

    // try samples
    JMenu trySampleMenu =
        MenuFactory.createMenu("Examples", openPrideXmlExampleAction, openMzMLExampleAction);
    trySampleMenu.setMnemonic(java.awt.event.KeyEvent.VK_X);
    menuBar.add(trySampleMenu);

    // export menu
    JMenu exportMenu =
        MenuFactory.createMenu(
            "Export",
            exportAction,
            exportSpectrumDescAction,
            exportIdentAction,
            exportIdentDescAction,
            exportPeptideAction);
    exportMenu.setMnemonic(java.awt.event.KeyEvent.VK_E);
    menuBar.add(exportMenu);

    // curation menu
    boolean showCurationMenu = Boolean.parseBoolean(context.getProperty("include.curation.menu"));
    if (showCurationMenu) {
      JMenu curationMenu =
          MenuFactory.createMenu("Curation", makeExpPublicAction, createReviewerAction);
      curationMenu.setMnemonic(java.awt.event.KeyEvent.VK_C);
      menuBar.add(curationMenu);
    }

    // help menu
    JMenu helpMenu =
        MenuFactory.createMenu(
            "Help",
            helpAction,
            faqAction,
            MenuFactory.ACTION_SEPARATOR,
            prideWebAction,
            inspectorWebAction,
            MenuFactory.ACTION_SEPARATOR,
            feedBackAction,
            MenuFactory.ACTION_SEPARATOR,
            updateAction,
            aboutAction);
    helpMenu.setMnemonic(java.awt.event.KeyEvent.VK_H);
    menuBar.add(helpMenu);

    // add menus
    mainFrame.setJMenuBar(menuBar);

    // tool bar
    toolBar = new JToolBar();

    // open file
    JButton openFileButton = new JButton();
    openFileButton.setAction(openFileAction);
    openFileButton.setText("");
    openFileButton.setToolTipText(openFileTooltip);
    openFileButton.setFocusable(false);
    toolBar.add(openFileButton);
    // open database
    JButton openDbButton = new JButton();
    openDbButton.setAction(openDbAction);
    openDbButton.setText("");
    openDbButton.setToolTipText(openDbTooltip);
    openDbButton.setFocusable(false);
    toolBar.add(openDbButton);
    // open reviewer download
    JButton openReviewerButton = new JButton();
    openReviewerButton.setAction(openReviewerAction);
    openReviewerButton.setText("");
    openReviewerButton.setToolTipText(openReviewerTooltip);
    openReviewerButton.setFocusable(false);
    toolBar.add(openReviewerButton);
    // separator
    toolBar.addSeparator();
    // help
    JButton helpButton = new JButton(helpIcon);
    helpButton.setAction(helpAction);
    helpButton.setText("");
    helpButton.setToolTipText(helpTooltip);
    helpButton.setFocusable(false);
    toolBar.add(helpButton);
    mainFrame.getContentPane().add(toolBar, BorderLayout.PAGE_START);
  }