public final class ActionHelper extends Object
A helper class for dealing with actions.
This class provides some utility methods that can be used when working with actions and their tasks.
Modifier and Type | Method and Description |
---|---|
static void |
checkActionTask(Object task)
Tests whether the specified object is a valid task for an action.
|
static void |
enableActions(Collection<FormAction> actions,
boolean enabled)
Sets the enabled flag for all actions in the specified collection.
|
static Collection<FormAction> |
fetchActionsInGroup(ActionStore actionStore,
String groupName)
Returns all actions that belong to the specified group in the given
ActionStore . |
static Collection<FormAction> |
fetchAllActionsInGroup(ActionStore actionStore,
String groupName,
boolean distinct)
Returns all actions that belong to the specified group in the given
ActionStore or one of its parents. |
static Set<String> |
getAllGroupNames(ActionStore actionStore)
Returns the names of all groups defined for the specified
ActionStore and its parents. |
static void |
invokeActionTask(Object task,
FormAction action,
BuilderEvent event)
Invokes the specified action task.
|
static boolean |
isValidActionTask(Object task)
Returns a flag whether the specified object is a valid task for an
action.
|
public static boolean isValidActionTask(Object task)
task
- the task object to be inspectedpublic static void checkActionTask(Object task)
isValidActionTask()
. If the result is
false, an IllegalArgumentException
exception will
be thrown.task
- the task to be inspectedIllegalArgumentException
- if the task is not supported by actionspublic static void invokeActionTask(Object task, FormAction action, BuilderEvent event)
task
- the task to be invokedaction
- the corresponding actionevent
- the event that triggered the actionIllegalArgumentException
- if the task cannot be invokedpublic static Set<String> getAllGroupNames(ActionStore actionStore)
ActionStore
and its parents. This method navigates through
the hierarchy of stores collecting all existing groups.actionStore
- the ActionStore
to start withpublic static Collection<FormAction> fetchActionsInGroup(ActionStore actionStore, String groupName)
ActionStore
. If the action store is null or the
group does not exist, an empty collection is returned.actionStore
- the action storegroupName
- the name of the desired grouppublic static Collection<FormAction> fetchAllActionsInGroup(ActionStore actionStore, String groupName, boolean distinct)
ActionStore
or one of its parents. The
distinct
parameter determines how actions with the same
names are to be treated. If set to true, actions in a parent
store are not added to the results collection if there are already
actions with the same name in a child store. If the parameter is false,
all actions are added.actionStore
- the actionStore to start with (can be null,
then an empty collection will be returned)groupName
- the name of the groupdistinct
- the distinct flagpublic static void enableActions(Collection<FormAction> actions, boolean enabled)
actions
- a collection with the involved actions (can be null,
then this operation has no effect)enabled
- the enabled flagCopyright © 2016 The JGUIraffe Team. All rights reserved.