public class HGDefaultEventManager extends Object implements HGEventManager
Constructor and Description |
---|
HGDefaultEventManager() |
HGDefaultEventManager(HyperGraph graph) |
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 hg,
HGEvent event)
Dispatch an event to all listeners registered for its type.
|
HyperGraph |
getHyperGraph() |
void |
initListenerMap() |
<T extends HGEvent> |
removeListener(Class<T> eventType,
HGListener listener)
Remove a listener registered for the particular type.
|
void |
setHyperGraph(HyperGraph graph)
During load time, set the
HyperGraph
instance to which this atom belongs. |
public HGDefaultEventManager()
public HGDefaultEventManager(HyperGraph graph)
public void initListenerMap()
public <T extends HGEvent> void addListener(Class<T> eventType, HGListener listener)
HGEventManager
addListener
in interface HGEventManager
public <T extends HGEvent> void removeListener(Class<T> eventType, HGListener listener)
HGEventManager
removeListener
in interface HGEventManager
public HGListener.Result dispatch(HyperGraph hg, HGEvent event)
HGEventManager
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.
dispatch
in interface HGEventManager
public void clear()
HGEventManager
clear
in interface HGEventManager
public void setHyperGraph(HyperGraph graph)
HGGraphHolder
During load time, set the HyperGraph
instance to which this atom belongs.
setHyperGraph
in interface HGGraphHolder
public HyperGraph getHyperGraph()
Copyright © 2015. All rights reserved.