java.lang.Object
org.jorigin.event.EventPool
Event pool class enable to share events between many components. The event pool register listeners
and dispatch event. Components which have to fire event to other use the event pool to propagate it.
This class use
This class use
AWTEvent as a global event. So All event that can be fired on the event pool must be
an AWTEvent or a subclass.- Since:
- 1.0.0
- Version:
- "1.0.14" - b202111241200L
- Author:
- Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EventListenerListThe list of listenners attached to the pool -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(AWTEventListener listener) Add a listener to the event pool.voiddispatchEvent(AWTEvent event) Dispatch a new event to all registered listeners.voidremoveListener(AWTEventListener listener) Remove a listener from the event pool.
-
Field Details
-
idListenerList
The list of listenners attached to the pool
-
-
Constructor Details
-
EventPool
public EventPool()Construct a new event pool. This method creates the listener list.
-
-
Method Details
-
addListener
Add a listener to the event pool. The listener must implements the interfaceAWTEventListenerbecause the interfaceEventListeneris empty and does not determine a dispatch method.- Parameters:
listener- the listener to add.
-
removeListener
Remove a listener from the event pool. The listener must implements interfaceAWTEventListenerbecause the interfaceEventListeneris empty and does not determine a dispatch method.- Parameters:
listener- the listener to remove.
-
dispatchEvent
Dispatch a new event to all registered listeners. The event must be a subclass ofAWTEventbecause the listener are AWTEventListener.- Parameters:
event- the event to dispatch.
-