Class EventPool

java.lang.Object
org.jorigin.event.EventPool

public class EventPool extends Object
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 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 Details

    • idListenerList

      protected EventListenerList 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

      public void addListener(AWTEventListener listener)
      Add a listener to the event pool. The listener must implements the interface AWTEventListener because the interface EventListener is empty and does not determine a dispatch method.
      Parameters:
      listener - the listener to add.
    • removeListener

      public void removeListener(AWTEventListener listener)
      Remove a listener from the event pool. The listener must implements interface AWTEventListener because the interface EventListener is empty and does not determine a dispatch method.
      Parameters:
      listener - the listener to remove.
    • dispatchEvent

      public void dispatchEvent(AWTEvent event)
      Dispatch a new event to all registered listeners. The event must be a subclass of AWTEvent because the listener are AWTEventListener.
      Parameters:
      event - the event to dispatch.