/**
   * Updates menu configuration
   *
   * @param menu
   * @param prefix (in properties file)
   */
  public void configureMenu(JMenu menu, String prefix) {
    menu.setName(prefix);
    String text = bundle.getString(prefix + ".text");
    menu.setText(text);
    try {
      String mnemonic = bundle.getString(prefix + ".mnemonic");
      menu.setMnemonic(mnemonic.charAt(0));
    } catch (MissingResourceException exception) {
      // ok not to set mnemonic
    }

    try {
      String tooltip = bundle.getString(prefix + ".tooltip");
      menu.setToolTipText(tooltip);
    } catch (MissingResourceException exception) {
      // ok not to set tooltip
    }

    try {
      String iconPath = bundle.getString(prefix + ".icon");
      if (iconPath != null) {
        ImageIcon icon = new ImageIcon(this.referenceClass.getResource(iconPath));
        menu.setIcon(icon);
      }
    } catch (MissingResourceException exception) {
      // ok not to set tooltip
    }
  }
  private void createCustomerMenu() {

    // Customer menu
    customerMenu = new JMenu("Customer");
    customerMenu.setMnemonic(KeyEvent.VK_C);
    customerMenu.setToolTipText("Customer");
    add(customerMenu);

    // Customer/View All Customers menu item
    viewAllCustomersMenuItem = new JMenuItem("View All Customers");
    viewAllCustomersMenuItem.setToolTipText("View all customers.");
    viewAllCustomersMenuItem.setActionCommand("MainMenu--View All Customers");
    viewAllCustomersMenuItem.addActionListener(actionListener);
    customerMenu.add(viewAllCustomersMenuItem);
  } // end of MainMenu::createCustomerMenu
  private void createFileMenu() {

    // File menu
    fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    fileMenu.setToolTipText("File");
    add(fileMenu);

    // File/Exit menu item
    exitMenuItem = new JMenuItem("Exit");
    exitMenuItem.setMnemonic(KeyEvent.VK_X);
    exitMenuItem.setToolTipText("Exit the program.");
    exitMenuItem.setActionCommand("MainMenu--Exit");
    exitMenuItem.addActionListener(actionListener);
    fileMenu.add(exitMenuItem);
  } // end of MainMenu::createFileMenu
 public void updateText() {
   fileMenu.setText(InternationalMessages.getString("ZTerm.Connect_Menu_Text")); // $NON-NLS-1$
   languageMenu.setText("Language");
   languageMenu.setToolTipText("Change your language");
   historyMenu.setText(InternationalMessages.getString("ZTerm.Site_Menu_Text"));
   viewMenu.setText(InternationalMessages.getString("ZTerm.View_Menu_Text")); // $NON-NLS-1$
   historyMenu.setText(InternationalMessages.getString("ZTerm.History_Menu_Text")); // $NON-NLS-1$
   editMenu.setText(InternationalMessages.getString("ZTerm.Edit_Menu_Text")); // $NON-NLS-1$
   toolsMenu.setText(InternationalMessages.getString("ZTerm.Option_Menu_Text")); // $NON-NLS-1$
   helpMenu.setText(InternationalMessages.getString("ZTerm.Help_Menu_Text")); // $NON-NLS-1$
   encodingMenu.setText(
       InternationalMessages.getString("ZTerm.Encoding_Menu_Text")); // $NON-NLS-1$
   openItem.setText(InternationalMessages.getString("ZTerm.Open_MenuItem_Text")); // $NON-NLS-1$
   closeItem.setText(InternationalMessages.getString("ZTerm.Close_MenuItem_Text")); // $NON-NLS-1$
   reopenItem.setText(InternationalMessages.getString("ZTerm.Reopen_Item_Text")); // $NON-NLS-1$
   copyItem.setText(InternationalMessages.getString("ZTerm.Copy_MenuItem_Text")); // $NON-NLS-1$
   pasteItem.setText(InternationalMessages.getString("ZTerm.Paste_MenuItem_Text")); // $NON-NLS-1$
   colorCopyItem.setText(
       InternationalMessages.getString("ZTerm.ColorCopy_MenuItem_Text")); // $NON-NLS-1$
   colorPasteItem.setText(
       InternationalMessages.getString("ZTerm.ColorPaste_MenuItem_Text")); // $NON-NLS-1$
   preferenceItem.setText(
       InternationalMessages.getString("ZTerm.Preference_MenuItem_Text")); // $NON-NLS-1$
   siteManagerItem.setText(
       InternationalMessages.getString("ZTerm.SiteManager_MenuItem_Text")); // $NON-NLS-1$
   usageItem.setText(InternationalMessages.getString("ZTerm.Usage_MenuItem_Text")); // $NON-NLS-1$
   faqItem.setText(InternationalMessages.getString("ZTerm.FAQ_MenuItem_Text")); // $NON-NLS-1$
   aboutItem.setText(InternationalMessages.getString("ZTerm.About_MenuItem_Text")); // $NON-NLS-1$
   big5Item.setText(InternationalMessages.getString("ZTerm.Big5_MenuItem_Text")); // $NON-NLS-1$
   utf8Item.setText(InternationalMessages.getString("ZTerm.UTF8_MenuItem_Text")); // $NON-NLS-1$
   hideMenuBarItem.setText(
       InternationalMessages.getString("ZTerm.HideMenuBar_MenuItem_Text")); // $NON-NLS-1$
   showMenuBarItem.setText(
       InternationalMessages.getString("ZTerm.ShowMenuBar_MenuItem_Text")); // $NON-NLS-1$
   popupCopyLinkItem.setText(
       InternationalMessages.getString("ZTerm.Popup_CopyLink_MenuItem_Text")); // $NON-NLS-1$
   popupCopyItem.setText(
       InternationalMessages.getString("ZTerm.Copy_MenuItem_Text")); // $NON-NLS-1$
   popupPasteItem.setText(
       InternationalMessages.getString("ZTerm.Paste_MenuItem_Text")); // $NON-NLS-1$
   popupColorCopyItem.setText(
       InternationalMessages.getString("ZTerm.ColorCopy_MenuItem_Text")); // $NON-NLS-1$
   popupColorPasteItem.setText(
       InternationalMessages.getString("ZTerm.ColorPaste_MenuItem_Text")); // $NON-NLS-1$
   popupCloseItem.setText(InternationalMessages.getString("ZTerm.Close_MenuItem_Text"));
 }
  private void createHelpMenu() {

    // Help menu
    helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    helpMenu.setToolTipText("Help");
    add(helpMenu);

    // Help/About menu item
    aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.setMnemonic(KeyEvent.VK_A);
    aboutMenuItem.setToolTipText("Display the About window.");
    aboutMenuItem.setActionCommand("MainMenu--Display About");
    aboutMenuItem.addActionListener(actionListener);
    helpMenu.add(aboutMenuItem);

    // Help/Help menu item
    helpMenuItem = new JMenuItem("Help");
    helpMenuItem.setMnemonic(KeyEvent.VK_H);
    helpMenuItem.setToolTipText("Display the Help window.");
    helpMenuItem.setActionCommand("MainMenu--Display Help");
    helpMenuItem.addActionListener(actionListener);
    helpMenu.add(helpMenuItem);
  } // end of MainMenu::createHelpMenu
  public static JMenuBar creaetMenuBar() {
    JMenuBar menubar = new JMenuBar();
    ImageIcon icon = new ImageIcon("exit.png");

    JMenu file = new JMenu("Password Manager");
    file.setMnemonic(KeyEvent.VK_F);

    JMenu profileItem = new JMenu("Profile");
    profileItem.setMnemonic(KeyEvent.VK_E);
    profileItem.setToolTipText("User Profile");

    JMenuItem changePassword = new JMenuItem("Change Password", icon);
    changePassword.setMnemonic(KeyEvent.VK_E);
    changePassword.setToolTipText("Change User Login Password");

    JMenuItem changeSecurityKey = new JMenuItem("Change SecutrityKey", icon);
    changeSecurityKey.setMnemonic(KeyEvent.VK_E);
    changeSecurityKey.setToolTipText("Change SecutrityKey");

    JMenuItem changeIdleTimeOut = new JMenuItem("Change Idle TimeOut", icon);
    changeIdleTimeOut.setMnemonic(KeyEvent.VK_E);
    changeIdleTimeOut.setToolTipText("Change Idle TimeOut");

    changeIdleTimeOut.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            //				JOptionPane.showMessageDialog(null, "Successfully Register");
            cardLayout = (CardLayout) PasswordManager.cards.getLayout();
            cardLayout.show(PasswordManager.cards, PasswordManager.updateIdleTimeOut.getName());
          }
        });

    changePassword.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            //				JOptionPane.showMessageDialog(null, "Successfully Register");
            cardLayout = (CardLayout) PasswordManager.cards.getLayout();
            cardLayout.show(PasswordManager.cards, PasswordManager.updateLoginPassword.getName());
          }
        });

    profileItem.add(changePassword);
    profileItem.add(changeSecurityKey);
    profileItem.add(changeIdleTimeOut);

    JMenuItem settings = new JMenuItem("Settings", icon);
    settings.setMnemonic(KeyEvent.VK_E);
    settings.setToolTipText("User Settings");

    JMenuItem eMenuItem = new JMenuItem("Exit", icon);
    eMenuItem.setMnemonic(KeyEvent.VK_E);
    eMenuItem.setToolTipText("Exit application");
    eMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            System.exit(0);
          }
        });
    file.add(profileItem);
    file.add(settings);
    file.add(eMenuItem);
    menubar.add(file);
    return menubar;
  }
  /**
   * Instantiates a new component source.
   *
   * @param window the window
   */
  public ComponentSource(final NavigatorWindow window) {
    super();
    this.actionPool = new ActionPool(this, window);
    this.window = window;
    this.addressField = new AddressField(this);
    this.progressBar = new ProgressBar();
    this.statusMessageComponent = new JLabel();
    this.searchButton = this.getSearchButton();
    this.updateSearchButtonTooltip();
    JMenu bookmarksMenu = new JMenu("Recent Bookmarks");
    this.recentBookmarksMenu = bookmarksMenu;
    bookmarksMenu.setMnemonic('R');
    bookmarksMenu.addMenuListener(
        new MenuAdapter() {
          @Override
          public void menuSelected(MenuEvent e) {
            populateRecentBookmarks();
          }
        });
    JMenu taggedBookmarksMenu = new JMenu("Tagged Bookmarks");
    this.taggedBookmarksMenu = taggedBookmarksMenu;
    taggedBookmarksMenu.setMnemonic('T');
    taggedBookmarksMenu.setToolTipText(
        "Shows up to "
            + PREFERRED_MAX_MENU_SIZE
            + " tags with up to "
            + PREFERRED_MAX_MENU_SIZE
            + " recent bookmarks each.");
    taggedBookmarksMenu.addMenuListener(
        new MenuAdapter() {
          @Override
          public void menuSelected(MenuEvent e) {
            populateTaggedBookmarks();
          }
        });
    JMenu backMoreMenu = new JMenu();
    // BackMoreAction only used for enabling
    backMoreMenu.setAction(new BackMoreAction(this, window, actionPool));
    backMoreMenu.addMenuListener(
        new MenuAdapter() {
          @Override
          public void menuSelected(MenuEvent e) {
            populateBackMore();
          }
        });
    this.backMoreMenu = backMoreMenu;
    backMoreMenu.setText("Back To");
    JMenu forwardMoreMenu = new JMenu();
    // ForwardMoreAction only used for enabling
    forwardMoreMenu.setAction(new ForwardMoreAction(this, window, actionPool));
    forwardMoreMenu.addMenuListener(
        new MenuAdapter() {
          @Override
          public void menuSelected(MenuEvent e) {
            populateForwardMore();
          }
        });
    this.forwardMoreMenu = forwardMoreMenu;
    forwardMoreMenu.setText("Forward To");

    JMenu searchersMenu = new JMenu();
    searchersMenu.addMenuListener(
        new MenuAdapter() {
          @Override
          public void menuSelected(MenuEvent e) {
            populateSearchers();
          }
        });
    this.searchersMenu = searchersMenu;
    searchersMenu.setText("Searching With");
    searchersMenu.setToolTipText(
        "Select the search engine that is used by the Search button in the address bar.");
  }
  protected JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);

    //   [N]ew
    JMenu fileNew = new JMenu("New");
    fileNew.setMnemonic(KeyEvent.VK_N);

    JMenuItem fileNewObject = new JMenuItem("Data Object", KeyEvent.VK_O);
    fileNewObject.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
    fileNewObject.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new NewObjectDialog(OBJECT_TYPE.dataObject, "New Object");
          }
        });

    JMenuItem fileNewCModel = new JMenuItem("Content Model", KeyEvent.VK_C);
    fileNewCModel.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new NewObjectDialog(OBJECT_TYPE.contentModel, "New Content Model");
          }
        });

    JMenuItem fileNewSDef = new JMenuItem("Service Definition", KeyEvent.VK_D);
    fileNewSDef.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new NewObjectDialog(OBJECT_TYPE.serviceDefinition, "New Service Definition");
          }
        });

    JMenuItem fileNewSDep = new JMenuItem("Service Deployment", KeyEvent.VK_M);
    fileNewSDep.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new NewObjectDialog(OBJECT_TYPE.serviceDeployment, "New Service Deployment");
          }
        });

    fileNew.add(fileNewObject);
    fileNew.add(fileNewCModel);
    fileNew.add(fileNewSDef);
    fileNew.add(fileNewSDep);

    //   [O]pen
    JMenuItem fileOpen = new JMenuItem(new ViewObject());
    fileOpen.setMnemonic(KeyEvent.VK_O);
    fileOpen.setToolTipText("Launches a viewer/editor for an object and it's components.");
    fileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));

    //   [I]ngest
    JMenu fileIngest = new JMenu("Ingest");
    fileIngest.setMnemonic(KeyEvent.VK_I);
    JMenu fileIngestOne = new JMenu("One Object");
    fileIngestOne.setMnemonic(KeyEvent.VK_O);
    JMenuItem fileIngestOneFromFile = new JMenuItem("From File...", KeyEvent.VK_F);
    fileIngestOneFromFile.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new IngestDialog(IngestDialog.ONE_FROM_FILE);
          }
        });
    JMenuItem fileIngestOneFromRepository = new JMenuItem("From Repository...", KeyEvent.VK_R);
    fileIngestOneFromRepository.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK));
    fileIngestOneFromRepository.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new IngestDialog(IngestDialog.ONE_FROM_REPOS);
          }
        });
    fileIngestOne.add(fileIngestOneFromFile);
    fileIngestOne.add(fileIngestOneFromRepository);
    JMenu fileIngestMultiple = new JMenu("Multiple Objects");
    fileIngestMultiple.setMnemonic(KeyEvent.VK_M);
    JMenuItem fileIngestMultipleFromFile = new JMenuItem("From Directory...", KeyEvent.VK_D);
    fileIngestMultipleFromFile.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new IngestDialog(IngestDialog.MULTI_FROM_DIR);
          }
        });
    JMenuItem fileIngestMultipleFromRepository = new JMenuItem("From Repository...", KeyEvent.VK_R);
    fileIngestMultipleFromRepository.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new IngestDialog(IngestDialog.MULTI_FROM_REPOS);
          }
        });

    fileIngestMultiple.add(fileIngestMultipleFromFile);
    fileIngestMultiple.add(fileIngestMultipleFromRepository);
    fileIngest.add(fileIngestOne);
    fileIngest.add(fileIngestMultiple);

    //   [E]xport
    JMenu fileExport = new JMenu("Export");
    fileExport.setMnemonic(KeyEvent.VK_E);

    JMenuItem fileExportObject = new JMenuItem("One Object...");
    fileExportObject.setMnemonic(KeyEvent.VK_O);
    fileExportObject.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
    fileExportObject.setToolTipText("Exports a serialized Digitial Object to disk.");
    fileExportObject.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new ExportDialog(ExportDialog.ONE);
          }
        });

    JMenuItem fileExportMultiple = new JMenuItem("Multiple Objects...");
    fileExportMultiple.setMnemonic(KeyEvent.VK_M);
    fileExportMultiple.setToolTipText("Exports multiple serialized Digitial Objects to disk.");
    fileExportMultiple.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new ExportDialog(ExportDialog.MULTI);
          }
        });
    fileExport.add(fileExportObject);
    fileExport.add(fileExportMultiple);

    //     [V]iew Object XML
    JMenuItem fileViewXML = new JMenuItem(new ViewObjectXML());
    fileViewXML.setMnemonic(KeyEvent.VK_V);
    fileViewXML.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
    fileViewXML.setToolTipText(
        "Launches a viewer for the internal XML of an object in the repository.");
    //     [P]urge Object
    JMenuItem filePurge = new JMenuItem(new PurgeObject());
    filePurge.setMnemonic(KeyEvent.VK_P);
    filePurge.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK));
    filePurge.setToolTipText("Permanently removes a Digitial Object from the repository.");

    //   [L]ogin
    JMenuItem fileLogin = new JMenuItem(new Login());
    fileLogin.setMnemonic(KeyEvent.VK_R);
    fileLogin.setToolTipText("Changes the working repository.");
    fileLogin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK));

    //   E[x]it
    JMenuItem fileExit = new JMenuItem("Exit", KeyEvent.VK_X);
    fileExit.setToolTipText("Exits the application");
    fileExit.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            dispose();
            System.exit(0);
          }
        });

    fileMenu.add(fileNew);
    fileMenu.add(fileOpen);
    fileMenu.addSeparator();
    fileMenu.add(fileIngest);
    fileMenu.add(fileExport);
    fileMenu.addSeparator();
    fileMenu.add(filePurge);
    fileMenu.add(fileViewXML);
    fileMenu.addSeparator();
    fileMenu.add(fileLogin);
    fileMenu.add(fileExit);

    menuBar.add(fileMenu);

    JMenu toolsMenu = new JMenu("Tools");
    toolsMenu.setMnemonic(KeyEvent.VK_T);

    JMenuItem toolsSearch = new JMenuItem("Search/Browse Repository", KeyEvent.VK_S);
    toolsSearch.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    toolsSearch.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            createSearchRepository();
          }
        });
    toolsMenu.add(toolsSearch);

    JMenu toolsBatchSubMenu = new JMenu("Batch");

    JMenuItem toolsBatchBuild = new JMenuItem("Build Batch" /* , KeyEvent.VK_A */);
    toolsBatchBuild.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            createBatchBuildConsole();
          }
        });
    toolsBatchSubMenu.add(toolsBatchBuild);

    JMenuItem toolsBatchBuildIngest = new JMenuItem("Build and Ingest Batch" /*
                 * , KeyEvent.VK_A
                 */);
    toolsBatchBuildIngest.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            createBatchBuildIngestConsole();
          }
        });
    toolsBatchSubMenu.add(toolsBatchBuildIngest);

    JMenuItem toolsBatchIngest = new JMenuItem("Ingest Batch" /*
         * ,
         * KeyEvent.VK_A
         */);
    toolsBatchIngest.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            createBatchIngestConsole();
          }
        });
    toolsBatchSubMenu.add(toolsBatchIngest);

    JMenu toolsBatchModify = new JMenu("Modify Batch");
    toolsBatchModify.setMnemonic(KeyEvent.VK_M);
    JMenuItem executeBatchModify = new JMenuItem("Process Directives", KeyEvent.VK_P);
    toolsBatchModify.setToolTipText(
        "Modifies a batch of objects based on " + "modify directives specified in a file on disk.");
    executeBatchModify.setToolTipText("Run the Batch Modify Utility.");
    executeBatchModify.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new BatchModify();
          }
        });
    toolsBatchModify.add(executeBatchModify);

    JMenuItem validateBatchModify = new JMenuItem("Validate Directives File", KeyEvent.VK_V);
    validateBatchModify.setToolTipText(
        "Validate the modify directives file against the batchModify XML Schema.");
    validateBatchModify.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            new BatchModifyValidate();
          }
        });

    toolsBatchModify.add(validateBatchModify);

    toolsBatchSubMenu.add(toolsBatchModify);
    toolsMenu.addSeparator();
    toolsMenu.add(toolsBatchSubMenu);

    //     [A]ccess Console
    JMenuItem toolsAccess = new JMenuItem("Access API", KeyEvent.VK_A);
    toolsAccess.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            createAccessConsole();
          }
        });
    //     [M]anagement Console
    JMenuItem toolsManagement = new JMenuItem("Management API", KeyEvent.VK_M);
    toolsManagement.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            createManagementConsole();
          }
        });

    JMenu toolsConsole = new JMenu("Console");
    toolsConsole.setMnemonic(KeyEvent.VK_C);
    toolsConsole.add(toolsAccess);
    toolsConsole.add(toolsManagement);
    toolsMenu.add(toolsConsole);

    menuBar.add(toolsMenu);

    WindowMenu windowMenu = new WindowMenu(s_desktop, "Window");
    windowMenu.setMnemonic(KeyEvent.VK_W);
    menuBar.add(windowMenu);

    // [H]elp
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    JMenuItem helpContents = new JMenuItem("Documentation", KeyEvent.VK_D);
    String portPart = "";
    if (getPort() != 80) {
      portPart = ":" + getPort();
    }
    String documentationURL = getProtocol() + "://" + getHost() + portPart + "/userdocs/";
    helpContents.setToolTipText("See " + documentationURL);

    helpContents.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            String portPart = "";
            if (getPort() != 80) {
              portPart = ":" + getPort();
            }
            String documentationURL = getProtocol() + "://" + getHost() + portPart + "/userdocs/";
            JOptionPane.showMessageDialog(
                getDesktop(),
                "For documentation, see " + documentationURL,
                "Fedora Documentation",
                JOptionPane.INFORMATION_MESSAGE);
          }
        });

    m_aboutDialog = new JDialog(this, "About Fedora Administrator", true);

    m_aboutDialog.getContentPane().add(m_aboutPic, BorderLayout.CENTER);
    JButton aboutClose = new JButton("Close");

    JPanel infoAndButton = new JPanel();
    infoAndButton.setLayout(new BorderLayout());
    infoAndButton.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
    infoAndButton.add(m_aboutText);

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(aboutClose);
    infoAndButton.add(buttonPane, BorderLayout.SOUTH);

    m_aboutDialog.getContentPane().add(infoAndButton, BorderLayout.SOUTH);
    aboutClose.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            m_aboutDialog.setVisible(false);
          }
        });
    m_aboutDialog.pack();

    JMenuItem helpAbout = new JMenuItem("About Fedora Administrator", KeyEvent.VK_A);
    helpAbout.setToolTipText("Gives brief information this application");
    helpAbout.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            m_aboutDialog.setLocation(
                getCenteredPos(m_aboutDialog.getWidth(), m_aboutDialog.getHeight()));
            m_aboutDialog.setVisible(true);
          }
        });

    helpMenu.add(helpContents);
    helpMenu.addSeparator();
    helpMenu.add(helpAbout);

    menuBar.add(helpMenu);

    return menuBar;
  }
