< prev index next >

src/com/sun/javatest/exec/JavaTestMenuManager.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


  50  *
  51  * The <code>JMenuItem</code> objects may be "pull-right" menus if desired.  It is
  52  * the responsibility of the architect to manage keystroke mneumonics.
  53  */
  54 public abstract class JavaTestMenuManager {
  55     /**
  56      * Get the menu items to go into the specified position in the menu system.
  57      * See the constants in this class for the possible value.
  58      * @param position The menu position, one of the constants of this class.
  59      * @return The custom menu items to be displayed in the given position.
  60      *         Null if there are none.  Never a zero-length array.
  61      * @throws IllegalArgumentException If the position parameter is out of
  62      *         range.  This is usually the fault of the harness itself, but
  63      *         may occur if classes are compiled against one development version
  64      *         of the harness and run with another.
  65      */
  66     public JMenuItem[] getMenuItems(int position) {
  67         if (bank == null)
  68             return null;
  69         else {
  70             ArrayList al = bank[position];
  71             if (al.size() == 0)
  72                 return null;
  73             else {
  74                 JMenuItem[] result = new JMenuItem[al.size()];
  75                 al.toArray(result);
  76                 return result;
  77             }
  78         }
  79     }
  80 
  81     /**
  82      * Add a menu item to the given menu position.
  83      * The item is added to the bottom, in that position, so you must add them
  84      * in the order you wish them to appear.
  85      * @param position The menu position, one of the constants of this class.
  86      * @param item The menu item to add.
  87      * @throws IndexOutOfBoundsException If the position index is out of
  88      *     range.  Be sure that you are using the constants given in this
  89      *     class to supply this parameter.
  90      */




  50  *
  51  * The <code>JMenuItem</code> objects may be "pull-right" menus if desired.  It is
  52  * the responsibility of the architect to manage keystroke mneumonics.
  53  */
  54 public abstract class JavaTestMenuManager {
  55     /**
  56      * Get the menu items to go into the specified position in the menu system.
  57      * See the constants in this class for the possible value.
  58      * @param position The menu position, one of the constants of this class.
  59      * @return The custom menu items to be displayed in the given position.
  60      *         Null if there are none.  Never a zero-length array.
  61      * @throws IllegalArgumentException If the position parameter is out of
  62      *         range.  This is usually the fault of the harness itself, but
  63      *         may occur if classes are compiled against one development version
  64      *         of the harness and run with another.
  65      */
  66     public JMenuItem[] getMenuItems(int position) {
  67         if (bank == null)
  68             return null;
  69         else {
  70             ArrayList<JMenuItem> al = bank[position];
  71             if (al.size() == 0)
  72                 return null;
  73             else {
  74                 JMenuItem[] result = new JMenuItem[al.size()];
  75                 al.toArray(result);
  76                 return result;
  77             }
  78         }
  79     }
  80 
  81     /**
  82      * Add a menu item to the given menu position.
  83      * The item is added to the bottom, in that position, so you must add them
  84      * in the order you wish them to appear.
  85      * @param position The menu position, one of the constants of this class.
  86      * @param item The menu item to add.
  87      * @throws IndexOutOfBoundsException If the position index is out of
  88      *     range.  Be sure that you are using the constants given in this
  89      *     class to supply this parameter.
  90      */


< prev index next >