Class JavaTestMenuManager

java.lang.Object
com.sun.javatest.exec.JavaTestMenuManager

public abstract class JavaTestMenuManager extends Object
Class to manage custom menus. This class allows the test suite architect to add various custom menu items to designated places in the menu system of the Test Manager. The constants in this class represent those designated positions and are semantic locations, not absolute. This allows reorganization of menus at the harness level without necessarily breaking the positioning that the architect expected.

This class can be used in two ways. First, the concrete class overrides getMenuItems() to return the correct set of items for the given category. This method may be the most simple for straight forward insertions. The second method is to use addMenuItem() to sequentially specify which menu items should appear. The default implementation of getMenuItems() will use data provided by using this second method.

By default, no menu category will have any custom menus (getMenuItems() will always return null).

The JMenuItem objects may be "pull-right" menus if desired. It is the responsibility of the architect to manage keystroke mnemonics.

  • Field Details

  • Constructor Details

    • JavaTestMenuManager

      public JavaTestMenuManager()
  • Method Details

    • getMenuItems

      public JMenuItem[] getMenuItems(int position)
      Get the menu items to go into the specified position in the menu system. See the constants in this class for the possible value.
      Parameters:
      position - The menu position, one of the constants of this class.
      Returns:
      The custom menu items to be displayed in the given position. Null if there are none. Never a zero-length array.
      Throws:
      IllegalArgumentException - If the position parameter is out of range. This is usually the fault of the harness itself, but may occur if classes are compiled against one development version of the harness and run with another.
    • addMenuItem

      protected void addMenuItem(int position, JMenuItem item)
      Add a menu item to the given menu position. The item is added to the bottom, in that position, so you must add them in the order you wish them to appear.
      Parameters:
      position - The menu position, one of the constants of this class.
      item - The menu item to add.
      Throws:
      IndexOutOfBoundsException - If the position index is out of range. Be sure that you are using the constants given in this class to supply this parameter.