public interface HGEventManager extends HGGraphHolder
A HGEventManager
is bound to a single HyperGraph instance. It is responsible for holding
all event listeners and it performs event handling via its dispatch
method. Concrete
implementations can be configured with the HGConfiguration
object when the database is
opened.
Event types are simply identified by their Java class objects.
Modifier and Type | Method and Description |
---|---|
<T extends HGEvent> |
addListener(Class<T> eventType,
HGListener listener)
Register a new listener for a given event type.
|
void |
clear()
Removal all event listeners for all event types.
|
HGListener.Result |
dispatch(HyperGraph graph,
HGEvent event)
Dispatch an event to all listeners registered for its type.
|
<T extends HGEvent> |
removeListener(Class<T> eventType,
HGListener listener)
Remove a listener registered for the particular type.
|
setHyperGraph
<T extends HGEvent> void addListener(Class<T> eventType, HGListener listener)
T
- eventType
- listener
- <T extends HGEvent> void removeListener(Class<T> eventType, HGListener listener)
T
- eventType
- listener
- void clear()
HGListener.Result dispatch(HyperGraph graph, HGEvent event)
Dispatch an event to all listeners registered for its type. All listeners
are invoked in the order in which they were registered. If a listener returns
a HGListener.Result.cancel
event, the dispatch process is interrupted and
the cancellation is passed on to the caller of the dispatch method without invoking
any further listeners.
Because event types can be organized in hierarchy, rooted at HGEvent
, a dispatcher
must call listener registered for the particular event class and also all its superclasses up
to the HGEvent
type itself.
graph
- event
- Copyright © 2015. All rights reserved.