|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.malai.action.ActionsRegistry
public final class ActionsRegistry
A register of actions.
This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN
Malai is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
Field Summary | |
---|---|
private java.util.List<Action> |
actions
The saved actions. |
private java.util.List<ActionHandler> |
handlers
The actions handlers. |
static ActionsRegistry |
INSTANCE
The register of actions. |
private int |
sizeMax
The max number of actions that can contains the register. |
Constructor Summary | |
---|---|
private |
ActionsRegistry()
Creates and initialises a register. |
Method Summary | ||
---|---|---|
void |
abortAction(Action action)
Aborts the given action, i.e. the action is aborted then remove from the register. |
|
void |
addAction(Action action,
ActionHandler actionHanndler)
Adds an action to the register. |
|
void |
addHandler(ActionHandler handler)
Adds an action handler. |
|
void |
cancelActions(Action action)
Removes and flushes actions from the register using a given action. |
|
|
getAction(java.lang.Class<T> clazz)
|
|
java.util.List<Action> |
getActions()
|
|
int |
getSizeMax()
|
|
void |
onActionDone(Action action)
Notifies handlers that an action ends. |
|
void |
onActionExecuted(Action action)
Notifies handlers that an action has been executed. |
|
void |
removeAction(Action action)
Removes the action from the register. |
|
void |
removeAllHandlers()
Removes all the action handlers. |
|
void |
removeHandler(ActionHandler handler)
Removes the given handler. |
|
void |
setSizeMax(int sizeMax)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.List<Action> actions
private java.util.List<ActionHandler> handlers
private int sizeMax
public static final ActionsRegistry INSTANCE
Constructor Detail |
---|
private ActionsRegistry()
Method Detail |
---|
public void onActionExecuted(Action action)
action
- The executed action.public void onActionDone(Action action)
action
- The action that ends.public java.util.List<Action> getActions()
public void cancelActions(Action action)
action
- The action that may cancels others.public void addAction(Action action, ActionHandler actionHanndler)
action
- The action to add. Cannot be null.actionHanndler
- The handler that produced or is associated to the action. Cannot be null.public void removeAction(Action action)
action
- The action to remove.public void addHandler(ActionHandler handler)
handler
- The handler to add.public void removeHandler(ActionHandler handler)
handler
- The handler to remove.public void removeAllHandlers()
public <T extends Action> T getAction(java.lang.Class<T> clazz)
clazz
- The reference class.
public void abortAction(Action action)
action
- The action to abort.public int getSizeMax()
public void setSizeMax(int sizeMax)
sizeMax
- The max number of actions that can contains the register. Must be equal or greater than 0.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |