org.flexdock.event

## Class EventHandler

- java.lang.Object
- - org.flexdock.event.EventHandler

- Direct Known Subclasses:
    DockbarEventHandler, DockingEventHandler, LayoutEventHandler, PerspectiveEventHandler, RegistrationHandler, RegistrationHandler

      public abstract class EventHandler
      extends java.lang.Object

  Author:
    Christopher Butler

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.ArrayList` | `globalListeners`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EventHandler()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract boolean` | `acceptsEvent(Event evt)` Tests a given event to determine if this handler can handle that event.
    `abstract boolean` | `acceptsListener(java.util.EventListener listener)`
    `void` | `addListener(java.util.EventListener listener)`
    `java.util.EventListener[]` | `getListeners(java.lang.Object eventTarget)`
    `abstract void` | `handleEvent(Event evt, java.util.EventListener listener, int eventType)`
    `void` | `handleEvent(Event evt, java.lang.Object[] targets)` This method handles all of the events.
    `void` | `removeListener(java.util.EventListener listener)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### globalListeners

          protected java.util.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(java.util.EventListener listener)

    - #### handleEvent

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

    - #### addListener

          public void addListener(java.util.EventListener listener)

    - #### removeListener

          public void removeListener(java.util.EventListener listener)

    - #### handleEvent

          public void handleEvent(Event evt,
                         java.lang.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 java.util.EventListener[] getListeners(java.lang.Object eventTarget)