|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.action.ActionContainerFactory
public class ActionContainerFactory
Creates user interface elements based on action ids and lists of action ids. All action ids must represent actions managed by the ActionManager.
For a menu or submenu, the first element in the action-list represents a menu and subsequent elements represent menu items or separators (if null).
This class can be used as a general component factory which will construct
components from Actions if the create<comp>(Action,...)
methods are used.
ActionManager
Constructor Summary | |
---|---|
ActionContainerFactory()
Constructs an container factory which uses the default ActionManager. |
|
ActionContainerFactory(ActionManager manager)
Constructs an container factory which uses managed actions. |
Method Summary | |
---|---|
void |
configureButton(JToggleButton button,
AbstractActionExt a,
ButtonGroup group)
|
protected void |
configureButtonFromExtActionProperties(AbstractButton button,
Action action)
This method will be called after buttons created from an action. |
protected void |
configureMenuItemFromExtActionProperties(JMenuItem menuItem,
Action action)
This method will be called after menu items are created. |
void |
configureSelectableButton(AbstractButton button,
AbstractActionExt a,
ButtonGroup group)
method to configure a "selectable" button from the given AbstractActionExt. |
AbstractButton |
createButton(Action action)
Creates a button based on the attributes of the action. |
AbstractButton |
createButton(Action action,
JComponent container)
Creates a button based on the attributes of the action. |
AbstractButton |
createButton(Object id,
JComponent container)
Creates, configures and returns an AbstractButton. |
JMenu |
createMenu(List list)
Creates and returns a menu from a List which represents actions, separators and sub-menus. |
JMenu |
createMenu(Object[] actionIds)
Creates and returns a menu from a List which represents actions, separators and sub-menus. |
JMenuBar |
createMenuBar(List list)
Constructs a menu tree from a list of actions or lists of lists or actions. |
JMenuBar |
createMenuBar(Object[] actionIds)
Constructs a menu tree from a list of actions or lists of lists or actions. |
JMenuItem |
createMenuItem(Action action)
Creates a menu item based on the attributes of the action. |
JMenuItem |
createMenuItem(Action action,
JComponent container)
Creates a menu item based on the attributes of the action element. |
JPopupMenu |
createPopup(List list)
Constructs a popup menu from a list of action ids. |
JPopupMenu |
createPopup(Object[] list)
Constructs a popup menu from an array of action ids. |
JToolBar |
createToolBar(List list)
Constructs a toolbar from an action-list id. |
JToolBar |
createToolBar(Object[] list)
Constructs a toolbar from an action-list id. |
ActionManager |
getActionManager()
Gets the ActionManager instance. |
void |
setActionManager(ActionManager manager)
Sets the ActionManager instance that will be used by this ActionContainerFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ActionContainerFactory()
public ActionContainerFactory(ActionManager manager)
manager
- use the actions managed with this manager for
constructing ui componenents.Method Detail |
---|
public ActionManager getActionManager()
setActionManager(org.jdesktop.swingx.action.ActionManager)
public void setActionManager(ActionManager manager)
public JToolBar createToolBar(Object[] list)
list
- a list of action ids used to construct the toolbar.
public JToolBar createToolBar(List list)
list
- a list of action ids used to construct the toolbar.
public JPopupMenu createPopup(Object[] list)
list
- an array of action ids used to construct the popup.
public JPopupMenu createPopup(List list)
list
- a list of action ids used to construct the popup.
public JMenuBar createMenuBar(Object[] actionIds)
For example, If my list is [action, action, action], then nothing is added to the menu bar. However, if my list is [list[action], action, action, action] then I get a menu and under it the tree actions. This should not be, because if I wanted those actions to be on the sub menu, then they should have been listed within the sub list!
actionIds
- an array which represents the root item.
public JMenuBar createMenuBar(List list)
For example, If my list is [action, action, action], then nothing is added to the menu bar. However, if my list is [list[action], action, action, action] then I get a menu and under it the tree actions. This should not be, because if I wanted those actions to be on the sub menu, then they should have been listed within the sub list!
list
- a list which represents the root item.
public JMenu createMenu(Object[] actionIds)
actionIds
- an array of action ids used to construct the menu and menu items.
the first element represents the action used for the menu,
public JMenu createMenu(List list)
list
- a list of action ids used to construct the menu and menu items.
the first element represents the action used for the menu,
public JMenuItem createMenuItem(Action action, JComponent container)
action
- a mangaged Actioncontainer
- the parent container may be null for non-group actions.
public JMenuItem createMenuItem(Action action)
action
- an action used to create the menu item
public AbstractButton createButton(Object id, JComponent container)
id
- the identifercontainer
- the JComponent which parents the group, if any.
public AbstractButton createButton(Action action, JComponent container)
action
- an action used to create the buttoncontainer
- the parent container to uniquely identify
grouped components or null
public AbstractButton createButton(Action action)
action
- an action used to create the button
public void configureButton(JToggleButton button, AbstractActionExt a, ButtonGroup group)
button
- a
- group
- public void configureSelectableButton(AbstractButton button, AbstractActionExt a, ButtonGroup group)
It's up to the client to only pass in button's where selected and/or the group property makes sense. PENDING: the group properties are yet untested. PENDING: think about automated unconfig.
button
- where selected makes sensea
- group
- the button should be added to.
IllegalArgumentException
- if the given action doesn't have the state flag set.protected void configureButtonFromExtActionProperties(AbstractButton button, Action action)
button
- the button to be configuredaction
- the action used to construct the menu item.protected void configureMenuItemFromExtActionProperties(JMenuItem menuItem, Action action)
menuItem
- the menu item to be configuredaction
- the action used to construct the menu item.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |