imx.lib.listener
Class ListenerBag

java.lang.Object
  extended by imx.lib.listener.ListenerBag
All Implemented Interfaces:
java.io.Serializable

public class ListenerBag
extends java.lang.Object
implements java.io.Serializable

ListenerBag is used to implement easily an active object (one that implements the ActiveInterface). It handles the listeners, updates them and offers a lock mechanisme. This ListenerBag does not handle EventTypes.

See Also:
ListenerInterface, Serialized Form

Constructor Summary
ListenerBag()
           
ListenerBag(java.lang.String name)
          If you want to set a unique identifier to be used in the logs for this ListenerBag, define it with the parameter name.
 
Method Summary
 void addListener(ListenerInterface listener)
           
 void lock()
          Blocks all update calls until unlock() is called. unlock() needs to be called as many times as lock has been called before.
 void removeAllListener()
           
 void removeListener(ListenerInterface listener)
           
 void unlock()
           
 void update(java.lang.Object command)
          Updates all registered listeners with command, if the ListenerBag has not been locked.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerBag

public ListenerBag(java.lang.String name)
If you want to set a unique identifier to be used in the logs for this ListenerBag, define it with the parameter name.


ListenerBag

public ListenerBag()
Method Detail

addListener

public void addListener(ListenerInterface listener)

removeListener

public void removeListener(ListenerInterface listener)

removeAllListener

public void removeAllListener()

update

public void update(java.lang.Object command)
Updates all registered listeners with command, if the ListenerBag has not been locked.


lock

public void lock()
Blocks all update calls until unlock() is called. unlock() needs to be called as many times as lock has been called before.


unlock

public void unlock()
See Also:
lock()