Esempio n. 1
0
  /**
   * <code>PlanWorks</code> - constructor
   *
   * @param constantMenus - <code>JMenu[]</code> -
   */
  public PlanWorks(JMenu[] constantMenus) {
    super(name, constantMenus);
    projectMenu.setEnabled(false);
    currentProjectName = "";
    currentProject = null;
    viewManager = null;
    sequenceDirChooser = new DirectoryChooser();
    createDirectoryChooser();
    // Closes from title bar
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    if (isMaxScreen) {
      Rectangle maxRectangle =
          GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
      this.setSize((int) maxRectangle.getWidth(), (int) maxRectangle.getHeight());
      this.setLocation(0, 0);
    } else {
      this.setSize(DESKTOP_FRAME_WIDTH, DESKTOP_FRAME_HEIGHT);
      this.setLocation(FRAME_X_LOCATION, FRAME_Y_LOCATION);
    }
    Container contentPane = getContentPane();
    for (int i = 0, n = contentPane.getComponentCount(); i < n; i++) {
      // System.err.println( "i " + i + " " +
      //                    contentPane.getComponent( i).getClass().getName());
      if (contentPane.getComponent(i) instanceof MDIDesktopPane) {
        ((MDIDesktopPane) contentPane.getComponent(i))
            .setBackground(ViewConstants.VIEW_BACKGROUND_COLOR);
        break;
      }
    }
    supportedViewNames = Utilities.sortStringKeySet(viewClassNameMap);
    this.setVisible(true);
    if (usingSplash) {
      this.toBack();
    }

    setProjectMenuEnabled(CREATE_MENU_ITEM, true);
    setProjectMenuEnabled(ADDSEQ_MENU_ITEM, false);
    setProjectMenuEnabled(DELSEQ_MENU_ITEM, false);
    if ((PwProject.listProjects() != null) && (PwProject.listProjects().size() > 0)) {
      setProjectMenuEnabled(OPEN_MENU_ITEM, true);
      setProjectMenuEnabled(DELETE_MENU_ITEM, true);
    } else {
      setProjectMenuEnabled(OPEN_MENU_ITEM, false);
      setProjectMenuEnabled(DELETE_MENU_ITEM, false);
    }
    projectMenu.setEnabled(true);
    windowBuilt = true;
    if (usingSplash) {
      this.toFront();
    }
  } // end constructor
Esempio n. 2
0
  /**
   * <code>AskNodeByKey</code> - constructor
   *
   * @param dialogTitle - <code>String</code> -
   * @param textFieldLabel - <code>String</code> -
   * @param partialPlanView - <code>PartialPlanView</code> -
   */
  public AskNodeByKey(String dialogTitle, String textFieldLabel, PartialPlanView partialPlanView) {
    // modal dialog - blocks other activity
    super(PlanWorks.planWorks, true);
    this.partialPlanView = partialPlanView;

    setTitle(dialogTitle);
    final String msgString1 = textFieldLabel;
    textField = new JTextField(10);
    Object[] array = {msgString1, textField};

    btnString1 = "Enter";
    btnString2 = "Cancel";
    Object[] options = {btnString1, btnString2};

    // current value
    textField.setText("");
    optionPane =
        new JOptionPane(
            array,
            JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION,
            null,
            options,
            options[0]);
    setContentPane(optionPane);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            /*
             * Instead of directly closing the window,
             * we're going to change the JOptionPane's
             * value property.
             */
            optionPane.setValue(new Integer(JOptionPane.CLOSED_OPTION));
          }
        });

    textField.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            optionPane.setValue(btnString1);
          }
        });

    addInputListener();

    // size dialog appropriately
    pack();
    setBackground(ViewConstants.VIEW_BACKGROUND_COLOR);
    Utilities.setPopUpLocation(this, PlanWorks.planWorks);
    setVisible(true);
  } // end constructor
Esempio n. 3
0
 private void buildSequenceViewSubMenu(JMenu seqMenu, String seqUrl, String seqName) {
   Iterator viewNamesItr = supportedViewNames.iterator();
   while (viewNamesItr.hasNext()) {
     String viewName = (String) viewNamesItr.next();
     if (viewName.equals(SEQUENCE_STEPS_VIEW)) {
       SequenceViewMenuItem planDbSizeItem =
           new SequenceViewMenuItem(Utilities.trimView(SEQUENCE_STEPS_VIEW), seqUrl, seqName);
       planDbSizeItem.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
               PlanWorks.planWorks.createSequenceViewThread(
                   SEQUENCE_STEPS_VIEW, (SequenceViewMenuItem) evt.getSource());
             }
           });
       seqMenu.add(planDbSizeItem);
     }
   }
 } // end buildSequenceViewSubMenu
Esempio n. 4
0
 protected JMenu buildPlanSeqViewMenu(PwProject project, JMenu planSeqViewMenu) {
   if (planSeqViewMenu == null) {
     planSeqViewMenu = new JMenu(PLANSEQ_MENU);
   }
   planSeqViewMenu.removeAll();
   sequenceNameMap = new HashMap();
   // System.err.println( "buildPlanSeqViewMenu");
   List planSeqNames = project.listPlanningSequences();
   Collections.sort(planSeqNames, new SeqNameComparator());
   Iterator seqUrlsItr = planSeqNames.iterator();
   while (seqUrlsItr.hasNext()) {
     String seqUrl = (String) seqUrlsItr.next();
     String seqName = getSequenceMenuItemName(Utilities.getUrlLeaf(seqUrl), planSeqViewMenu);
     // System.err.println( "  sequenceName " + seqName);
     sequenceNameMap.put(seqUrl, seqName);
     JMenu seqMenu = new JMenu(seqName);
     planSeqViewMenu.add(seqMenu);
     buildSequenceViewSubMenu(seqMenu, seqUrl, seqName);
   }
   return planSeqViewMenu;
 } // end buildPlanSeqViewMenu
Esempio n. 5
0
 public boolean equals(Object o1, Object o2) {
   String s1 = Utilities.getUrlLeaf((String) o1);
   String s2 = Utilities.getUrlLeaf((String) o2);
   return s1.equals(s2);
 }
Esempio n. 6
0
 public int compare(Object o1, Object o2) {
   String s1 = Utilities.getUrlLeaf((String) o1);
   String s2 = Utilities.getUrlLeaf((String) o2);
   return s1.compareTo(s2);
 }