com.levigo.util.swing.menu
Class BasicMenuBuilder
java.lang.Object
com.levigo.util.swing.menu.BasicMenuBuilder
- All Implemented Interfaces:
- MenuBuilder
public class BasicMenuBuilder
- extends Object
- implements MenuBuilder
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BasicMenuBuilder
public BasicMenuBuilder(MenuContributor contributor,
BasicMenuBuilder.Menu menu)
installAction
public void installAction(Action action)
- Description copied from interface:
MenuBuilder
- Install the given action into the default menu group
MenuBuilder.GROUP_DEFAULT
.
- Specified by:
installAction
in interface MenuBuilder
- Parameters:
action
- the Action
to install.
installAction
public void installAction(String group,
Action action)
- Description copied from interface:
MenuBuilder
- Install the given action into the given menu group. If the group does not exist, it will be
created on the fly. Callers are free to choose group names as they see fit. However, there are
some pre-defined group names which can be used as appropriate.
- Specified by:
installAction
in interface MenuBuilder
- Parameters:
group
- the group into which to install itaction
- the Action
to install- See Also:
MenuBuilder.GROUP_DEFAULT
,
MenuBuilder.GROUP_EDIT
,
MenuBuilder.GROUP_SETTINGS
getGroups
public List<String> getGroups()
- Description copied from interface:
MenuBuilder
- Return the (read-only) list of group names already defined.
- Specified by:
getGroups
in interface MenuBuilder
- Returns:
- a list of Strings.
findSubMenu
public MenuBuilder findSubMenu(String id)
- Description copied from interface:
MenuBuilder
- Find a
MenuBuilder
for an existing sub-menu. If the sub-menu does not exist, this will
return null
.
- Specified by:
findSubMenu
in interface MenuBuilder
- Parameters:
id
- the sub-menu's id
- Returns:
- the
MenuBuilder
or null
, if there is no sub-menu with the given
id.
installSubMenu
public MenuBuilder installSubMenu(String group,
String id,
Action action)
- Description copied from interface:
MenuBuilder
- Install a sub-menu and return a
MenuBuilder
for it. If the sub-menu already exists,
this method will throw an IllegalArgumentException
.
- Specified by:
installSubMenu
in interface MenuBuilder
- Parameters:
group
- the group into which to install itid
- the sub-menu's idaction
- the action describing the sub-menu. Please note that the action's
ActionListener.actionPerformed(java.awt.event.ActionEvent)
is never actually called.
- Returns:
- a
MenuBuilder
for the sub-menu
getSubMenuIDs
public Set<String> getSubMenuIDs()
- Description copied from interface:
MenuBuilder
- Return the (read-only) list of sub-menu ids already defined.
- Specified by:
getSubMenuIDs
in interface MenuBuilder
- Returns:
- a list of Strings.