java.lang.Object | |
↳ | com.pnfsoftware.jeb.util.events.EventSource |
![]() |
![]() |
Standard implementation for an event source.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
EventSource()
Create an event source not attached to a parent source.
| |||||||||||
EventSource(EventSource parentSource)
Create an event source attached to an optional parent source.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized void |
addListener(IEventListener listener)
Register a listener.
| ||||||||||
synchronized int |
countListeners()
Get the numbers of objects listening to this event source.
| ||||||||||
synchronized List<IEventListener> |
getListeners()
Get a copy of the list of listeners.
| ||||||||||
synchronized IEventSource |
getParentSource()
Get the parent source.
| ||||||||||
synchronized void |
insertListener(int index, IEventListener listener)
Insert a listner at the given position.
| ||||||||||
void | notifyListeners(Event e) | ||||||||||
void |
notifyListeners(IEvent e)
Notify listeners that an event has occurred.
| ||||||||||
static IEventListener |
relay(IEventSource origin, IEventSource proxy)
Relay events issued from an origin to the listeners of a proxy.
| ||||||||||
synchronized boolean |
removeListener(IEventListener listener)
Unregister a listener.
| ||||||||||
synchronized void |
setParentSource(IEventSource parentSource)
Set a parent source.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Create an event source not attached to a parent source.
Create an event source attached to an optional parent source. If present, events generated by this source will be propagated to its listeners as well as the parent source's listeners.
parentSource | optional parent source |
---|
Register a listener. The implementor may allow duplicates.
listener | a listener of events generated by this source |
---|
Get the numbers of objects listening to this event source.
Get the parent source.
Insert a listner at the given position.
Notify listeners that an event has occurred.
e | the event to be propagated |
---|
Relay events issued from an origin to the listeners of a proxy.
origin | events are emitted by this origin event source |
---|---|
proxy | events will be relayed by this proxy event source |
Unregister a listener. If the implementor allows duplicates in addListener(), it should deal with those consistently.
listener | the listener to be removed |
---|
Set a parent source.
parentSource | the optional parent source |
---|