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
JebEvent
s. 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 TypeMethodDescriptionvoid
addListener
(IEventListener listener) Register a listener.int
Get the numbers of objects listening to this event source.Get a copy of the list of listeners.Get the parent source.void
insertListener
(int index, IEventListener listener) Register a listener.void
void
notifyListeners
(JebEvent e, boolean notifyParent) void
Notify listeners that an event has occurred.void
removeListener
(IEventListener listener) Unregister a listener.void
setParentSource
(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:IEventSource
Set a parent source.- Specified by:
setParentSource
in interfaceIEventSource
- Parameters:
parentSource
- the optional parent source
-
getParentSource
Description copied from interface:IEventSource
Get the parent source.- Specified by:
getParentSource
in interfaceIEventSource
- Returns:
- the parent source, or null if none
-
countListeners
public int countListeners()Description copied from interface:IEventSource
Get the numbers of objects listening to this event source.- Specified by:
countListeners
in interfaceIEventSource
- Returns:
- the number of listeners
-
getListeners
Description copied from interface:IEventSource
Get a copy of the list of listeners.- Specified by:
getListeners
in interfaceIEventSource
- Returns:
-
addListener
Description copied from interface:IEventSource
Register a listener. The listener is appended to the existing list of listeners. The implementor may allow duplicates.- Specified by:
addListener
in interfaceIEventSource
- Parameters:
listener
- a listener of events generated by this source
-
insertListener
Description copied from interface:IEventSource
Register a listener. The implementor may allow duplicates.- Specified by:
insertListener
in interfaceIEventSource
- Parameters:
index
- insertion pointlistener
- a listener of events generated by this source
-
removeListener
Description copied from interface:IEventSource
Unregister a listener. If the implementor allows duplicates in addListener(), it should deal with those consistently.- Specified by:
removeListener
in interfaceIEventSource
- Parameters:
listener
- the listener to be removed
-
notifyListeners
Description copied from interface:IEventSource
Notify listeners that an event has occurred.- Specified by:
notifyListeners
in interfaceIEventSource
- Parameters:
e
- the event to be propagated
-
notifyListeners
-
notifyListeners
-