com.levigo.util.swing.menu
Class BasicMenuBuilder

java.lang.Object
  extended by com.levigo.util.swing.menu.BasicMenuBuilder
All Implemented Interfaces:
MenuBuilder

public class BasicMenuBuilder
extends Object
implements MenuBuilder


Nested Class Summary
static class BasicMenuBuilder.Entry
           
static class BasicMenuBuilder.Group
           
static class BasicMenuBuilder.Menu
           
 
Nested classes/interfaces inherited from interface com.levigo.util.swing.menu.MenuBuilder
MenuBuilder.ItemType
 
Field Summary
 
Fields inherited from interface com.levigo.util.swing.menu.MenuBuilder
GROUP_DEFAULT, GROUP_EDIT, GROUP_KEY, GROUP_SETTINGS, ITEM_TYPE_KEY
 
Constructor Summary
BasicMenuBuilder(MenuContributor contributor, BasicMenuBuilder.Menu menu)
           
 
Method Summary
 MenuBuilder findSubMenu(String id)
          Find a MenuBuilder for an existing sub-menu.
 List<String> getGroups()
          Return the (read-only) list of group names already defined.
 Set<String> getSubMenuIDs()
          Return the (read-only) list of sub-menu ids already defined.
 void installAction(Action action)
          Install the given action into the default menu group MenuBuilder.GROUP_DEFAULT.
 void installAction(String group, Action action)
          Install the given action into the given menu group.
 MenuBuilder installSubMenu(String group, String id, Action action)
          Install a sub-menu and return a MenuBuilder for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMenuBuilder

public BasicMenuBuilder(MenuContributor contributor,
                        BasicMenuBuilder.Menu menu)
Method Detail

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 it
action - 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 it
id - the sub-menu's id
action - 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.


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.