Esempio n. 1
0
 @Override
 public void actionPerformed(ActionEvent event) {
   // If not 1st time, other ID will be displayed. Set to default ID
   // anyway.
   helpBroker.setCurrentView(view.toString());
   CSH.setHelpIDString((JMenuItem) event.getSource(), DEFAULT);
   displayListener.actionPerformed(event);
 }
Esempio n. 2
0
 /** Sets contexts sensitive help for the input component, if the help system is used. */
 public void set_context_sensitive_help(java.awt.Component p_component, String p_help_id) {
   if (this.help_system_used) {
     java.awt.Component curr_component;
     if (p_component instanceof javax.swing.JFrame) {
       curr_component = ((javax.swing.JFrame) p_component).getRootPane();
     } else {
       curr_component = p_component;
     }
     String help_id = "html_files." + p_help_id;
     javax.help.CSH.setHelpIDString(curr_component, help_id);
     if (!this.is_web_start) {
       help_broker.enableHelpKey(curr_component, help_id, help_set);
     }
   }
 }
  /**
   * Constructor.
   *
   * @param bSimple true if the simple interface should be draw, false if the advanced. * *
   * @param hs the HelpSet to use for menus and menuitems.
   * @param hb the HelpBroker to use for menus and menuitems.
   */
  public UIMenuTools(boolean bSimple, HelpSet hs, HelpBroker hb) {
    this.mainHS = hs;
    this.mainHB = hb;
    this.bSimpleInterface = bSimple;
    shortcutKey = ProjectCompendium.APP.shortcutKey;

    mnuMainMenu =
        new JMenu(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.tools")); // $NON-NLS-1$
    CSH.setHelpIDString(mnuMainMenu, "menus.tools"); // $NON-NLS-1$
    mnuMainMenu.setMnemonic(
        (LanguageProperties.getString(LanguageProperties.MENUS_BUNDLE, "UIMenuTools.toolsMnemonic"))
            .charAt(0)); // $NON-NLS-1$

    createMenuItems(bSimple);
  }
  /**
   * Constructor
   *
   * @param parent the parent for this dialog
   * @param graphToEdit the graph that we're editing
   */
  public ScanOneSettingsDialog(Frame parent, ScanOneGraph graphToEdit) {
    super(parent, "One QTL Scan Plot Settings", true);

    this.scanOneIntervalPanel =
        new ScanOneIntervalPanel(graphToEdit.getScanOneIntervalCommandBuilder());
    this.graphVisualSettingsPanel = new GraphVisualSettingsPanel(graphToEdit);

    this.initComponents();

    if (graphToEdit.getScanOneResult().getPermutationsWereCalculated()) {
      this.scanOneThresholdPanel = new ScanOneThresholdPanel(graphToEdit);
      this.mainContentPanel.addTab("Thresholds", this.scanOneThresholdPanel);
    } else {
      this.scanOneThresholdPanel = null;
    }

    // initialize the help stuff
    HelpSet hs = QTL.getInstance().getMenubar().getHelpSet();
    CSH.setHelpIDString(this.helpButton, HELP_ID_STRING);
    this.helpButton.addActionListener(
        new CSH.DisplayHelpFromSource(hs, SecondaryWindow.class.getName(), null));
  }
  /**
   * Create a choicebox for link line style options and return the panel it is in.
   *
   * @return JPanel the panel holding the new choicebox for the link style options.
   */
  private JPanel createLinkDashedChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbLinkDashed = new JComboBox();
    cbLinkDashed.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectDashed")); // $NON-NLS-1$
    cbLinkDashed.setOpaque(true);
    cbLinkDashed.setEditable(false);
    cbLinkDashed.setEnabled(false);
    cbLinkDashed.setMaximumRowCount(10);
    cbLinkDashed.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.plainLine"))); //$NON-NLS-1$
    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.largeDashes"))); //$NON-NLS-1$
    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.smallDashes"))); //$NON-NLS-1$

    cbLinkDashed.validate();

    cbLinkDashed.setSelectedIndex(0);

    DefaultListCellRenderer drawRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (list != null) {
              if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
              } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
              }
            }

            setText((String) value);
            return this;
          }
        };

    cbLinkDashed.setRenderer(drawRenderer);

    ActionListener drawActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onUpdateLinkDashed(cbLinkDashed.getSelectedIndex());
          }
        };
    cbLinkDashed.addActionListener(drawActionListener);

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbLinkDashed, BorderLayout.CENTER);
    return drawPanel;
  }
  /**
   * Create a choicbox for link line thickness options and return the panel it is in.
   *
   * @return JPanel the panel holding the new choicebox for the line thickness options.
   */
  private JPanel createWeightChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbLineWeight = new JComboBox();
    cbLineWeight.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectWeight")); // $NON-NLS-1$
    cbLineWeight.setOpaque(true);
    cbLineWeight.setEditable(false);
    cbLineWeight.setEnabled(false);
    cbLineWeight.setMaximumRowCount(10);
    cbLineWeight.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    cbLineWeight.addItem(new String("1 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("2 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("3 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("4 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("5 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("6 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("7 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("8 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("9 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("10 px")); // $NON-NLS-1$

    cbLineWeight.validate();

    cbLineWeight.setSelectedIndex(0);

    DefaultListCellRenderer drawRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (list != null) {
              if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
              } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
              }
            }

            setText((String) value);
            return this;
          }
        };

    cbLineWeight.setRenderer(drawRenderer);

    ActionListener drawActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int ind = cbLineWeight.getSelectedIndex();

            if (ind == 0) onUpdateLinkWeight(1);
            else if (ind == 1) onUpdateLinkWeight(2);
            else if (ind == 2) onUpdateLinkWeight(3);
            else if (ind == 3) onUpdateLinkWeight(4);
            else if (ind == 4) onUpdateLinkWeight(5);
            else if (ind == 5) onUpdateLinkWeight(6);
            else if (ind == 6) onUpdateLinkWeight(7);
            else if (ind == 7) onUpdateLinkWeight(8);
            else if (ind == 8) onUpdateLinkWeight(9);
            else if (ind == 9) onUpdateLinkWeight(10);
          }
        };
    cbLineWeight.addActionListener(drawActionListener);

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbLineWeight, BorderLayout.CENTER);
    return drawPanel;
  }
  /** Create the arrow head choicebox. */
  private JPanel createArrowChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbArrows = new JComboBox();
    cbArrows.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectArrow")); // $NON-NLS-1$
    cbArrows.setOpaque(true);
    cbArrows.setEditable(false);
    cbArrows.setEnabled(false);
    cbArrows.setMaximumRowCount(4);
    cbArrows.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    Vector arrows = new Vector(5);
    arrows.insertElementAt(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.noArrows"),
        0); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.fromTo"),
        1); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.toFfrom"),
        2); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.bothWays"),
        3); //$NON-NLS-1$
    DefaultComboBoxModel comboModel = new DefaultComboBoxModel(arrows);
    cbArrows.setModel(comboModel);
    cbArrows.setSelectedIndex(0);

    DefaultListCellRenderer comboRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (isSelected) {
              setBackground(list.getSelectionBackground());
              setForeground(list.getSelectionForeground());
            } else {
              setBackground(list.getBackground());
              setForeground(list.getForeground());
            }

            setText((String) value);

            return this;
          }
        };
    cbArrows.setRenderer(comboRenderer);

    cbArrows.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onUpdateArrowType(cbArrows.getSelectedIndex());
          }
        });

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbArrows, BorderLayout.CENTER);
    return drawPanel;
  }
  /**
   * Create and return the toolbar with the node formatting options.
   *
   * @return UIToolBar, the toolbar with all the node formatting options.
   */
  private UIToolBar createToolBar(int orientation) {

    tbrToolBar =
        new UIToolBar(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.name"),
            UIToolBar.NORTHSOUTH); // $NON-NLS-1$
    tbrToolBar.setOrientation(orientation);
    tbrToolBar.setEnabled(false);
    CSH.setHelpIDString(tbrToolBar, "toolbars.formatlink"); // $NON-NLS-1$

    GridBagLayout grid = new GridBagLayout();
    linkPanel = new JPanel(grid);
    linkColourPanel = new JPanel(new BorderLayout());
    linkColourPanel.setBackground(Color.black);

    JLabel label = new JLabel(" "); // $NON-NLS-1$
    GridBagConstraints con5 = new GridBagConstraints();
    con5.fill = GridBagConstraints.NONE;
    con5.anchor = GridBagConstraints.CENTER;
    grid.addLayoutComponent(label, con5);
    linkPanel.add(label);

    txtLinkColour = new JLabel(UIImages.get(BACKGROUND_COLOUR));
    txtLinkColour.setBorder(null);
    txtLinkColour.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE,
            "UIToolBarFormatLink.selectLinkColour")); //$NON-NLS-1$
    txtLinkColour.setEnabled(false);
    txtLinkColour.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            int clickCount = e.getClickCount();
            if (clickCount == 1 && txtLinkColour.isEnabled()) {
              onUpdateLinkColour(linkColourPanel.getBackground().getRGB());
            }
          }
        });
    linkColourPanel.add(txtLinkColour, BorderLayout.CENTER);

    GridBagConstraints con = new GridBagConstraints();
    con.fill = GridBagConstraints.NONE;
    con.anchor = GridBagConstraints.CENTER;
    grid.addLayoutComponent(linkColourPanel, con);
    linkPanel.add(linkColourPanel);

    btLinkColour = new UIImageButton(UIImages.get(RIGHT_ARROW_ICON));
    btLinkColour.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            int clickCount = e.getClickCount();
            if (clickCount == 1 && txtLinkColour.isEnabled()) {
              if (oColorChooserDialog != null) {
                oColorChooserDialog.setColour(selectedLinkColour);
              } else {
                oColorChooserDialog =
                    new UIColorChooserDialog(ProjectCompendium.APP, selectedLinkColour);
              }
              oColorChooserDialog.setVisible(true);
              Color oColour = oColorChooserDialog.getColour();
              oColorChooserDialog.setVisible(false);
              if (oColour != null) {
                linkColourPanel.setBackground(oColour);
                onUpdateLinkColour(oColour.getRGB());
              }
            }
          }
        });
    linkPanel.add(btLinkColour);

    label = new JLabel(" "); // $NON-NLS-1$
    GridBagConstraints con4 = new GridBagConstraints();
    con4.fill = GridBagConstraints.NONE;
    con4.anchor = GridBagConstraints.CENTER;
    grid.addLayoutComponent(label, con4);
    linkPanel.add(label);

    tbrToolBar.add(linkPanel);
    CSH.setHelpIDString(txtLinkColour, "toolbars.formatlink"); // $NON-NLS-1$

    tbrToolBar.add(createWeightChoiceBox());
    tbrToolBar.add(createArrowChoiceBox());
    tbrToolBar.add(createLinkStyleChoiceBox());
    tbrToolBar.add(createLinkDashedChoiceBox());

    return tbrToolBar;
  }
  /**
   * Initialises and sets up the dialog.
   *
   * @param parent the parent frame for this dialog.
   * @param projects a list of the current database project names.
   * @param sMySQLName the username to use when connecting to MySQL to create the new database.
   * @param sMySQLPassword the password to use when connecting to MySQL to create the new database.
   * @param sMySQLIP the ip address or hostname to use when connecting to the database to create the
   *     new project.
   */
  public UINewDatabaseDialog(
      JFrame parent, Vector projects, String sMySQLName, String sMySQLPassword, String sMySQLIP) {

    super(parent, true);
    if (!ProjectCompendium.APP.projectsExist() && SystemProperties.createDefaultProject) {
      drawSimpleForm = true;
    } else {
      drawSimpleForm = false;
    }

    if (!drawSimpleForm) {
      this.setTitle(
          LanguageProperties.getString(
              LanguageProperties.DIALOGS_BUNDLE,
              "UINewDatabaseDialog.createNewProjectTitle")); //$NON-NLS-1$
    } else {
      this.setTitle(
          LanguageProperties.getString(
              LanguageProperties.DIALOGS_BUNDLE,
              "UINewDatabaseDialog.compendiumSetupTitle")); //$NON-NLS-1$
    }

    // this.setTitle(LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE,
    // "UINewDatabaseDialog.createNewProjectTitle")); //$NON-NLS-1$

    CSH.setHelpIDString(this, "basic.databases"); // $NON-NLS-1$

    oParent = parent;
    manager = this;

    this.sDatabaseLogin = sMySQLName;
    this.sDatabasePassword = sMySQLPassword;
    if (sMySQLIP != null && !sMySQLIP.equals("")) { // $NON-NLS-1$
      this.sDatabaseIP = sMySQLIP;
    }

    vtProjects = projects;

    oContentPane = getContentPane();
    JPanel oMainPanel = new JPanel(new BorderLayout());
    oMainPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    oContentPane.setLayout(new BorderLayout());
    oContentPane.add(oMainPanel);

    oDetailsPanel = new JPanel();
    oDetailsPanel.setBorder(new EmptyBorder(10, 10, 5, 10));
    grid = new GridBagLayout();
    oDetailsPanel.setLayout(grid);

    GridBagConstraints gc = new GridBagConstraints();
    gc.insets = new Insets(5, 5, 5, 5);
    gc.anchor = GridBagConstraints.WEST;

    if (!drawSimpleForm) {
      oNameLabel =
          new JLabel(
              LanguageProperties.getString(
                      LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.projectName")
                  + ": * "); //$NON-NLS-1$
      grid.setConstraints(oNameLabel, gc);

      oNameField = new JTextField();
      oNameField.setColumns(25);
      oNameLabel.setLabelFor(oNameField);
      gc.gridwidth = GridBagConstraints.REMAINDER;
      grid.setConstraints(oNameField, gc);

      oDetailsPanel.add(oNameLabel);
      oDetailsPanel.add(oNameField);

      oDefaultDatabase =
          new JCheckBox(
              LanguageProperties.getString(
                  LanguageProperties.DIALOGS_BUNDLE,
                  "UINewDatabaseDialog.setAsDefault")); //$NON-NLS-1$
      oDefaultDatabase.addItemListener(this);
      grid.setConstraints(oDefaultDatabase, gc);
      oDetailsPanel.add(oDefaultDatabase);

      // oDefaultUser = new
      // JCheckBox(LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE,
      // "UINewDatabaseDialog.defaultUser")); //$NON-NLS-1$
      // oDefaultUser.addItemListener(this);
      // grid.setConstraints(oDefaultUser, gc);
      // oDetailsPanel.add(oDefaultUser);

      // JLabel label = new JLabel(LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE,
      // "UINewDatabaseDialog.administrator")); //$NON-NLS-1$
      // grid.setConstraints(label, gc);
      // oDetailsPanel.add(label);
    }

    oButtonPanel = new UIButtonPanel();

    pbCreate =
        new UIButton(
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE,
                "UINewDatabaseDialog.createButton")); //$NON-NLS-1$
    pbCreate.setMnemonic(
        LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.createButtonMnemonic")
            .charAt(0)); // $NON-NLS-1$
    pbCreate.addActionListener(this);
    getRootPane().setDefaultButton(pbCreate);
    oButtonPanel.addButton(pbCreate);

    if (!drawSimpleForm) {
      pbCancel =
          new UIButton(
              LanguageProperties.getString(
                  LanguageProperties.DIALOGS_BUNDLE,
                  "UINewDatabaseDialog.cancelButton")); //$NON-NLS-1$
      pbCancel.setMnemonic(
          LanguageProperties.getString(
                  LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.cancelButtonMnemonic")
              .charAt(0)); // $NON-NLS-1$
      pbCancel.addActionListener(this);
      oButtonPanel.addButton(pbCancel);

      pbHelp =
          new UIButton(
              LanguageProperties.getString(
                  LanguageProperties.DIALOGS_BUNDLE,
                  "UINewDatabaseDialog.helpButton")); //$NON-NLS-1$
      pbHelp.setMnemonic(
          LanguageProperties.getString(
                  LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.helpButtonMnemonic")
              .charAt(0)); // $NON-NLS-1$
      ProjectCompendium.APP.mainHB.enableHelpOnButton(
          pbHelp, "basics.databasescreate", ProjectCompendium.APP.mainHS); // $NON-NLS-1$
      oButtonPanel.addHelpButton(pbHelp);
    }

    JPanel oHoldingPanel = new JPanel(new BorderLayout());
    userPanel = new UINewUserPanel(true);
    userPanel.setBorder(
        new TitledBorder(
            new BevelBorder(BevelBorder.LOWERED),
            LanguageProperties.getString(
                LanguageProperties.DIALOGS_BUNDLE, "UINewDatabaseDialog.administrator")));
    oHoldingPanel.add(userPanel, BorderLayout.CENTER);

    if (!drawSimpleForm) {
      oDefaultUser =
          new JCheckBox(
              LanguageProperties.getString(
                  LanguageProperties.DIALOGS_BUNDLE,
                  "UINewDatabaseDialog.defaultUser")); //$NON-NLS-1$
      oDefaultUser.addItemListener(this);
      oDefaultUser.setSelected(true);
      grid.setConstraints(oDefaultUser, gc);
      oHoldingPanel.add(oDefaultUser, BorderLayout.SOUTH);
    }

    oMainPanel.add(oDetailsPanel, BorderLayout.NORTH);
    oMainPanel.add(oHoldingPanel, BorderLayout.CENTER);
    oMainPanel.add(oButtonPanel, BorderLayout.SOUTH);

    oProgressBar = new JProgressBar();
    oProgressBar.setMinimum(0);
    oProgressBar.setMaximum(100);

    pack();

    setResizable(false);
  }
  /**
   * Create and return the Tools menu.
   *
   * @return JMenu the Tools menu.
   */
  private JMenu createMenuItems(boolean bSimple) {

    miUsers =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userManager")); // $NON-NLS-1$
    miUsers.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userManagerMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miUsers.addActionListener(this);
    mnuMainMenu.add(miUsers);

    miLinkedFilesFileBrowser =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkedFilesBrowser")); // $NON-NLS-1$
    miLinkedFilesFileBrowser.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkedFilesBrowserMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miLinkedFilesFileBrowser.addActionListener(this);
    mnuMainMenu.add(miLinkedFilesFileBrowser);

    // miCodes = new JMenuItem(LanguageProperties.getString(LanguageProperties.MENUS_BUNDLE,
    // "UIMenuTools.tags")); //$NON-NLS-1$
    // miCodes.setMnemonic((LanguageProperties.getString(LanguageProperties.MENUS_BUNDLE,
    // "UIMenuTools.tagsMnemonic")).charAt(0)); //$NON-NLS-1$
    // miCodes.addActionListener(this);
    // mnuMainMenu.add(miCodes);

    mnuMainMenu.addSeparator();

    mnuTemplates = new JTemplateMenu();
    mnuTemplates.setText(
        LanguageProperties.getString(
            LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templates")); // $NON-NLS-1$
    mnuTemplates.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.templatesMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    mnuMainMenu.add(mnuTemplates);

    separator1 = new JPopupMenu.Separator();
    mnuMainMenu.add(separator1);

    mnuMemetic =
        new JMenu(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memetic")); // $NON-NLS-1$
    CSH.setHelpIDString(mnuMemetic, "menus.memetic"); // $NON-NLS-1$
    mnuMemetic.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    mnuMainMenu.add(mnuMemetic);

    // miMeetingSetup = new JMenuItem("Access Grid Meeting Setup");
    // miMeetingSetup.setMnemonic(KeyEvent.VK_P);
    // miMeetingSetup.addActionListener(this);
    // mnuMemetic.add(miMeetingSetup);

    miMeetingRecording =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualStop")); // $NON-NLS-1$
    miMeetingRecording.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualStopTip")); // $NON-NLS-1$
    miMeetingRecording.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualStopMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miMeetingRecording.addActionListener(this);
    mnuMemetic.add(miMeetingRecording);

    // miMeetingReplay = new JMenuItem("Replay Access Grid Meeting");
    // miMeetingReplay.setMnemonic(KeyEvent.VK_P);
    // miMeetingReplay.addActionListener(this);
    // mnuMemetic.add(miMeetingReplay);

    miMeetingUpload =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualUpload")); // $NON-NLS-1$
    miMeetingUpload.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualUploadTip")); // $NON-NLS-1$
    miMeetingUpload.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.memeticManualUploadMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miMeetingUpload.addActionListener(this);
    CSH.setHelpIDString(miMeetingUpload, "menus.memetic"); // $NON-NLS-1$
    mnuMemetic.add(miMeetingUpload);

    separator2 = new JPopupMenu.Separator();
    mnuMainMenu.add(separator2);

    /*
    miStartScreenCapture = new JMenuItem("Start Screen Capture");
    miStartScreenCapture.setMnemonic(KeyEvent.VK_N);
    miStartScreenCapture.addActionListener(this);
    mnuMainMenu.add(miStartScreenCapture);

    miStopScreenCapture = new JMenuItem("Stop Screen Capture");
    miStopScreenCapture.setMnemonic(KeyEvent.VK_P);
    miStopScreenCapture.addActionListener(this);
    mnuMainMenu.add(miStopScreenCapture);

    mnuMainMenu.addSeparator();
    */

    // STENCILS
    miStencilManagement =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsManage")); // $NON-NLS-1$
    miStencilManagement.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsManageMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miStencilManagement.addActionListener(this);
    mnuMainMenu.add(miStencilManagement);

    mnuStencils =
        new JMenu(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsOpen")); // $NON-NLS-1$
    mnuStencils.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.stencilsOpenMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    mnuMainMenu.add(mnuStencils);
    createStencilMenu();

    mnuMainMenu.addSeparator();

    miLinkGroupManagement =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsManage")); // $NON-NLS-1$
    miLinkGroupManagement.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsManageMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miLinkGroupManagement.addActionListener(this);
    mnuMainMenu.add(miLinkGroupManagement);

    miLinkGroupDefault =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsDefault")); // $NON-NLS-1$
    miLinkGroupDefault.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.linkGroupsDefaultMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miLinkGroupDefault.addActionListener(this);
    mnuMainMenu.add(miLinkGroupDefault);

    mnuMainMenu.addSeparator();

    mnuScribble =
        new JMenu(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePad")); // $NON-NLS-1$
    mnuScribble.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    mnuMainMenu.add(mnuScribble);

    miShowScribblePad =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadActivate")); // $NON-NLS-1$
    miShowScribblePad.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadActivateMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miShowScribblePad.setEnabled(false);
    miShowScribblePad.addActionListener(this);
    mnuScribble.add(miShowScribblePad);

    miHideScribblePad =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE,
                "UIMenuTools.scribblePadDeactivate")); //$NON-NLS-1$
    miHideScribblePad.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadDeactivateMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miHideScribblePad.setEnabled(false);
    miHideScribblePad.addActionListener(this);
    mnuScribble.add(miHideScribblePad);

    miSaveScribblePad =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadSave")); // $NON-NLS-1$
    miSaveScribblePad.setEnabled(false);
    miSaveScribblePad.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadSaveMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miSaveScribblePad.addActionListener(this);
    mnuScribble.add(miSaveScribblePad);

    miClearScribblePad =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadClear")); // $NON-NLS-1$
    miClearScribblePad.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.scribblePadClearMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miClearScribblePad.setEnabled(false);
    miClearScribblePad.addActionListener(this);
    mnuScribble.add(miClearScribblePad);

    mnuMainMenu.addSeparator();

    /*if (!bSimpleInterface) {
    //miLimboNode = new JMenuItem("Show Lost Nodes...");
    //miLimboNode.setMnemonic(KeyEvent.VK_I);
    //miLimboNode.addActionListener(this);
    //mnuMainMenu.add(miLimboNode);
    }*/

    // mnuMainMenu.addSeparator();
    // miShowCodes = new JMenuItem("Show Tags");
    // miShowCodes.setMnemonic(KeyEvent.VK_W);
    // miShowCodes.addActionListener(this);
    // mnuMainMenu.add(miShowCodes);

    // miHideCodes = new JMenuItem("Hide Tags");
    // miHideCodes.setMnemonic(KeyEvent.VK_H);
    // miHideCodes.addActionListener(this);
    // mnuMainMenu.add(miHideCodes);

    // miRefreshCache = new JMenuItem("Refresh Data");
    // miRefreshCache.setMnemonic(KeyEvent.VK_U);
    // miRefreshCache.addActionListener(this);
    // mnuMainMenu.add(miRefreshCache);

    // mnuMainMenu.addSeparator();

    if (ProjectCompendium.isMac)
      miProjectOptions =
          new JMenuItem(
              LanguageProperties.getString(
                  LanguageProperties.MENUS_BUNDLE, "UIMenuTools.projectOptionsMac")); // $NON-NLS-1$
    else
      miProjectOptions =
          new JMenuItem(
              LanguageProperties.getString(
                  LanguageProperties.MENUS_BUNDLE, "UIMenuTools.projectOptions")); // $NON-NLS-1$
    miProjectOptions.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.projectOptionsMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miProjectOptions.addActionListener(this);
    mnuMainMenu.add(miProjectOptions);

    if (ProjectCompendium.isMac)
      miOptions =
          new JMenuItem(
              LanguageProperties.getString(
                  LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userOptionsMac")); // $NON-NLS-1$
    else
      miOptions =
          new JMenuItem(
              LanguageProperties.getString(
                  LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userOptions")); // $NON-NLS-1$
    miOptions.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.userOptionsMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miOptions.addActionListener(this);
    mnuMainMenu.add(miOptions);

    mnuMainMenu.addSeparator();

    miFocusFrames =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusFrame")); // $NON-NLS-1$
    miFocusFrames.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusFrameTip")); // $NON-NLS-1$
    miFocusFrames.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, shortcutKey));
    miFocusFrames.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusFrameMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miFocusFrames.addActionListener(this);
    mnuMainMenu.add(miFocusFrames);

    miFocusTabs =
        new JMenuItem(
            LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusLeftTabs")); // $NON-NLS-1$
    miFocusTabs.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusLeftTabsTip")); // $NON-NLS-1$
    miFocusTabs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, shortcutKey));
    miFocusTabs.setMnemonic(
        (LanguageProperties.getString(
                LanguageProperties.MENUS_BUNDLE, "UIMenuTools.focusLeftTabsMnemonic"))
            .charAt(0)); // $NON-NLS-1$
    miFocusTabs.addActionListener(this);
    mnuMainMenu.add(miFocusTabs);

    if (bSimple) {
      addExtenderButton();
      setDisplay(bSimple);
    }

    return mnuMainMenu;
  }
  /**
   * Creates and return the main toolbar (for example, cut/copy/paste/open/close etc.).
   *
   * @return UIToolBar, the toolbar with all the main options.
   */
  private UIToolBar createToolBarItems() {

    if (!bSimpleInterface) {
      pbOpen =
          tbrToolBar.createToolBarButton(
              LanguageProperties.getString(
                  LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.open"),
              UIImages.get(OPEN_ICON)); // $NON-NLS-1$
      pbOpen.addActionListener(this);
      pbOpen.setEnabled(false);
      tbrToolBar.add(pbOpen);
      CSH.setHelpIDString(pbOpen, "toolbars.main"); // $NON-NLS-1$

      pbClose =
          tbrToolBar.createToolBarButton(
              LanguageProperties.getString(
                  LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.close"),
              UIImages.get(CLOSE_ICON)); // $NON-NLS-1$
      pbClose.addActionListener(this);
      pbClose.setEnabled(true);
      tbrToolBar.add(pbClose);
      CSH.setHelpIDString(pbClose, "toolbars.main"); // $NON-NLS-1$

      tbrToolBar.addSeparator();
    }

    pbCut =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.cut"),
            UIImages.get(CUT_ICON)); // $NON-NLS-1$
    pbCut.addActionListener(this);
    pbCut.setEnabled(false);
    tbrToolBar.add(pbCut);
    CSH.setHelpIDString(pbCut, "toolbars.main"); // $NON-NLS-1$

    pbCopy =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.copy"),
            UIImages.get(COPY_ICON)); // $NON-NLS-1$
    pbCopy.addActionListener(this);
    pbCopy.setEnabled(false);
    tbrToolBar.add(pbCopy);
    CSH.setHelpIDString(pbCopy, "toolbars.main"); // $NON-NLS-1$

    pbPaste =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.paste"),
            UIImages.get(PASTE_ICON)); // $NON-NLS-1$
    pbPaste.addActionListener(this);
    pbPaste.setEnabled(false);
    tbrToolBar.add(pbPaste);
    CSH.setHelpIDString(pbPaste, "toolbars.main"); // $NON-NLS-1$

    pbDelete =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.delete"),
            UIImages.get(DELETE_ICON)); // $NON-NLS-1$
    pbDelete.addActionListener(this);
    pbDelete.setEnabled(false);
    tbrToolBar.add(pbDelete);
    CSH.setHelpIDString(pbDelete, "toolbars.main"); // $NON-NLS-1$

    tbrToolBar.addSeparator();

    pbUndo =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.undo"),
            UIImages.get(UNDO_ICON)); // $NON-NLS-1$
    pbUndo.addActionListener(this);
    pbUndo.setEnabled(false);
    tbrToolBar.add(pbUndo);
    CSH.setHelpIDString(pbUndo, "toolbars.main"); // $NON-NLS-1$

    pbRedo =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.redo"),
            UIImages.get(REDO_ICON)); // $NON-NLS-1$
    pbRedo.addActionListener(this);
    pbRedo.setEnabled(false);
    tbrToolBar.add(pbRedo);
    CSH.setHelpIDString(pbRedo, "toolbars.main"); // $NON-NLS-1$

    tbrToolBar.addSeparator();

    pbShowBackHistory =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.backTo"),
            UIImages.get(PREVIOUS_ICON)); // $NON-NLS-1$
    pbShowBackHistory.addActionListener(this);
    pbShowBackHistory.setEnabled(false);
    tbrToolBar.add(pbShowBackHistory);
    CSH.setHelpIDString(pbShowBackHistory, "toolbars.main"); // $NON-NLS-1$

    pbBack =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.back"),
            UIImages.get(BACK_ICON)); // $NON-NLS-1$
    pbBack.addActionListener(this);
    pbBack.setEnabled(false);
    tbrToolBar.add(pbBack);
    CSH.setHelpIDString(pbBack, "toolbars.main"); // $NON-NLS-1$

    pbForward =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forward"),
            UIImages.get(FORWARD_ICON)); // $NON-NLS-1$
    pbForward.addActionListener(this);
    pbForward.setEnabled(false);
    tbrToolBar.add(pbForward);
    CSH.setHelpIDString(pbForward, "toolbars.main"); // $NON-NLS-1$

    pbShowForwardHistory =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forwardTo"),
            UIImages.get(NEXT_ICON)); // $NON-NLS-1$
    pbShowForwardHistory.addActionListener(this);
    pbShowForwardHistory.setEnabled(false);
    tbrToolBar.add(pbShowForwardHistory);
    CSH.setHelpIDString(pbShowForwardHistory, "toolbars.main"); // $NON-NLS-1$

    tbrToolBar.addSeparator();

    pbImageRollover =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.imageRollover"),
            UIImages.get(IMAGE_ROLLOVER_ICON)); // $NON-NLS-1$
    pbImageRollover.addActionListener(this);
    pbImageRollover.setEnabled(true);
    tbrToolBar.add(pbImageRollover);
    CSH.setHelpIDString(pbImageRollover, "toolbars.main"); // $NON-NLS-1$

    pbSearch =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.search"),
            UIImages.get(SEARCH_ICON)); // $NON-NLS-1$
    pbSearch.addActionListener(this);
    pbSearch.setEnabled(true);
    tbrToolBar.add(pbSearch);
    CSH.setHelpIDString(pbSearch, "toolbars.main"); // $NON-NLS-1$

    pbHelp =
        tbrToolBar.createToolBarButton(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.helpOnItem"),
            UIImages.get(HELP_ICON)); // $NON-NLS-1$
    if (((UIToolBarManager) oManager).getHelpBroker() != null) {
      pbHelp.addActionListener(
          new CSH.DisplayHelpAfterTracking(((UIToolBarManager) oManager).getHelpBroker()));
    }

    pbHelp.setEnabled(true);
    tbrToolBar.add(pbHelp);

    return tbrToolBar;
  }
  /**
   * Constructor. Create a new instance of this class.
   *
   * @param view com.compendium.core.datamodel.View, the view associated with this frame.
   * @param title, the title for this frame.
   */
  public UIMovieMapViewFrame(View view, String title) {
    super(view, title);

    oMovieMapView = (MovieMapView) view;
    sBaseTitle = new String("[Movie Map]: "); // $NON-NLS-1$

    this.oContentPane.setLayout(new BorderLayout());
    this.oView = view;
    this.oSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    this.oSplitPane.setOneTouchExpandable(true);
    this.oSplitPane.setDividerSize(10);
    this.oSplitPane.setContinuousLayout(true);

    addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent event) {
            int height = getHeight();
            float position = height * 0.75f;
            oSplitPane.setDividerLocation(new Float(position).intValue());
          }
        });

    // Must be done before UIMovieMapViewPane called as it needs controllerpanel.
    this.oMapPanel = new JPanel(new BorderLayout());
    updateFrameIcon();

    // A Workaround since the scrollbar never sizes on the JLayeredPane for some reason
    // therefore created a panel and added the viewpane to it and finally added the panel
    // to the scrollpane
    // the setPreferredSize is for the scrollpane to resize.
    // By overriding getPreferredSize in the JPanel, as the JScrollpane calls to find out how big
    // the JPanel is .
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setPreferredSize(new Dimension(30000, 30000));

    this.scrollpane =
        new JScrollPane(
            panel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    (scrollpane.getVerticalScrollBar()).setUnitIncrement(50);
    (scrollpane.getHorizontalScrollBar()).setUnitIncrement(50);

    this.oViewport = scrollpane.getViewport();

    CSH.setHelpIDString(this, "node.planning"); // $NON-NLS-1$

    horizontalBar = scrollpane.getHorizontalScrollBar();
    verticalBar = scrollpane.getVerticalScrollBar();

    oMapPanel.add(scrollpane, BorderLayout.CENTER);
    oSplitPane.setLeftComponent(oMapPanel);
    oContentPane.add(oSplitPane, BorderLayout.CENTER);

    setTitle(title);

    this.oMovieMapViewPane = new UIMovieMapViewPane(view, this);
    this.oViewPane = (UIViewPane) oMovieMapViewPane;
    panel.add(oMovieMapViewPane, BorderLayout.CENTER);

    oTimeLinePanel = new UITimeLinesPanel(oMovieMapViewPane);
    oSplitPane.setRightComponent(oTimeLinePanel);

    this.setVisible(true);
  }