Package org.jorigin.event
Class EventPool
- java.lang.Object
-
- org.jorigin.event.EventPool
-
public class EventPool extends java.lang.ObjectEvent 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 useAWTEventas a global event. So All event that can be fired on the event pool must be anAWTEventor a subclass.- Since:
- 1.0.0
- Version:
- "1.0.8" - b201801141330L
- Author:
- Julien Seinturier - COMEX S.A. - contact@jorigin.org - https://github.com/jorigin/jeometry
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.event.EventListenerListidListenerListThe list of listenners attached to the pool
-
Constructor Summary
Constructors Constructor Description EventPool()Construct a new event pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(java.awt.event.AWTEventListener listener)Add a listener to the event pool.voiddispatchEvent(java.awt.AWTEvent event)Dispatch a new event to all registered listeners.voidremoveListener(java.awt.event.AWTEventListener listener)Remove a listener from the event pool.
-
-
-
Method Detail
-
addListener
public void addListener(java.awt.event.AWTEventListener listener)
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
public void removeListener(java.awt.event.AWTEventListener listener)
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
public void dispatchEvent(java.awt.AWTEvent event)
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.
-
-