|
||||||||||
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(javax.swing.JToggleButton button,
AbstractActionExt a,
javax.swing.ButtonGroup group)
|
void |
configureSelectableButton(javax.swing.AbstractButton button,
AbstractActionExt a,
javax.swing.ButtonGroup group)
method to configure a "selectable" button from the given AbstractActionExt. |
javax.swing.AbstractButton |
createButton(javax.swing.Action action)
Creates a button based on the attributes of the action. |
javax.swing.AbstractButton |
createButton(javax.swing.Action action,
javax.swing.JComponent container)
Creates a button based on the attributes of the action. |
javax.swing.AbstractButton |
createButton(java.lang.Object id,
javax.swing.JComponent container)
Creates, configures and returns an AbstractButton. |
javax.swing.JMenu |
createMenu(java.util.List list)
Creates and returns a menu from a List which represents actions, separators and sub-menus. |
javax.swing.JMenu |
createMenu(java.lang.Object[] actionIds)
Creates and returns a menu from a List which represents actions, separators and sub-menus. |
javax.swing.JMenuBar |
createMenuBar(java.util.List list)
Constructs a menu tree from a list of actions or lists of lists or actions. |
javax.swing.JMenuBar |
createMenuBar(java.lang.Object[] actionIds)
Constructs a menu tree from a list of actions or lists of lists or actions. |
javax.swing.JMenuItem |
createMenuItem(javax.swing.Action action)
Creates a menu item based on the attributes of the action. |
javax.swing.JMenuItem |
createMenuItem(javax.swing.Action action,
javax.swing.JComponent container)
Creates a menu item based on the attributes of the action element. |
javax.swing.JPopupMenu |
createPopup(java.util.List list)
Constructs a popup menu from a list of action ids. |
javax.swing.JPopupMenu |
createPopup(java.lang.Object[] list)
Constructs a popup menu from an array of action ids. |
javax.swing.JToolBar |
createToolBar(java.util.List list)
Constructs a toolbar from an action-list id. |
javax.swing.JToolBar |
createToolBar(java.lang.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 |
---|
equals, 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 javax.swing.JToolBar createToolBar(java.lang.Object[] list)
list
- a list of action ids used to construct the toolbar.
public javax.swing.JToolBar createToolBar(java.util.List list)
list
- a list of action ids used to construct the toolbar.
public javax.swing.JPopupMenu createPopup(java.lang.Object[] list)
list
- an array of action ids used to construct the popup.
public javax.swing.JPopupMenu createPopup(java.util.List list)
list
- a list of action ids used to construct the popup.
public javax.swing.JMenuBar createMenuBar(java.lang.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 javax.swing.JMenuBar createMenuBar(java.util.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 javax.swing.JMenu createMenu(java.lang.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 javax.swing.JMenu createMenu(java.util.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 javax.swing.JMenuItem createMenuItem(javax.swing.Action action, javax.swing.JComponent container)
action
- a mangaged Actioncontainer
- the parent container may be null for non-group actions.
public javax.swing.JMenuItem createMenuItem(javax.swing.Action action)
action
- an action used to create the menu item
public javax.swing.AbstractButton createButton(java.lang.Object id, javax.swing.JComponent container)
id
- the identifercontainer
- the JComponent which parents the group, if any.
public javax.swing.AbstractButton createButton(javax.swing.Action action, javax.swing.JComponent container)
action
- an action used to create the buttoncontainer
- the parent container to uniquely identify
grouped components or null
public javax.swing.AbstractButton createButton(javax.swing.Action action)
action
- an action used to create the button
public void configureButton(javax.swing.JToggleButton button, AbstractActionExt a, javax.swing.ButtonGroup group)
button
- a
- group
- public void configureSelectableButton(javax.swing.AbstractButton button, AbstractActionExt a, javax.swing.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.
java.lang.IllegalArgumentException
- if the given action doesn't have the state flag set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |