Class MenuBuilder

java.lang.Object
ca.phon.ui.menu.MenuBuilder

public final class MenuBuilder extends Object

Helper class for building menus. Menus items are 'addressed' using paths. Paths are alphanumeric sequences separated by '/'. Each section of the path is path of the menu hierarchy, with the final item naming the terminating menu/menu item.

Example paths:

  • File
    The file menu.
  • View/Record Data/My Item
    The item with name 'My Item' in the View/Record Data' menu.

When adding a MenuElement, location of the element may be specified in the path by adding the '@' token followed by

  • ^ - place new element at beginning of this menu
  • $ - place new element at end of the menu (default behaviour)
  • item name - place after given item name (or end if not found)
E.g., To add a new item to the beginning of the File menu, use the path File@^ in the path given to the addMenu(String, String) and addItem(String, Action) methods.

Menu builders may be attached to existing menus, in which case existing menu items may be addressed using the scheme above. Menu items are typically added 'before' or 'after' existing items.