Class EventPool


  • public class EventPool
    extends java.lang.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
    Author:
    Julien Seinturier - (c) 2009 - JOrigin project - http:/www.jorigin.org
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.event.EventListenerList idListenerList
      The 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
      void addListener​(java.awt.event.AWTEventListener listener)
      Add a listener to the event pool.
      void dispatchEvent​(java.awt.AWTEvent event)
      Dispatch a new event to all registered listeners.
      void removeListener​(java.awt.event.AWTEventListener listener)
      Remove a listener from the event pool.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • idListenerList

        protected javax.swing.event.EventListenerList idListenerList
        The list of listenners attached to the pool
    • Constructor Detail

      • EventPool

        public EventPool()
        Construct a new event pool. This method creates the listener list.
    • Method Detail

      • addListener

        public void addListener​(java.awt.event.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​(java.awt.event.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​(java.awt.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.