wt.clients.beans
Class WTEventMulticaster

java.lang.Object
  extended byjava.awt.AWTEventMulticaster
      extended bywt.clients.beans.WTEventMulticaster
All Implemented Interfaces:
ActionListener, AdjustmentListener, ComponentListener, ContainerListener, EventListener, FocusListener, HierarchyBoundsListener, HierarchyListener, InputMethodListener, ItemListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, RapidFindListener, TextListener, WindowFocusListener, WindowListener, WindowStateListener

public class WTEventMulticaster
extends AWTEventMulticaster
implements RapidFindListener

A class which implements efficient and thread-safe multi-cast event dispatching for the AWT events defined in the java.awt.event package. This class will manage an immutable structure consisting of a chain of event listeners and will dispatch events to those listeners. Because the structure is immutable, it is safe to use this API to add/remove listeners during the process of an event dispatch operation. An example of how this class could be used to implement a new component which fires "action" events:


 public myComponent extends Component {
     ActionListener actionListener = null;

     public void addActionListener(ActionListener l) {
	   actionListener = AWTEventMulticaster.add(actionListener, l);
     }
     public void removeActionListener(ActionListener l) {
  	   actionListener = AWTEventMulticaster.remove(actionListener, l);
     }
     public void processEvent(AWTEvent e) {
         // when event occurs which causes "action" semantic
         if (actionListener != null) {
             actionListener.actionPerformed(new ActionEvent());
         }
 }
 


Field Summary
private static String versionID
           
 
Fields inherited from class java.awt.AWTEventMulticaster
a, b
 
Constructor Summary
protected WTEventMulticaster(EventListener a, EventListener b)
          Creates an event multicaster instance which chains listener-a with listener-b.
 
Method Summary
static RapidFindListener add(RapidFindListener a, RapidFindListener b)
          Adds rapidfind-listener-a with rapidfind-listener-b and returns the resulting multicast listener.
 void retrieveBegin(RapidFindEvent event)
          Handles the retrieve begin event by invoking the retrieveBegin methods on listener-a and listener-b.
 void retrieveComplete(RapidFindEvent event)
          Handles the retrieve complete event by invoking the retrieveComplete methods on listener-a and listener-b.
 
Methods inherited from class java.awt.AWTEventMulticaster
actionPerformed, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, add, addInternal, adjustmentValueChanged, ancestorMoved, ancestorResized, caretPositionChanged, componentAdded, componentHidden, componentMoved, componentRemoved, componentResized, componentShown, focusGained, focusLost, getListeners, hierarchyChanged, inputMethodTextChanged, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, removeInternal, save, saveInternal, textValueChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values
Constructor Detail

WTEventMulticaster

protected WTEventMulticaster(EventListener a,
                             EventListener b)
Creates an event multicaster instance which chains listener-a with listener-b.

Parameters:
a - listener-a
b - listener-b
Method Detail

retrieveBegin

public void retrieveBegin(RapidFindEvent event)
Handles the retrieve begin event by invoking the retrieveBegin methods on listener-a and listener-b.

Specified by:
retrieveBegin in interface RapidFindListener
Parameters:
event - the key event

retrieveComplete

public void retrieveComplete(RapidFindEvent event)
Handles the retrieve complete event by invoking the retrieveComplete methods on listener-a and listener-b.

Specified by:
retrieveComplete in interface RapidFindListener
Parameters:
event - the key event

add

public static RapidFindListener add(RapidFindListener a,
                                    RapidFindListener b)
Adds rapidfind-listener-a with rapidfind-listener-b and returns the resulting multicast listener.

Parameters:
a - mouse-listener-a
b - mouse-listener-b