|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcz.cuni.amis.pogamut.base.communication.command.react.CommandReact<COMMAND>
EVENT - public abstract class CommandReact<COMMAND extends CommandMessage>

This abstract class allows you to easily hook a specific outgoing-command-handling behavior. It automatically
register a listener for a specified CommandMessage for you and calls react(CommandMessage)
method automatically.
If you need to react only once to the event, use EventReactOnce.
Use EventReact.enable() and EventReact.disable() to enable react / disable react. The reaction is enabled
as default.
WARNING:Use as anonymous class, but save it as a field of your class! Note, that we're using weak-references to listeners and if you do not save pointer to the object, it will be gc()ed!
| Field Summary | |
|---|---|
protected IAct |
reactAct
|
protected java.lang.Class<COMMAND> |
reactCommandClass
|
protected ICommandListener<COMMAND> |
reactListener
|
| Constructor Summary | |
|---|---|
CommandReact(java.lang.Class<COMMAND> commandClass,
IAct worldView)
|
|
| Method Summary | |
|---|---|
void |
disable()
Disables the reaction. |
void |
enable()
Enables the reaction. |
protected void |
postReact(COMMAND event)
post- EventReact.react(IWorldEvent) hook allowing you to do additional work after the react method. |
protected void |
preReact(COMMAND event)
pre- EventReact.react(IWorldEvent) hook allowing you to do additional work before the react method. |
protected abstract void |
react(COMMAND event)
React upon event notification. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ICommandListener<COMMAND extends CommandMessage> reactListener
protected IAct reactAct
protected java.lang.Class<COMMAND extends CommandMessage> reactCommandClass
| Constructor Detail |
|---|
public CommandReact(java.lang.Class<COMMAND> commandClass,
IAct worldView)
| Method Detail |
|---|
public void disable()
public void enable()
protected void preReact(COMMAND event)
EventReact.react(IWorldEvent) hook allowing you to do additional work before the react method.
event - protected abstract void react(COMMAND event)
event - protected void postReact(COMMAND event)
EventReact.react(IWorldEvent) hook allowing you to do additional work after the react method.
event -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||