java.awt.dnd
Class DnDEventMulticaster

java.lang.Object
  |
  +--java.awt.AWTEventMulticaster
        |
        +--java.awt.dnd.DnDEventMulticaster
All Implemented Interfaces:
ActionListener, AdjustmentListener, ComponentListener, ContainerListener, DragSourceListener, DragSourceMotionListener, EventListener, FocusListener, HierarchyBoundsListener, HierarchyListener, InputMethodListener, ItemListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, TextListener, WindowFocusListener, WindowListener, WindowStateListener

class DnDEventMulticaster
extends AWTEventMulticaster
implements DragSourceListener, DragSourceMotionListener

A class extends AWTEventMulticaster to implement efficient and thread-safe multi-cast event dispatching for the drag-and-drop events defined in the java.awt.dnd package.

Since:
1.4
Version:
1.3, 12/17/01
See Also:
AWTEventMulticaster

Field Summary
 
Fields inherited from class java.awt.AWTEventMulticaster
a, b
 
Constructor Summary
protected DnDEventMulticaster(EventListener a, EventListener b)
          Creates an event multicaster instance which chains listener-a with listener-b.
 
Method Summary
static DragSourceListener add(DragSourceListener a, DragSourceListener b)
          Adds drag-source-listener-a with drag-source-listener-b and returns the resulting multicast listener.
static DragSourceMotionListener add(DragSourceMotionListener a, DragSourceMotionListener b)
          Adds drag-source-motion-listener-a with drag-source-motion-listener-b and returns the resulting multicast listener.
protected static EventListener addInternal(EventListener a, EventListener b)
          Returns the resulting multicast listener from adding listener-a and listener-b together.
 void dragDropEnd(DragSourceDropEvent dsde)
          Handles the DragSourceDropEvent by invoking dragDropEnd on listener-a and listener-b.
 void dragEnter(DragSourceDragEvent dsde)
          Handles the DragSourceDragEvent by invoking dragEnter on listener-a and listener-b.
 void dragExit(DragSourceEvent dse)
          Handles the DragSourceEvent by invoking dragExit on listener-a and listener-b.
 void dragMouseMoved(DragSourceDragEvent dsde)
          Handles the DragSourceDragEvent by invoking dragMouseMoved on listener-a and listener-b.
 void dragOver(DragSourceDragEvent dsde)
          Handles the DragSourceDragEvent by invoking dragOver on listener-a and listener-b.
 void dropActionChanged(DragSourceDragEvent dsde)
          Handles the DragSourceDragEvent by invoking dropActionChanged on listener-a and listener-b.
static DragSourceListener remove(DragSourceListener l, DragSourceListener oldl)
          Removes the old drag-source-listener from drag-source-listener-l and returns the resulting multicast listener.
static DragSourceMotionListener remove(DragSourceMotionListener l, DragSourceMotionListener ol)
          Removes the old drag-source-motion-listener from drag-source-motion-listener-l and returns the resulting multicast listener.
protected  EventListener remove(EventListener oldl)
          Removes a listener from this multicaster and returns the resulting multicast listener.
protected static EventListener removeInternal(EventListener l, EventListener oldl)
          Returns the resulting multicast listener after removing the old listener from listener-l.
protected static void save(ObjectOutputStream s, String k, EventListener l)
           
 
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, 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, 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
 

Constructor Detail

DnDEventMulticaster

protected DnDEventMulticaster(EventListener a,
                              EventListener b)
Creates an event multicaster instance which chains listener-a with listener-b. Input parameters a and b should not be null, though implementations may vary in choosing whether or not to throw NullPointerException in that case.

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

dragEnter

public void dragEnter(DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dragEnter on listener-a and listener-b.

Specified by:
dragEnter in interface DragSourceListener
Parameters:
dsde - the DragSourceDragEvent

dragOver

public void dragOver(DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dragOver on listener-a and listener-b.

Specified by:
dragOver in interface DragSourceListener
Parameters:
dsde - the DragSourceDragEvent

dropActionChanged

public void dropActionChanged(DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dropActionChanged on listener-a and listener-b.

Specified by:
dropActionChanged in interface DragSourceListener
Parameters:
dsde - the DragSourceDragEvent

dragExit

public void dragExit(DragSourceEvent dse)
Handles the DragSourceEvent by invoking dragExit on listener-a and listener-b.

Specified by:
dragExit in interface DragSourceListener
Parameters:
dse - the DragSourceEvent

dragDropEnd

public void dragDropEnd(DragSourceDropEvent dsde)
Handles the DragSourceDropEvent by invoking dragDropEnd on listener-a and listener-b.

Specified by:
dragDropEnd in interface DragSourceListener
Parameters:
dsde - the DragSourceDropEvent

dragMouseMoved

public void dragMouseMoved(DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dragMouseMoved on listener-a and listener-b.

Specified by:
dragMouseMoved in interface DragSourceMotionListener
Parameters:
dsde - the DragSourceDragEvent

add

public static DragSourceListener add(DragSourceListener a,
                                     DragSourceListener b)
Adds drag-source-listener-a with drag-source-listener-b and returns the resulting multicast listener.

Parameters:
a - drag-source-listener-a
b - drag-source-listener-b

add

public static DragSourceMotionListener add(DragSourceMotionListener a,
                                           DragSourceMotionListener b)
Adds drag-source-motion-listener-a with drag-source-motion-listener-b and returns the resulting multicast listener.

Parameters:
a - drag-source-motion-listener-a
b - drag-source-motion-listener-b

remove

public static DragSourceListener remove(DragSourceListener l,
                                        DragSourceListener oldl)
Removes the old drag-source-listener from drag-source-listener-l and returns the resulting multicast listener.

Parameters:
l - drag-source-listener-l
oldl - the drag-source-listener being removed

remove

public static DragSourceMotionListener remove(DragSourceMotionListener l,
                                              DragSourceMotionListener ol)
Removes the old drag-source-motion-listener from drag-source-motion-listener-l and returns the resulting multicast listener.

Parameters:
l - drag-source-motion-listener-l
ol - the drag-source-motion-listener being removed

addInternal

protected static EventListener addInternal(EventListener a,
                                           EventListener b)
Returns the resulting multicast listener from adding listener-a and listener-b together. If listener-a is null, it returns listener-b; If listener-b is null, it returns listener-a If neither are null, then it creates and returns a new AWTEventMulticaster instance which chains a with b.

Parameters:
a - event listener-a
b - event listener-b

remove

protected EventListener remove(EventListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener.

Overrides:
remove in class AWTEventMulticaster
Parameters:
oldl - the listener to be removed

removeInternal

protected static EventListener removeInternal(EventListener l,
                                              EventListener oldl)
Returns the resulting multicast listener after removing the old listener from listener-l. If listener-l equals the old listener OR listener-l is null, returns null. Else if listener-l is an instance of AWTEventMulticaster, then it removes the old listener from it. Else, returns listener l.

Parameters:
l - the listener being removed from
oldl - the listener being removed

save

protected static void save(ObjectOutputStream s,
                           String k,
                           EventListener l)
                    throws IOException
IOException


comments?