com.sun.javatest.exec
Class JavaTestMenuManager

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

public abstract class JavaTestMenuManager
extends java.lang.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 mneumonics.


Field Summary
static int CONFIG_OTHER
           
static int CONFIG_PRIMARY
           
static int CONFIG_VIEW
           
static int FILE_OTHER
           
static int FILE_PRIMARY
           
static int HELP_ABOUT
           
static int HELP_PRIMARY
           
static int HELP_TESTSUITE
           
static int LOG_CONFIG
           
static int LOG_VIEW
           
static int PREFERENCES
           
static int PRESENTATION
           
static int RUN_OTHER
           
static int RUN_PRIMARY
           
static int TOOLS_OTHER
           
static int WINDOWS_MAIN
           
 
Constructor Summary
JavaTestMenuManager()
           
 
Method Summary
protected  void addMenuItem(int position, javax.swing.JMenuItem item)
          Add a menu item to the given menu position.
 javax.swing.JMenuItem[] getMenuItems(int position)
          Get the menu items to go into the specified position in the menu system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_PRIMARY

public static final int FILE_PRIMARY
See Also:
Constant Field Values

FILE_OTHER

public static final int FILE_OTHER
See Also:
Constant Field Values

CONFIG_PRIMARY

public static final int CONFIG_PRIMARY
See Also:
Constant Field Values

CONFIG_VIEW

public static final int CONFIG_VIEW
See Also:
Constant Field Values

CONFIG_OTHER

public static final int CONFIG_OTHER
See Also:
Constant Field Values

RUN_PRIMARY

public static final int RUN_PRIMARY
See Also:
Constant Field Values

RUN_OTHER

public static final int RUN_OTHER
See Also:
Constant Field Values

WINDOWS_MAIN

public static final int WINDOWS_MAIN
See Also:
Constant Field Values

PRESENTATION

public static final int PRESENTATION
See Also:
Constant Field Values

PREFERENCES

public static final int PREFERENCES
See Also:
Constant Field Values

LOG_VIEW

public static final int LOG_VIEW
See Also:
Constant Field Values

LOG_CONFIG

public static final int LOG_CONFIG
See Also:
Constant Field Values

HELP_PRIMARY

public static final int HELP_PRIMARY
See Also:
Constant Field Values

HELP_TESTSUITE

public static final int HELP_TESTSUITE
See Also:
Constant Field Values

HELP_ABOUT

public static final int HELP_ABOUT
See Also:
Constant Field Values

TOOLS_OTHER

public static final int TOOLS_OTHER
See Also:
Constant Field Values
Constructor Detail

JavaTestMenuManager

public JavaTestMenuManager()
Method Detail

getMenuItems

public javax.swing.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:
java.lang.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,
                           javax.swing.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:
java.lang.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.


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.