public abstract class EventDispatcher extends EventObject implements IEventDispatcher
This class serves as the base class for all dispatchers. It implements dispatch by event type. When an event is received for dispatch, the class first delegates the dispatch to the derived class. If the derived class does not dispatch the event, then the event is dispatched to the handler registered for the event type. If no handler is registsred, then the event is dropped.
Modifier and Type | Method and Description |
---|---|
void |
addEventHandler(Class<? extends Event> type,
IEventHandler handler)
Add an event type handler.
|
void |
onEvent(Event event)
Implementation of
IEventHandler.onEvent(com.neeve.event.Event) |
void |
removeEventHandler(Class<? extends Event> type,
IEventHandler handler)
Remove an event type handler.
|
getChecked, getThreaded, getTracer, setChecked, setTracer
public final void addEventHandler(Class<? extends Event> type, IEventHandler handler)
addEventHandler
in interface IEventDispatcher
type
- The event type for which the handler is being installed.handler
- The handler being added.public final void removeEventHandler(Class<? extends Event> type, IEventHandler handler)
removeEventHandler
in interface IEventDispatcher
type
- The event type for which the handler is being removed.handler
- The handler being removed.public void onEvent(Event event)
IEventHandler.onEvent(com.neeve.event.Event)
onEvent
in interface IEventHandler
event
- The event to be handled.Copyright © 2019 Neeve Research, LLC. All Rights Reserved.