|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jguiraffe.gui.builder.action.ActionStore
public class ActionStore
A class for maintaining action objects.
This class provides access to the actions available in an application or for a certain component. Actions can be queried by their name, or lists of all existing actions can be requested. It is also possible to organize actions in groups. Then for example all actions that belong to a group can be disabled at once.
An ActionStore object also holds a reference to a parent
store. If defined, all actions in the parent store can be accessed by this
store, too. This provides for a hierarchical action architecture. E.g. there
may be a central ActionStore holding the global actions of the
application. Sub components of the application (e.g. internal frames or
dialogs) can define their own ActionStore with their specific
set of actions, but through the parent reference have also access to the
global actions.
Note: The operations of this class are thread-safe.
| Constructor Summary | |
|---|---|
ActionStore()
Creates a new empty instance of ActionStore. |
|
ActionStore(ActionStore parent)
Creates a new instance of ActionStore and initializes the
parent reference. |
|
| Method Summary | |
|---|---|
void |
addAction(FormAction action)
Adds the specified action to this store. |
void |
addActionToGroup(java.lang.String actionName,
java.lang.String groupName)
Adds the specified action to the given group. |
void |
enableGroup(java.lang.String groupName,
boolean enabled)
Sets the enabled flag for all actions in the specified group. |
FormAction |
getAction(java.lang.String name)
Returns the action with the given name. |
java.util.Set<java.lang.String> |
getActionNames()
Returns a collection with the names of the actions stored in this ActionStore. |
java.util.Set<java.lang.String> |
getActionNamesForGroup(java.lang.String groupName)
Returns a set with the names of all actions that belong to the given group. |
java.util.Collection<FormAction> |
getActions(java.util.Collection<java.lang.String> names)
Returns all action objects whose names are specified in the given collection. |
java.util.Set<java.lang.String> |
getAllActionNames()
Returns a collection with the names of all actions stored in this ActionStore or in one of its parents. |
java.util.Set<java.lang.String> |
getGroupNames()
Returns the names of all defined groups. |
ActionStore |
getParent()
Returns the parent store. |
boolean |
hasAction(java.lang.String name)
Returns a flag whether the specified action is contained in this store or in the parent store. |
boolean |
isActionInGroup(java.lang.String actionName,
java.lang.String groupName)
Checks if the specified action belongs to the given group. |
FormAction |
removeAction(java.lang.String name)
Removes the action with the specified name from this store. |
boolean |
removeActionFromGroup(java.lang.String actionName,
java.lang.String groupName)
Removes the specified action from the given group. |
boolean |
removeGroup(java.lang.String groupName)
Removes the group with the specified name. |
void |
setParent(ActionStore parent)
Sets the parent store. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ActionStore()
ActionStore.
public ActionStore(ActionStore parent)
ActionStore and initializes the
parent reference.
parent - this action store's parent| Method Detail |
|---|
public void addAction(FormAction action)
action - the action to add (must not be null)public FormAction removeAction(java.lang.String name)
name - the name of the action to remove
public FormAction getAction(java.lang.String name)
name - the name of the desired action
java.util.NoSuchElementException - if no such action existspublic boolean hasAction(java.lang.String name)
name - the action's name
public java.util.Set<java.lang.String> getActionNames()
ActionStore. The returned collection will not contain the
names of the actions that are stored in the parent
ActionStore.
ActionStorepublic java.util.Set<java.lang.String> getAllActionNames()
ActionStore or in one of its parents. With this method
really all names can be found out that can be passed to the
getAction(String) method. Note: the set returned
by this method is a snapshot reflecting the state of this action time at
the time it was created. It is not connected to this action store, so
later updates are not visible.
public java.util.Collection<FormAction> getActions(java.util.Collection<java.lang.String> names)
NoSuchElementException exception will be thrown. If an
action cannot be found in this store, the parent store (if it is
defined), is also searched.
names - a collection with the names of the desired actions
java.util.NoSuchElementException - if one of the actions cannot be resolved
public void addActionToGroup(java.lang.String actionName,
java.lang.String groupName)
NoSuchElementException exception will
be thrown.
actionName - the name of the actiongroupName - the name of the group (must not be null)
public boolean removeActionFromGroup(java.lang.String actionName,
java.lang.String groupName)
actionName - the action's namegroupName - the group's name
public boolean isActionInGroup(java.lang.String actionName,
java.lang.String groupName)
actionName - the action's namegroupName - the group's name
public boolean removeGroup(java.lang.String groupName)
groupName - the name of the group to remove
public java.util.Set<java.lang.String> getActionNamesForGroup(java.lang.String groupName)
groupName - the name of the group
public java.util.Set<java.lang.String> getGroupNames()
ActionStore are completely independent on the parent's
groups, i.e. this method won't return any groups defined in the parent
store.
public void enableGroup(java.lang.String groupName,
boolean enabled)
groupName - the name of the groupenabled - the value of the enabled flagpublic ActionStore getParent()
public void setParent(ActionStore parent)
parent - the parent store
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||