Package com.pnfsoftware.jeb.core.events
Class JebEventSource
java.lang.Object
com.pnfsoftware.jeb.core.events.JebEventSource
- All Implemented Interfaces:
IEventSource
- Direct Known Subclasses:
AbstractUnit,Artifact
The standard engines implementation of an
IEventSource. Designed to emit
JebEvents. After deserialization, the listeners list is empty, and the parent set to null
(it is neither serialized nor automatically restored).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an event with a null parent source.JebEventSource(IEventSource parentSource) Create an event source and hook it to a parent source. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(IEventListener listener) Register a listener.intGet the numbers of objects listening to this event source.Get a copy of the list of listeners.Get the parent source.voidinsertListener(int index, IEventListener listener) Register a listener.voidvoidnotifyListeners(JebEvent e, boolean notifyParent) voidNotify listeners that an event has occurred.voidremoveListener(IEventListener listener) Unregister a listener.voidsetParentSource(IEventSource parentSource) Set a parent source.
-
Field Details
-
onEventCallCount
-
-
Constructor Details
-
JebEventSource
public JebEventSource()Create an event with a null parent source. -
JebEventSource
Create an event source and hook it to a parent source. When this source notifies its observers of an event, the "parent source" will also be notified (regardless of the "parent source" being a listener of that observable).- Parameters:
parentSource- source that generated the event
-
-
Method Details
-
setParentSource
Description copied from interface:IEventSourceSet a parent source.- Specified by:
setParentSourcein interfaceIEventSource- Parameters:
parentSource- the optional parent source
-
getParentSource
Description copied from interface:IEventSourceGet the parent source.- Specified by:
getParentSourcein interfaceIEventSource- Returns:
- the parent source, or null if none
-
countListeners
public int countListeners()Description copied from interface:IEventSourceGet the numbers of objects listening to this event source.- Specified by:
countListenersin interfaceIEventSource- Returns:
- the number of listeners
-
getListeners
Description copied from interface:IEventSourceGet a copy of the list of listeners.- Specified by:
getListenersin interfaceIEventSource- Returns:
-
addListener
Description copied from interface:IEventSourceRegister a listener. The listener is appended to the existing list of listeners. The implementor may allow duplicates.- Specified by:
addListenerin interfaceIEventSource- Parameters:
listener- a listener of events generated by this source
-
insertListener
Description copied from interface:IEventSourceRegister a listener. The implementor may allow duplicates.- Specified by:
insertListenerin interfaceIEventSource- Parameters:
index- insertion pointlistener- a listener of events generated by this source
-
removeListener
Description copied from interface:IEventSourceUnregister a listener. If the implementor allows duplicates in addListener(), it should deal with those consistently.- Specified by:
removeListenerin interfaceIEventSource- Parameters:
listener- the listener to be removed
-
notifyListeners
Description copied from interface:IEventSourceNotify listeners that an event has occurred.- Specified by:
notifyListenersin interfaceIEventSource- Parameters:
e- the event to be propagated
-
notifyListeners
-
notifyListeners
-