Package com.tagtraum.beatunes
Class ActionManager
- java.lang.Object
-
- com.tagtraum.beatunes.ActionManager
-
- All Implemented Interfaces:
ApplicationComponent<BeaTunes>
public class ActionManager extends Object implements ApplicationComponent<BeaTunes>
The centralActionManager
allows registration and retrieval of theBaseAction
s used throughout the application. Actions can be accessed via their id (ApplicationAction.getId()
). UsingApplicationAction.getActionLocations()
, actions may be installed automatically in the application's UI.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description ActionManager(BeaTunes application)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseAction
getAction(String id)
Returns an action object for an id.Set<String>
getActionIds()
Set of registered ids.BeaTunes
getApplication()
Returns the main application component.String
getId()
Unique id for each instance of this object.void
init()
Installs actions in the UI (if they have a location specified).void
installApplicationsInto(Object root)
Installs all registered actions in the given root object using theirActionLocation
s.void
installApplicationsInto(Object root, Predicate<ActionLocation> actionLocationFilter)
Installs registered actions that fit the given predicate in the given root object using theirActionLocation
s.void
registerActionPlugins()
Registers all plugins that implementBaseAction
with their ids in this manager.void
setApplication(BeaTunes beaTunes)
Sets the main application component.void
shutdown()
Shuts down this component and its sub-components.
-
-
-
Constructor Detail
-
ActionManager
public ActionManager(BeaTunes application)
- Parameters:
application
- beatunes
-
-
Method Detail
-
getApplication
public BeaTunes getApplication()
Description copied from interface:ApplicationComponent
Returns the main application component.- Specified by:
getApplication
in interfaceApplicationComponent<BeaTunes>
- Returns:
- application object
-
setApplication
public void setApplication(BeaTunes beaTunes)
Description copied from interface:ApplicationComponent
Sets the main application component.- Specified by:
setApplication
in interfaceApplicationComponent<BeaTunes>
- Parameters:
beaTunes
- main application component
-
getId
public String getId()
Description copied from interface:ApplicationComponent
Unique id for each instance of this object.- Specified by:
getId
in interfaceApplicationComponent<BeaTunes>
- Returns:
- id
-
getAction
public BaseAction getAction(String id)
Returns an action object for an id.- Parameters:
id
- id for the requested action- Returns:
- action or null, if id unknown
- See Also:
addAction(com.tagtraum.beatunes.action.BaseAction)
-
registerActionPlugins
public void registerActionPlugins()
Registers all plugins that implementBaseAction
with their ids in this manager.
-
init
public void init()
Installs actions in the UI (if they have a location specified).- Specified by:
init
in interfaceApplicationComponent<BeaTunes>
-
shutdown
public void shutdown()
Description copied from interface:ApplicationComponent
Shuts down this component and its sub-components.- Specified by:
shutdown
in interfaceApplicationComponent<BeaTunes>
-
installApplicationsInto
public void installApplicationsInto(Object root)
Installs all registered actions in the given root object using theirActionLocation
s.- Parameters:
root
- UI root object
-
installApplicationsInto
public void installApplicationsInto(Object root, Predicate<ActionLocation> actionLocationFilter)
Installs registered actions that fit the given predicate in the given root object using theirActionLocation
s.- Parameters:
root
- UI root objectactionLocationFilter
- filter predicate for the location collections
-
-