Beispiel #9
0
  /** *********************************************************************** */
  private void initComponents() {

    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
    // container.setLayout( new PercentLayout() );
    container.setBackground(Color.black);

    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            System.out.println("Trace viewer closed!");
            // System.exit(0);
          }
        });

    /** ******************** Menu bar ************************************* */
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    // Build a second menu in the menu bar.
    optionsMenu = new JMenu("      Options      ");
    optionsMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    optionsMenu.setToolTipText("Some options related to the GUI");
    animationMenuItem = new JMenuItem("    Animation    ");
    animationMenuItem.setToolTipText("Animation of the entire selected session");
    animationMenuItem.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            listenerTracesViewer.animationActionPerformed(evt);
          }
        });
    optionsMenu.add(animationMenuItem);
    menuBar.add(optionsMenu);

    // create a menu and add it to the menubar
    displayAllSessionsMenu = new JMenu("    Display Sessions    ");
    displayAllSessionsMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    displayAllSessionsMenu.setToolTipText(
        "Display all the retrieved sessions in a separate windows");
    displayAllSessionsMenu.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent evt) {
            listenerTracesViewer.displayAllSessionsMouseEvent(evt);
          }
        });
    // add the Controls menu to the menu bar
    menuBar.add(displayAllSessionsMenu);

    // create a menu and add it to the menubar
    refreshMenu = new JMenu("   Refresh   ");
    refreshMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    refreshMenu.setBackground(new Color(51, 153, 255));
    refreshMenu.setToolTipText("Get the new traces");
    refreshMenu.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent evt) {
            listenerTracesViewer.refreshActionPerformed(evt);
          }
        });
    // add the Controls menu to the menu bar
    menuBar.add(refreshMenu);

    // ...create and add some menus...
    menuBar.add(Box.createHorizontalGlue());

    helpMenu = new JMenu("    Help    ");
    helpMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    helpMenu.setToolTipText("Some useful notes about this tool");
    helpMenu.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent evt) {
            listenerTracesViewer.helpMenuMouseEvent(evt);
          }
        });
    menuBar.add(helpMenu);

    aboutMenu = new JMenu("    About    ");
    aboutMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    aboutMenu.setToolTipText("Some advertises about the creators!");
    aboutMenu.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent evt) {
            listenerTracesViewer.aboutMenuMouseEvent(evt);
          }
        });
    menuBar.add(aboutMenu);

    quitMenu = new JMenu("    Quit    ");
    quitMenu.setBorder(new BevelBorder(BevelBorder.RAISED));
    quitMenu.setToolTipText("Quit the traces viewer");
    quitMenu.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent evt) {
            close();
          }
        });
    menuBar.add(quitMenu);

    /** ****************** FIRST PANEL ******************************* */
    firstPanel = new JPanel();
    // If put to False: we see the container's background
    firstPanel.setOpaque(false);
    firstPanel.setLayout(new PercentLayout());
    // firstPanel.setLayout(  new BorderLayout() );
    container.add(firstPanel);

    // Sub right panel:
    // topx %, topy %, width %, height % 73, 100-> 65, 95
    PercentLayoutConstraint firstPanelConstraint = new PercentLayoutConstraint(30, 0, 70, 100);
    tracesSessionsList = new TracesSessionsList();
    tracesSessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            listenerTracesViewer.tracesSessionsListStateChanged(e);
          }
        });
    tracesSessionsList.setForeground(Color.black);
    tracesSessionsList.setFont(new Font("Dialog", 1, 14));

    ScrollPane scroll = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
    TracesSession tracesSession = tracesSessions.firstElement();
    String name = tracesSession.getName();
    String logDescription = tracesSession.getLogDescription();
    String callId = tracesSessionsList.getCallId(name);
    String origin = tracesSessionsList.getOrigin(name);

    // Warning: to put before for the canvas!!!!
    TextArea messageContentTextArea = new TextArea();
    messageContentButton = new JButton("SIP Message:");
    if (name.equals("No available session, refresh")) {
      tracesCanvas = new TracesCanvas(tracesSession, messageContentTextArea, "unknown", this);
    } else if (logDescription == null || logDescription.trim().equals("")) {
      tracesCanvas = new TracesCanvas(tracesSession, messageContentTextArea, origin, this);
    } else {
      //  System.out.println("logDesc44:"+logDescription);
      tracesCanvas = new TracesCanvas(tracesSession, messageContentTextArea, logDescription, this);
    }

    tracesSessionsList.setTracesCanvas(tracesCanvas);
    // The ScrollPane for the Canvas
    scroll.add(tracesCanvas);
    firstPanel.add(scroll, firstPanelConstraint);

    /** ************************* SECOND PANEL ******************************* */

    //  left panel:
    secondPanel = new JPanel();
    secondPanel.setBackground(Color.black);
    // rows, columns
    //  secondPanel.setLayout(new GridLayout(3,1,0,0) );
    secondPanel.setLayout(new BorderLayout());
    // topx %, topy %, width %, height %
    PercentLayoutConstraint secondPanelConstraint = new PercentLayoutConstraint(0, 0, 30, 100);
    firstPanel.add(secondPanel, secondPanelConstraint);

    /** **************************** FIRST SUB PANEL ********************************* */

    // Sub left panel:
    firstSubPanel = new JPanel();
    firstSubPanel.setBackground(Color.black);
    // Top, left, bottom, right
    firstSubPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5));

    if (!standaloneViewer) {
      // rows, columns, gap, gap
      firstSubPanel.setLayout(new GridLayout(2, 1, 3, 6));
      secondPanel.add(firstSubPanel, BorderLayout.NORTH);

      JPanel panelGrid = new JPanel();
      panelGrid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      panelGrid.setLayout(new GridLayout(2, 1, 0, 0));

      JPanel panelBox = new JPanel();
      panelBox.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
      panelBox.setLayout(new BorderLayout());

      JLabel scriptLabel = new JLabel("Display the event script:");
      scriptLabel.setToolTipText("Display the content of the selected script");

      scriptLabel.setHorizontalAlignment(SwingConstants.CENTER);
      scriptLabel.setForeground(Color.black);
      scriptLabel.setFont(new Font("Dialog", 1, 14));
      // If put to true: we see the label's background
      scriptLabel.setOpaque(true);
      panelGrid.add(scriptLabel);

      choice = new Choice();
      panelBox.add(choice, BorderLayout.CENTER);

      scriptButton = new JButton("Open");
      scriptButton.setToolTipText("Get the script controlling the current session");
      scriptButton.setFont(new Font("Dialog", 1, 14));
      scriptButton.setFocusPainted(false);
      scriptButton.setBackground(new Color(186, 175, 175));
      scriptButton.setBorder(new BevelBorder(BevelBorder.RAISED));
      scriptButton.setVerticalAlignment(SwingConstants.CENTER);
      scriptButton.setHorizontalAlignment(SwingConstants.CENTER);
      panelBox.add(scriptButton, BorderLayout.EAST);
      scriptButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
              listenerTracesViewer.scriptActionPerformed(evt);
            }
          });
      panelGrid.add(panelBox);
      firstSubPanel.add(panelGrid);
      // initComboBox();

      /*
      refreshButton=new JButton("Refresh");
      refreshButton.setToolTipText("Refresh all the sessions");
      refreshButton.setFont(new Font ("Dialog", 1, 14));
      refreshButton.setFocusPainted(false);
      //refreshButton.setBackground(new Color(186,175,175));
      refreshButton.setBackground( new Color(51,153,255));
      refreshButton.setBorder(new BevelBorder(BevelBorder.RAISED));
      refreshButton.setVerticalAlignment(AbstractButton.CENTER);
      refreshButton.setHorizontalAlignment(AbstractButton.CENTER);
      firstSubPanel.add(refreshButton);
      refreshButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
               listenerTracesViewer.refreshActionPerformed(evt);
         }
      }
      );
       */
      ImageIcon icon;
      if (logoNist != null) {
        icon = new ImageIcon(logoNist);

        JLabel label = new JLabel(icon);
        label.setVisible(true);
        label.setToolTipText("The NIST logo!!!");
        // label.setHorizontalAlignment(AbstractButton.CENTER);
        label.setForeground(Color.black);
        // label.setFont(new Font ("Dialog", 1, 14));
        label.setOpaque(false);
        firstSubPanel.add(label);
      }
    } else {
      // rows, columns, gap, gap
      firstSubPanel.setLayout(new GridLayout(1, 1, 3, 6));
      secondPanel.add(firstSubPanel, BorderLayout.NORTH);

      ImageIcon icon;
      if (logoNist != null) {
        icon = new ImageIcon(logoNist);
        JLabel label = new JLabel(icon);
        label.setVisible(true);
        label.setToolTipText("The NIST logo!!!");
        label.setHorizontalAlignment(SwingConstants.CENTER);
        label.setForeground(Color.black);
        label.setFont(new Font("Dialog", 1, 14));
        label.setOpaque(false);
        firstSubPanel.add(label);
      }
    }

    /** **************** SECOND SUB PANEL *************************************** */
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 1, 0, 0));
    secondPanel.add(panel, BorderLayout.CENTER);
    secondSubPanel = new JPanel();
    secondSubPanel.setBackground(Color.black);
    secondSubPanel.setLayout(new BorderLayout());
    // secondPanel.add(secondSubPanel);
    panel.add(secondSubPanel);

    sessionsLabel = new JLabel("Sessions available:");
    sessionsLabel.setToolTipText("All the sessions currently available");
    // Alignment of the text
    sessionsLabel.setHorizontalAlignment(SwingConstants.CENTER);
    // Color of the text
    sessionsLabel.setForeground(Color.black);
    // Size of the text
    sessionsLabel.setFont(new Font("Dialog", 1, 14));
    // If put to true: we see the label's background
    sessionsLabel.setOpaque(true);
    sessionsLabel.setBackground(Color.lightGray);
    sessionsLabel.setBorder(BorderFactory.createLineBorder(Color.darkGray));
    secondSubPanel.add(sessionsLabel, BorderLayout.NORTH);

    ScrollPane scrollList = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
    scrollList.add(tracesSessionsList);
    // secondSubPanel.add(scrollList,BorderLayout.CENTER);
    secondSubPanel.add(tracesSessionsList, BorderLayout.CENTER);

    /** ****************** THIRD SUB PANEL *************************************** */
    thirdSubPanel = new JPanel();
    thirdSubPanel.setBackground(Color.black);
    thirdSubPanel.setLayout(new BorderLayout());
    // secondPanel.add(thirdSubPanel);
    panel.add(thirdSubPanel);

    messageContentButton.setToolTipText("Display all the content of the current SIP message");
    // Alignment of the text
    messageContentButton.setHorizontalAlignment(SwingConstants.CENTER);
    // Color of the text
    messageContentButton.setForeground(Color.black);
    // Size of the text
    messageContentButton.setFont(new Font("Dialog", 1, 14));
    // If put to true: we see the label's background
    messageContentButton.setOpaque(true);
    messageContentButton.setBackground(Color.lightGray);
    messageContentButton.setBorder(BorderFactory.createLineBorder(Color.darkGray));
    messageContentButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            listenerTracesViewer.debugActionPerformed(evt);
          }
        });
    messageContentTextArea.setBackground(Color.white);
    messageContentTextArea.setEditable(false);
    messageContentTextArea.setFont(new Font("Dialog", 1, 12));
    messageContentTextArea.setForeground(Color.black);
    thirdSubPanel.add(messageContentButton, BorderLayout.NORTH);
    thirdSubPanel.add(messageContentTextArea, BorderLayout.CENTER);

    validateTree();
  }
