org.eclipse.jubula.rc.swing.swing.implclasses
Class MenuUtil

java.lang.Object
  extended by org.eclipse.jubula.rc.common.implclasses.MenuUtilBase
      extended by org.eclipse.jubula.rc.swing.swing.implclasses.MenuUtil

public abstract class MenuUtil
extends org.eclipse.jubula.rc.common.implclasses.MenuUtilBase

Helper methods for menus

Created:
13.01.2006

Method Summary
static void clickMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JMenuItem item)
          Clicks on a menu item
static void closeMenu(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JMenuBar menuBar, int item)
          Closes the given item in the given menuBar (if open)
static void closeMenu(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JMenuBar menuBar, java.lang.String item)
          Closes the given item in the given menuBar (if open)
static void closePopupMenu(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JPopupMenu popup)
          Closes the given PopupMenu (if open)
static javax.swing.JMenu findMenu(javax.swing.JMenuBar mb, int idx)
          Tries to find a menu in the menubar.
static javax.swing.JMenu findMenu(javax.swing.JMenuBar mb, java.lang.String name, java.lang.String operator)
          Tries to find a menu in the menubar.
static javax.swing.JMenuItem findMenuItem(javax.swing.MenuElement menu, int idx)
          Tries to find a menu item in a menu.
static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JMenuBar menuBar, int[] path)
          Tries to navigate through the menu to the specified menu item.
static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JMenuBar menuBar, java.lang.String[] path, java.lang.String operator)
          Tries to navigate through the menu to the specified menu item.
static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JPopupMenu popup, int[] path)
          Tries to navigate through the menu to the specified menu item.
static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot, javax.swing.JPopupMenu popup, java.lang.String[] path, java.lang.String operator)
          Tries to navigate through the menu to the specified menu item.
static int[] splitIndexPath(java.lang.String path)
          Splits a path into integers
static java.lang.String[] splitPath(java.lang.String path)
          Splits a path into its components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findMenu

public static javax.swing.JMenu findMenu(javax.swing.JMenuBar mb,
                                         java.lang.String name,
                                         java.lang.String operator)
Tries to find a menu in the menubar.

Parameters:
mb - the menu bar
name - the name of the menu to find
operator - operator used for matching
Returns:
the menu or null if no menu with the given name was found.

findMenu

public static javax.swing.JMenu findMenu(javax.swing.JMenuBar mb,
                                         int idx)
Tries to find a menu in the menubar.

Parameters:
mb - the menu bar
idx - the index of the menu to find
Returns:
the menu, or null if not found

splitIndexPath

public static int[] splitIndexPath(java.lang.String path)
Splits a path into integers

Parameters:
path - the path
Returns:
an array of int values

splitPath

public static java.lang.String[] splitPath(java.lang.String path)
Splits a path into its components. The separator is '/'.

Parameters:
path - the path
Returns:
the splitted path

findMenuItem

public static javax.swing.JMenuItem findMenuItem(javax.swing.MenuElement menu,
                                                 int idx)
Tries to find a menu item in a menu.

Parameters:
menu - the menu
idx - the index of the menu item
Returns:
the menu item

closeMenu

public static void closeMenu(org.eclipse.jubula.rc.common.driver.IRobot robot,
                             javax.swing.JMenuBar menuBar,
                             int item)
Closes the given item in the given menuBar (if open)

Parameters:
robot - the robot
menuBar - the menu bar
item - the item to close

closeMenu

public static void closeMenu(org.eclipse.jubula.rc.common.driver.IRobot robot,
                             javax.swing.JMenuBar menuBar,
                             java.lang.String item)
Closes the given item in the given menuBar (if open)

Parameters:
robot - the robot
menuBar - the menu bar
item - the item to close

closePopupMenu

public static void closePopupMenu(org.eclipse.jubula.rc.common.driver.IRobot robot,
                                  javax.swing.JPopupMenu popup)
Closes the given PopupMenu (if open)

Parameters:
robot - the robot
popup - the PopupMenu

navigateToMenuItem

public static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot,
                                                       javax.swing.JMenuBar menuBar,
                                                       java.lang.String[] path,
                                                       java.lang.String operator)
Tries to navigate through the menu to the specified menu item.

Parameters:
robot - robot
menuBar - the menubar
path - the path where to navigate in the menu.
operator - operator used for matching
Returns:
the component at the end of the specified path or null.

navigateToMenuItem

public static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot,
                                                       javax.swing.JMenuBar menuBar,
                                                       int[] path)
Tries to navigate through the menu to the specified menu item.

Parameters:
robot - robot
menuBar - the menubar
path - the path where to navigate in the menu.
Returns:
the component at the end of the specified path.

navigateToMenuItem

public static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot,
                                                       javax.swing.JPopupMenu popup,
                                                       java.lang.String[] path,
                                                       java.lang.String operator)
Tries to navigate through the menu to the specified menu item.

Parameters:
robot - the robot
popup - the popup menu
path - the path where to navigate in the menu.
operator - operator used for matching
Returns:
the component at the end of the specified path.

navigateToMenuItem

public static javax.swing.JMenuItem navigateToMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot,
                                                       javax.swing.JPopupMenu popup,
                                                       int[] path)
Tries to navigate through the menu to the specified menu item.

Parameters:
robot - the robot
popup - the popup menu
path - the path where to navigate in the menu.
Returns:
the component at the end of the specified path.

clickMenuItem

public static void clickMenuItem(org.eclipse.jubula.rc.common.driver.IRobot robot,
                                 javax.swing.JMenuItem item)
Clicks on a menu item

Parameters:
robot - the robot
item - the menu item