mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
06.48.2009 ad42fe808889ebd10ac8787ae5a36247d69ebe66
opends/src/guitools/org/opends/guitools/controlpanel/ui/MainMenuBar.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.guitools.controlpanel.ui;
@@ -54,6 +54,9 @@
{
  private static final long serialVersionUID = 6441273044772077947L;
  private GenericDialog dlg;
  private RefreshOptionsPanel panel;
  /**
   * Constructor.
   * @param info the control panel information.
@@ -99,6 +102,7 @@
      add(menu);
    }
    add(createViewMenuBar());
    add(createHelpMenuBar());
  }
@@ -134,6 +138,30 @@
    }
  }
  /**
   * Creates the View menu bar.
   * @return the View menu bar.
   */
  protected JMenu createViewMenuBar()
  {
    JMenu menu = Utilities.createMenu(INFO_CTRL_PANEL_VIEW_MENU.get(),
        INFO_CTRL_PANEL_HELP_VIEW_DESCRIPTION.get());
    menu.setMnemonic(KeyEvent.VK_V);
    JMenuItem menuItem = Utilities.createMenuItem(
        INFO_CTRL_PANEL_REFRESH_MENU.get());
    menuItem.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent ev)
      {
        refreshOptionsClicked();
      }
    });
    menu.add(menuItem);
    return menu;
  }
  /**
   * Specific method to be able to handle the Quit events sent from the COCOA
   * menu of Mac OS.
@@ -177,4 +205,30 @@
      t.printStackTrace();
    }
  }
  /**
   * The method called when the user clicks on 'Refresh Options'.
   *
   */
  protected void refreshOptionsClicked()
  {
    if (panel == null)
    {
      panel = new RefreshOptionsPanel();
      panel.setInfo(getInfo());
      dlg = new GenericDialog(
          Utilities.getFrame(MainMenuBar.this),
          panel);
      dlg.setModal(true);
      Utilities.centerGoldenMean(dlg,
          Utilities.getFrame(MainMenuBar.this));
    }
    dlg.setVisible(true);
    if (!panel.isCancelled())
    {
      getInfo().setPoolingPeriod(panel.getPoolingPeriod());
      getInfo().stopPooling();
      getInfo().startPooling();
    }
  }
}