Beispiel #10
0
  /** The graphic handling and deployment. */
  private void initComponents() {
    jDesktopPane1 = new javax.swing.JDesktopPane();
    jInternalFrame1 = new javax.swing.JInternalFrame();
    tf = new javax.swing.JTextField();
    b1 = new javax.swing.JButton();
    jInternalFrame3 = new javax.swing.JInternalFrame();
    ta = new javax.swing.JTextArea();
    jsp_ta = new javax.swing.JScrollPane(ta);
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    jMenuItem4 = new javax.swing.JMenuItem();

    jInternalFrame1
        .getContentPane()
        .setLayout(
            new javax.swing.BoxLayout(
                jInternalFrame1.getContentPane(), javax.swing.BoxLayout.X_AXIS));

    jInternalFrame1.setIconifiable(true);
    jInternalFrame1.setMaximizable(true);
    jInternalFrame1.setResizable(true);
    jInternalFrame1.setTitle("Message editor");
    jInternalFrame1.setToolTipText(
        "Move and resize all of these to make the chat room appearance match your preferences.");
    jInternalFrame1.setVisible(true);
    tf.setFont(new java.awt.Font("Lucida Sans", 0, 12));
    jInternalFrame1.getContentPane().add(tf);

    b1.setText("Send Message");
    jInternalFrame1.getContentPane().add(b1);

    jInternalFrame1.setBounds(10, 10, 440, 60);
    jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);

    jInternalFrame3.setIconifiable(true);
    jInternalFrame3.setMaximizable(true);
    jInternalFrame3.setResizable(true);
    jInternalFrame3.setTitle("Messages");
    jInternalFrame3.setToolTipText(
        "Move and resize all of these to make the chat room appearance match your preferences.");
    jInternalFrame3.setVisible(true);
    ta.setBackground(new Color(255, 255, 255));
    ta.setEditable(false);
    ta.setFont(new java.awt.Font("Lucida Sans", 0, 12));
    // jsp_ta.setAutoscrolls(true);
    jsp_ta.setDoubleBuffered(true);

    jInternalFrame3.getContentPane().add(jsp_ta, java.awt.BorderLayout.CENTER);

    jInternalFrame3.setBounds(10, 80, 420, 240);

    jDesktopPane1.add(jInternalFrame3, javax.swing.JLayeredPane.DEFAULT_LAYER);

    getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);

    jMenu1.setText("Private room options");
    jMenu1.setMnemonic(KeyEvent.VK_O);
    jMenu1.setToolTipText("Choose some options.");
    jMenuItem3.setText("Save conversation");
    jMenuItem3.setMnemonic(KeyEvent.VK_S);
    jMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    jMenu1.add(jMenuItem3);
    jMenu1.add(jSeparator1);
    jMenuItem4.setText("Exit");
    jMenuItem4.setMnemonic(KeyEvent.VK_E);
    jMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
    jMenu1.add(jMenuItem4);
    jMenuBar1.add(jMenu1);
    setJMenuBar(jMenuBar1);

    this.pack();

    b1.addActionListener(this);
    tf.addActionListener(this);
    jMenuItem3.addActionListener(this);
    jMenuItem4.addActionListener(this);

    posx = (int) Math.random() * 640;
    posy = (int) Math.random() * 480;

    this.pack();
    this.setSize(dimx, dimy);
    this.setLocation(posx, posy);
    this.show();
  }