schwing.event
Class EventListenerParser

java.lang.Object
  |
  +--schwing.event.EventListenerParser

public class EventListenerParser
extends java.lang.Object

The EventListenerParser parses an instance of EventListenerList for entries of a specific Class. It then sends each instance found the the supplied listener.

An example for using the parser would be:

 transient EventListenerList _listeners = new EventListenerList();
 
 public void fireFooEvent()
     {
         EventListenerParser.parse(_listeners,                             // the EventListenerList object
                                  DesiredListenerInterface.class,          // the desired class 
                                  new EventListenerParser.ParserCallback() // the callback object
                                      {
                                      public void found(Object listener)
                                          {
                                          ((DesiredListenerInterface )listener).methodCall();
                                          }
                                      }
     }
 

Version:
$Revision: 1.2 $
Author:
Darryl L. Pierce

Inner Class Summary
static interface EventListenerParser.ParserCallback
          The callback interface.
 
Constructor Summary
EventListenerParser()
           
 
Method Summary
static void parse(javax.swing.event.EventListenerList listeners, java.lang.Class clazz, EventListenerParser.ParserCallback callback)
          Scans the supplied list of listeners for the specific class types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventListenerParser

public EventListenerParser()
Method Detail

parse

public static void parse(javax.swing.event.EventListenerList listeners,
                         java.lang.Class clazz,
                         EventListenerParser.ParserCallback callback)

Scans the supplied list of listeners for the specific class types. When instances are found, the supplied callback object is notified.

Parameters:
listeners - the list of listeners
clazz - the desired class type
callback - the object to be notified