Class MenuItemNavigation
-
- All Implemented Interfaces:
public final class MenuItemNavigationMenu item lookup shared by the menu testers.
A path addresses an item the way the browser shows it: by the text of each item in the hierarchy, or by the zero-based position of each item among the visible ones. The item at the end of the path must be enabled and visible, since a user cannot click anything else.
For internal use only.
- Since:
25.3
-
-
Method Summary
Modifier and Type Method Description static <C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> IfindByPath(List<I> rootItems, String topLevelText, Array<String> nestedItemsText)Finds the menu item addressed by the given text path. static <C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> IfindByPath(List<I> rootItems, int topLevelPosition, Array<int> nestedItemsPositions)Finds the menu item addressed by the given position path. static List<String>visibleTexts(List<out MenuItemBase<out Object, out Object, out Object>> items)Gets the texts of the given menu items as the browser shows them, i.e. static <C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> List<String>visibleSubMenuTexts(List<I> rootItems, String topLevelText, Array<String> nestedItemsText)Gets the texts of the visible items of the sub menu of the item addressed by the given text path. static voidrequireCheckable(MenuItemBase<out Object, out Object, out Object> menuItem, String path)Ensures that the given menu item is checkable, as only a checkable item has a checked state to read. static StringpathToString(String topLevelText, Array<String> nestedItemsText)Renders a text path the way it is reported in error messages. static StringpathToString(int topLevelPosition, Array<int> nestedItemsPositions)Renders a position path the way it is reported in error messages. -
-
Method Detail
-
findByPath
static <C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> I findByPath(List<I> rootItems, String topLevelText, Array<String> nestedItemsText)
Finds the menu item addressed by the given text path.
- Parameters:
rootItems- the items of the top level menutopLevelText- the text content of the top level menu item, not nullnestedItemsText- text content of the nested menu items- Returns:
the menu item at the given path
-
findByPath
static <C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> I findByPath(List<I> rootItems, int topLevelPosition, Array<int> nestedItemsPositions)
Finds the menu item addressed by the given position path.
- Parameters:
rootItems- the items of the top level menutopLevelPosition- the zero-based position of the item in the menu, as it will be seen in the browsernestedItemsPositions- the zero-based position of the nested items, relative to the parent menu- Returns:
the menu item at the given path
-
visibleTexts
static List<String> visibleTexts(List<out MenuItemBase<out Object, out Object, out Object>> items)
Gets the texts of the given menu items as the browser shows them, i.e. only the visible ones, in their order.
An item created from a component has no text of its own, so it is reported as an empty string.
- Parameters:
items- the items of a menu level- Returns:
the texts of the visible items
-
visibleSubMenuTexts
static <C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> List<String> visibleSubMenuTexts(List<I> rootItems, String topLevelText, Array<String> nestedItemsText)
Gets the texts of the visible items of the sub menu of the item addressed by the given text path.
- Parameters:
rootItems- the items of the top level menutopLevelText- the text content of the top level menu item, not nullnestedItemsText- text content of the nested menu items- Returns:
the texts of the visible items of the sub menu
-
requireCheckable
static void requireCheckable(MenuItemBase<out Object, out Object, out Object> menuItem, String path)
Ensures that the given menu item is checkable, as only a checkable item has a checked state to read.
- Parameters:
menuItem- the menu item to checkpath- the path the item was addressed by, for the error message
-
pathToString
static String pathToString(String topLevelText, Array<String> nestedItemsText)
Renders a text path the way it is reported in error messages.
- Parameters:
topLevelText- the text content of the top level menu itemnestedItemsText- text content of the nested menu items- Returns:
the path as a string
-
pathToString
static String pathToString(int topLevelPosition, Array<int> nestedItemsPositions)
Renders a position path the way it is reported in error messages.
- Parameters:
topLevelPosition- the position of the top level menu itemnestedItemsPositions- positions of the nested menu items- Returns:
the path as a string
-
-
-
-