public class WeakEventSource extends EventSource
EventSource
class to allow
for storing of weak references to the listeners being
registered. This implementation does not
keep
strong references to registered listeners so that listeners
which are not strongly referenced from their origin can be
gc-ed at any time.deadListenerCount, deadListenerTreshold, eventListeners, eventsEnabled, eventSource
Constructor and Description |
---|
WeakEventSource()
Constructs a new event source using this as the source object.
|
WeakEventSource(java.lang.Object source)
Constructs a new event source for the given source object.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.lang.String eventName,
EventListener listener)
Registers the given
listener for events of the
specified eventName or as a listener for all
events in the case the eventName parameter is null |
void |
removeEventListener(EventListener listener,
java.lang.String eventName)
Removes from the list of registered listeners all pairs
matching the given combination of
EventListener
and eventName . |
clearEventListeners, fireEvent, fireEvent, fireEventEDT, fireEventEDT, getDeadListenerTreshold, getEventSource, isEventsEnabled, removeEventListener, setDeadListenerTreshold, setEventsEnabled, setEventSource
public WeakEventSource()
public WeakEventSource(java.lang.Object source)
public void addListener(java.lang.String eventName, EventListener listener)
EventSource
listener
for events of the
specified eventName
or as a listener for all
events in the case the eventName
parameter is null
addListener
in class EventSource
eventName
- name of events to listen for or null
if
the listener is meant to receive all fired eventslistener
- the EventListener
to be registeredEventSource.addListener(java.lang.String, de.ims.icarus.ui.events.EventListener)
public void removeEventListener(EventListener listener, java.lang.String eventName)
EventSource
EventListener
and eventName
. If eventName
is null
then all occurrences of the given listener
will be
removed.removeEventListener
in class EventSource
EventSource.removeEventListener(de.ims.icarus.ui.events.EventListener, java.lang.String)