org.mozdev.MacroTracker.toolkit.event
Class EventManager<E>

java.lang.Object
  extended by org.mozdev.MacroTracker.toolkit.event.EventManager<E>
All Implemented Interfaces:
java.io.Serializable

public class EventManager<E>
extends java.lang.Object
implements java.io.Serializable

This class manages events that can be fired in a program.

This class executes a method taken in and runs them using the parameters taken in through the run() method.

As an example, if we're to use a EventManager for ActionListeners, we'd do this:

EventManager events = new EventManager("actionPerformed");
events.run(new ActionEvent());

Since:
MacroToolkit 0.9
See Also:
Serialized Form

Constructor Summary
EventManager(java.lang.String mtd)
           
 
Method Summary
 void addListener(E event)
          Adds an event to be executed when the event that this event manager manages is executed.
 java.util.Iterator<E> iterator()
          Returns an iterator of all the events contained in this class.
 void run()
          Runs the method taken into the EventManager and taking no parameters to that method.
 void run(java.lang.Object... args)
          Runs the method name taken into the EventManager and takes in an array of parameters for the method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventManager

public EventManager(java.lang.String mtd)
Parameters:
mtd - The method to execute when the events are ran through the run() method.
Method Detail

addListener

public void addListener(E event)
Adds an event to be executed when the event that this event manager manages is executed.


run

public void run()
Runs the method taken into the EventManager and taking no parameters to that method.

See Also:
run(Object[])

iterator

public java.util.Iterator<E> iterator()
Returns an iterator of all the events contained in this class.


run

public void run(java.lang.Object... args)
Runs the method name taken into the EventManager and takes in an array of parameters for the method.