|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.moyoman.client.reference.util.ActionManager
Provides a factory for creating and caching Swing actions.
Field Summary | |
private Map |
_actions
Map which contains all actions, stored by name. |
private Map |
_buttons
Map which contains all buttons created by this, stored by action. |
private Map |
_checkBoxes
Map which contains all check boxes created by this, stored by action. |
private Map |
_checkBoxMenuItems
Map which contains all check box menu items created by this, stored by action. |
private boolean |
_isMacApp
Flag which indicates if the items should be created in the Macintosh style or not. |
private Map |
_menuItems
Map which contains all menu items created by this, stored by action. |
private Map |
_menus
Map which contains all menus created by this, stored by action. |
private Object |
_owner
The owner. |
private Class |
_ownerClass
The class of the owner. |
private Map |
_radioButtonMenuItems
Map which contains all radio button menu items created by this, stored by action. |
private Map |
_radioButtons
Map which contains all radio buttons created by this, stored by action. |
private Map |
_toggleButtons
Map which contains all toggle buttons created by this, stored by action. |
private static Class[] |
ACTION_EVENT_CLASS_ARRAY
|
static String |
CALLBACK_PROPERTY_NAME
|
Constructor Summary | |
ActionManager(Object owner)
Construct the manager. |
Method Summary | |
private static void |
addToMap(Map map,
Action action,
AbstractButton button)
Add the given button to the given map under the given action. |
void |
clear()
Clear all contents. |
AbstractButton |
configureAbstractButton(AbstractButton abstractButton,
Action action)
Configure the given abstract button using the given action. |
JMenuItem |
configureMenuItem(JMenuItem menuItem,
Action action)
Configure the given menu item using the given action. |
JButton |
createButton(Action action)
Create a button from the given action. |
JButton |
createButton(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic)
Create a button from the given action parameters. |
JCheckBox |
createCheckBox(Action action)
Create a check box from the given action. |
JCheckBox |
createCheckBox(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic,
KeyStroke accelerator)
Create a check box from the given action parameters. |
JCheckBoxMenuItem |
createCheckBoxMenuItem(Action action)
Create a check box menu item from the given action. |
JCheckBoxMenuItem |
createCheckBoxMenuItem(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic,
KeyStroke accelerator)
Create a check box menu item from the given action parameters. |
JMenu |
createMenu(Action action)
Create a menu from the given action. |
JMenu |
createMenu(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic)
Create a menu from the given action parameters. |
JMenuItem |
createMenuItem(Action action)
Create a menu item from the given action. |
JMenuItem |
createMenuItem(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic,
KeyStroke accelerator)
Create a menu item from the given action parameters. |
JRadioButton |
createRadioButton(Action action)
Create a radio button from the given action. |
JRadioButton |
createRadioButton(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic,
KeyStroke accelerator)
Create a radio button from the given action parameters. |
JRadioButtonMenuItem |
createRadioButtonMenuItem(Action action)
Create a radio button menu item from the given action. |
JRadioButtonMenuItem |
createRadioButtonMenuItem(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic,
KeyStroke accelerator)
Create a radio button menu item from the given action parameters. |
JToggleButton |
createToggleButton(Action action)
Create a toggle button from the given action. |
JToggleButton |
createToggleButton(String actionName,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic)
Create a button from the given action parameters. |
Action |
getAction(String name)
Return an action for the given name, creating it if necessary. |
Action |
getAction(String name,
boolean useIcon)
Return an action for the given name, creating it if necessary. |
Action |
getAction(String name,
boolean useIcon,
boolean useText)
Return an action for the given name, creating it if necessary. |
Action |
getAction(String name,
boolean useIcon,
boolean useText,
String defaultText)
Return an action for the given name, creating it if necessary. |
Action |
getAction(String name,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic)
Return an action for the given name, creating it if necessary. |
Action |
getAction(String name,
boolean useIcon,
boolean useText,
String defaultText,
int mnemonic,
KeyStroke accelerator)
Return an action for the given name, creating it if necessary. |
JButton |
getButton(Action action)
Return the first entry in the buttons list corresponding to the given action. |
private Map |
getButtons()
Return the buttons map, creating it if necessary. |
List |
getButtons(Action action)
Return the buttons list corresponding to the given action. |
JCheckBox |
getCheckBox(Action action)
Return the first entry in the check boxes list corresponding to the given action. |
private Map |
getCheckBoxes()
Return the check boxes map, creating it if necessary. |
List |
getCheckBoxes(Action action)
Return the check boxes list corresponding to the given action. |
JCheckBoxMenuItem |
getCheckBoxMenuItem(Action action)
Return the first entry in the check box menu items list corresponding to the given action. |
private Map |
getCheckBoxMenuItems()
Return the check box menu items map, creating it if necessary. |
List |
getCheckBoxMenuItems(Action action)
Return the check box menu items list corresponding to the given action. |
private Object |
getFirstInList(List list)
Return the first entry in the given list. |
private List |
getList(Map map,
Action action)
Return the list from the given map corresponding to the given action. |
JMenu |
getMenu(Action action)
Return the first entry in the menus list corresponding to the given action. |
JMenuItem |
getMenuItem(Action action)
Return the first entry in the menu items list corresponding to the given action. |
private Map |
getMenuItems()
Return the menu items map, creating it if necessary. |
List |
getMenuItems(Action action)
Return the menu items list corresponding to the given action. |
private Map |
getMenus()
Return the menu map, creating it if necessary. |
List |
getMenus(Action action)
Return the menus list corresponding to the given action. |
JRadioButton |
getRadioButton(Action action)
Return the first entry in the radio buttons list corresponding to the given action. |
JRadioButtonMenuItem |
getRadioButtonMenuItem(Action action)
Return the first entry in the radio button menu items list corresponding to the given action. |
private Map |
getRadioButtonMenuItems()
Return the radio button menu items map, creating it if necessary. |
List |
getRadioButtonMenuItems(Action action)
Return the radio button menu items list corresponding to the given action. |
private Map |
getRadioButtons()
Return the radio buttons map, creating it if necessary. |
List |
getRadioButtons(Action action)
Return the radio buttons list corresponding to the given action. |
JToggleButton |
getToggleButton(Action action)
Return the first entry in the toggle buttons list corresponding to the given action. |
private Map |
getToggleButtons()
Return the toggle buttons map, creating it if necessary. |
List |
getToggleButtons(Action action)
Return the toggle buttons list corresponding to the given action. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Class[] ACTION_EVENT_CLASS_ARRAY
public static final String CALLBACK_PROPERTY_NAME
private Class _ownerClass
private Map _actions
private Map _buttons
private Map _checkBoxMenuItems
private Map _checkBoxes
private Map _menuItems
private Map _menus
private Map _radioButtonMenuItems
private Map _radioButtons
private Map _toggleButtons
private Object _owner
private boolean _isMacApp
Constructor Detail |
public ActionManager(Object owner)
owner
- The owner of this manager. The actions make method calls on
this owner.Method Detail |
public Action getAction(String name)
name
- The name of the action, used for reference and to obtain
resources.public Action getAction(String name, boolean useIcon)
name
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.public Action getAction(String name, boolean useIcon, boolean useText)
name
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.public Action getAction(String name, boolean useIcon, boolean useText, String defaultText)
name
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.public Action getAction(String name, boolean useIcon, boolean useText, String defaultText, int mnemonic)
name
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.public Action getAction(String name, boolean useIcon, boolean useText, String defaultText, int mnemonic, KeyStroke accelerator)
name
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.accelerator
- The accelerator key stroke.public JButton getButton(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getButtons(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JCheckBox getCheckBox(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JCheckBoxMenuItem getCheckBoxMenuItem(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getCheckBoxMenuItems(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getCheckBoxes(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JMenu getMenu(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JMenuItem getMenuItem(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getMenuItems(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getMenus(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JRadioButton getRadioButton(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JRadioButtonMenuItem getRadioButtonMenuItem(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getRadioButtonMenuItems(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getRadioButtons(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public JToggleButton getToggleButton(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public List getToggleButtons(Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.public void clear()
public AbstractButton configureAbstractButton(AbstractButton abstractButton, Action action)
abstractButton
- The abstract button to configure.action
- The action to use.public JMenuItem configureMenuItem(JMenuItem menuItem, Action action)
menuItem
- The menu item to configure.action
- The action to use.public JButton createButton(Action action)
action
- The action to use.public JButton createButton(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.getAction( String, boolean, boolean, String, int )
public JCheckBox createCheckBox(Action action)
action
- The action to use.public JCheckBox createCheckBox(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic, KeyStroke accelerator)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.accelerator
- The accelerator key stroke.getAction( String, boolean, boolean, String, int, KeyStroke )
public JCheckBoxMenuItem createCheckBoxMenuItem(Action action)
action
- The action to use.public JCheckBoxMenuItem createCheckBoxMenuItem(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic, KeyStroke accelerator)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.accelerator
- The accelerator key stroke.getAction( String, boolean, boolean, String, int, KeyStroke )
public JMenu createMenu(Action action)
action
- The action to use.public JMenu createMenu(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.getAction( String, boolean, boolean, String, int )
public JMenuItem createMenuItem(Action action)
action
- The action to use.public JMenuItem createMenuItem(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic, KeyStroke accelerator)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.accelerator
- The accelerator key stroke.getAction( String, boolean, boolean, String, int, KeyStroke )
public JRadioButton createRadioButton(Action action)
action
- The action to use.public JRadioButton createRadioButton(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic, KeyStroke accelerator)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.accelerator
- The accelerator key stroke.getAction( String, boolean, boolean, String, int, KeyStroke )
public JRadioButtonMenuItem createRadioButtonMenuItem(Action action)
action
- The action to use.public JRadioButtonMenuItem createRadioButtonMenuItem(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic, KeyStroke accelerator)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.accelerator
- The accelerator key stroke.getAction( String, boolean, boolean, String, int, KeyStroke )
public JToggleButton createToggleButton(Action action)
action
- The action to use.public JToggleButton createToggleButton(String actionName, boolean useIcon, boolean useText, String defaultText, int mnemonic)
actionName
- The name of the action, used for reference and to obtain
resources.useIcon
- If true, use the default icon. If false, don't use an
icon.useText
- If true, use the default text. If false, don't use text.defaultText
- The default text to use if the name resource key is
not found.mnemonic
- The mnemonic KeyEvent
.getAction( String, boolean, boolean, String, int )
private static void addToMap(Map map, Action action, AbstractButton button)
map
- The map to use.action
- The action to use.button
- The button to store.private Map getButtons()
private Map getCheckBoxMenuItems()
private Map getCheckBoxes()
private Object getFirstInList(List list)
list
- The list of interest.private List getList(Map map, Action action)
action
- The action of interest.
IllegalArgumentException
- if action is null.private Map getMenuItems()
private Map getMenus()
private Map getRadioButtonMenuItems()
private Map getRadioButtons()
private Map getToggleButtons()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |