de.cau.cs.kieler.sim.kiem.internal
Class EventManager

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.internal.EventManager

public class EventManager
extends Object

The event manager holds several listener-lists for each available event. These listeners can be easily notified with optionally attached information.

Rating proposed yellow
(2009-01-15)

Constructor Summary
EventManager()
          Instantiates a new EventManager.
 
Method Summary
 void add(DataComponentWrapper dataComponentWrapper)
          Adds the DataComponentWrapper to one or more event lists.
 void add(IKiemEventListener listener)
          Adds the IKiemEventListener to one or more event lists.
 void notify(int event)
          Notify all registered DataComponents via the KiemEvent mechanism.
 void notify(KiemEvent events)
          Notify all registered DataComponents via the KiemEvent mechanism.
 void remove(DataComponentWrapper dataComponentWrapper)
          Removes the DataComponentWrapper from all event list it has registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventManager

public EventManager()
Instantiates a new EventManager.

Method Detail

add

public void add(IKiemEventListener listener)
Adds the IKiemEventListener to one or more event lists. Event lists are only instantiated if they are needed, i.e., at least one listener registers for an event.

Parameters:
listener - the listener

add

public void add(DataComponentWrapper dataComponentWrapper)
Adds the DataComponentWrapper to one or more event lists. Event lists are only instantiated if they are needed, i.e., at least one component registers for an event.

Parameters:
dataComponentWrapper - the data component wrapper

remove

public void remove(DataComponentWrapper dataComponentWrapper)
Removes the DataComponentWrapper from all event list it has registered. Will remove event lists if they do not contain any DataComponents any more.

Parameters:
dataComponentWrapper - the data component wrapper

notify

public void notify(int event)
Notify all registered DataComponents via the KiemEvent mechanism. This helper method wraps the creation of a KiemEvent object.

Parameters:
event - the event as an KiemEvent (integer) constant

notify

public void notify(KiemEvent events)
Notify all registered DataComponents via the KiemEvent mechanism.

Parameters:
events - the event containing optional additional information