org.flexdock.event
Class EventHandler

java.lang.Object
  extended by org.flexdock.event.EventHandler
Direct Known Subclasses:
DockbarEventHandler, DockingEventHandler, LayoutEventHandler, PerspectiveEventHandler, RegistrationHandler, RegistrationHandler

public abstract class EventHandler
extends Object

Author:
Christopher Butler

Field Summary
protected  ArrayList globalListeners
           
 
Constructor Summary
EventHandler()
           
 
Method Summary
abstract  boolean acceptsEvent(Event evt)
          Tests a given event to determine if this handler can handle that event.
abstract  boolean acceptsListener(EventListener listener)
           
 void addListener(EventListener listener)
           
 EventListener[] getListeners(Object eventTarget)
           
abstract  void handleEvent(Event evt, EventListener listener, int eventType)
           
 void handleEvent(Event evt, Object[] targets)
          This method handles all of the events.
 void removeListener(EventListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

globalListeners

protected ArrayList globalListeners
Constructor Detail

EventHandler

public EventHandler()
Method Detail

acceptsEvent

public abstract boolean acceptsEvent(Event evt)
Tests a given event to determine if this handler can handle that event.

Parameters:
evt - the event to test.
Returns:
true if this handler handles the event, false otherwise.

acceptsListener

public abstract boolean acceptsListener(EventListener listener)

handleEvent

public abstract void handleEvent(Event evt,
                                 EventListener listener,
                                 int eventType)

addListener

public void addListener(EventListener listener)

removeListener

public void removeListener(EventListener listener)

handleEvent

public void handleEvent(Event evt,
                        Object[] targets)
This method handles all of the events. First passing each event to handleEvent(Event, EventListener, int) for every registered listener in the globalListeners list. Then, it passes the event to each of the target listeners passed in via targets.

Parameters:
evt - the event to process.
targets - the local listeners to pass the event to.

getListeners

public EventListener[] getListeners(Object eventTarget)