Package ptolemy.vergil.toolbox
Class RadioMenuActionFactory
- java.lang.Object
-
- ptolemy.vergil.toolbox.MenuActionFactory
-
- ptolemy.vergil.toolbox.RadioMenuActionFactory
-
- All Implemented Interfaces:
MenuItemFactory
public class RadioMenuActionFactory extends MenuActionFactory
A factory that adds a given action or set of actions as radio selections to a context menu. All the actions created by an instance of this factory are in the same group. Selecting one item in a group causes the currently selected item in the same group unselected, if it is not the same as the newly selected one. If an array of actions is given to the constructor, then the actions will be put in a submenu with the specified label.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Red (tfeng)
-
-
Constructor Summary
Constructors Constructor Description RadioMenuActionFactory(javax.swing.Action action)
Construct a factory that adds a given action as a radio selection to a given context menu.RadioMenuActionFactory(javax.swing.Action[] actions, java.lang.String label)
Construct a factory that adds a given group of actions as radio selections to a given context menu in a submenu with the specified label.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.JMenuItem
_add(JContextMenu menu, javax.swing.Action action, java.lang.String tooltip)
Add an action to the context menu.protected javax.swing.JMenuItem
_add(javax.swing.JMenu submenu, javax.swing.Action action)
Add an action to the submenu.javax.swing.JMenuItem
create(JContextMenu menu, NamedObj object)
Add an item to the given context menu that will configure the parameters on the given target.-
Methods inherited from class ptolemy.vergil.toolbox.MenuActionFactory
addAction, addAction, addActions, addMenuItemListener, substitute
-
-
-
-
Constructor Detail
-
RadioMenuActionFactory
public RadioMenuActionFactory(javax.swing.Action action)
Construct a factory that adds a given action as a radio selection to a given context menu.- Parameters:
action
- The action to be associated with the context menu.
-
RadioMenuActionFactory
public RadioMenuActionFactory(javax.swing.Action[] actions, java.lang.String label)
Construct a factory that adds a given group of actions as radio selections to a given context menu in a submenu with the specified label.- Parameters:
actions
- The actions to be in the submenu.label
- The label for the submenu.
-
-
Method Detail
-
create
public javax.swing.JMenuItem create(JContextMenu menu, NamedObj object)
Add an item to the given context menu that will configure the parameters on the given target.- Specified by:
create
in interfaceMenuItemFactory
- Overrides:
create
in classMenuActionFactory
- Parameters:
menu
- The context menu to add to.object
- The object that the menu item command will operate on.- Returns:
- A menu item, or null to decline to provide a menu item.
-
_add
protected javax.swing.JMenuItem _add(JContextMenu menu, javax.swing.Action action, java.lang.String tooltip)
Add an action to the context menu.- Overrides:
_add
in classMenuActionFactory
- Parameters:
menu
- The context menu.action
- The action to be added to the context menu.tooltip
- The tooltip for the action.- Returns:
- The added menu item.
-
_add
protected javax.swing.JMenuItem _add(javax.swing.JMenu submenu, javax.swing.Action action)
Add an action to the submenu.- Overrides:
_add
in classMenuActionFactory
- Parameters:
submenu
- The submenu.action
- The action to be added to the submenu.- Returns:
- The added menu item.
-
-