Class MovementRequestEventMulticaster

java.lang.Object
  |
  +--java.awt.AWTEventMulticaster
        |
        +--MovementRequestEventMulticaster

public class MovementRequestEventMulticaster
extends java.awt.AWTEventMulticaster
implements MovementRequestListener

An event multicaster allows for multiple listeners to be registered for a single broadcaster. The way that it works is this: each event multicaster is itself an event listener and each multicaster sends objects to two listeners. When a listener is added to the multicaster the multicaster adds a second multicaster as its second listener and then that multicaster sets the listenere being added as its first listener (leaving the second slot open for the addition of another multicaster so as to add another listener.

Essentially the process is the creation of a chain. When a new link is added to the chain it travels to the end.

When an event is broadcast it simply travels down the chain being sent to each listener along the way.


Fields inherited from class java.awt.AWTEventMulticaster
a, b
 
Constructor Summary
protected MovementRequestEventMulticaster(java.util.EventListener a, java.util.EventListener b)
          Creates a new multicaster.
 
Method Summary
static MovementRequestListener add(MovementRequestListener a, MovementRequestListener b)
          Adds a listener a and multicaster b to the list.
protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b)
           
 void movementRequested(MovementRequestEvent e)
          This is the implementation which allows this class to implement MovementRequestListener.
protected  java.util.EventListener remove(java.util.EventListener l)
           
static MovementRequestListener remove(MovementRequestListener a, MovementRequestListener b)
          Removes a listener a and multicaster b from the list.
 
Methods inherited from class java.awt.AWTEventMulticaster
actionPerformed, add, add, add, add, add, add, add, add, add, add, add, add, adjustmentValueChanged, caretPositionChanged, componentAdded, componentHidden, componentMoved, componentRemoved, componentResized, componentShown, focusGained, focusLost, inputMethodTextChanged, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, remove, removeInternal, save, saveInternal, textValueChanged, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovementRequestEventMulticaster

protected MovementRequestEventMulticaster(java.util.EventListener a,
                                          java.util.EventListener b)
Creates a new multicaster. Recall from the introduction that a is an object wishing to recieve events and the second is simply another multicaster existing to allow chaining.
Parameters:
a - object listening
b - multicaster to chain
Method Detail

add

public static MovementRequestListener add(MovementRequestListener a,
                                          MovementRequestListener b)
Adds a listener a and multicaster b to the list. Remember that a MovementRequestEventMulticaster is a MovementRequestListener
Parameters:
a - object listening
b - multicaster to chain

remove

public static MovementRequestListener remove(MovementRequestListener a,
                                             MovementRequestListener b)
Removes a listener a and multicaster b from the list. Remember that a MovementRequestEventMulticaster is a MovementRequestListener
Parameters:
a - object listening
b - multicaster

addInternal

protected static java.util.EventListener addInternal(java.util.EventListener a,
                                                     java.util.EventListener b)

remove

protected java.util.EventListener remove(java.util.EventListener l)
Overrides:
remove in class java.awt.AWTEventMulticaster

movementRequested

public void movementRequested(MovementRequestEvent e)
This is the implementation which allows this class to implement MovementRequestListener. A call to this begins the chain.
Specified by:
movementRequested in interface MovementRequestListener
Parameters:
e - the event to broadcast