FileDocCategorySizeDatePackage
DnDEventMulticaster.javaAPI DocJava SE 5 API7404Fri Aug 26 14:56:48 BST 2005java.awt.dnd

DnDEventMulticaster

public class DnDEventMulticaster extends AWTEventMulticaster implements DragSourceMotionListener, DragSourceListener
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.
version
1.5, 12/19/03
since
1.4
see
AWTEventMulticaster

Fields Summary
Constructors Summary
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.

param
a listener-a
param
b listener-b

        super(a,b);
    
Methods Summary
public static java.awt.dnd.DragSourceListeneradd(java.awt.dnd.DragSourceListener a, java.awt.dnd.DragSourceListener b)
Adds drag-source-listener-a with drag-source-listener-b and returns the resulting multicast listener.

param
a drag-source-listener-a
param
b drag-source-listener-b

 
        return (DragSourceListener)addInternal(a, b);
    
public static java.awt.dnd.DragSourceMotionListeneradd(java.awt.dnd.DragSourceMotionListener a, java.awt.dnd.DragSourceMotionListener b)
Adds drag-source-motion-listener-a with drag-source-motion-listener-b and returns the resulting multicast listener.

param
a drag-source-motion-listener-a
param
b drag-source-motion-listener-b

 
        return (DragSourceMotionListener)addInternal(a, b);
    
protected static java.util.EventListeneraddInternal(java.util.EventListener a, java.util.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.

param
a event listener-a
param
b event listener-b

	if (a == null)  return b;
	if (b == null)  return a;
	return new DnDEventMulticaster(a, b);
    
public voiddragDropEnd(java.awt.dnd.DragSourceDropEvent dsde)
Handles the DragSourceDropEvent by invoking dragDropEnd on listener-a and listener-b.

param
dsde the DragSourceDropEvent

        ((DragSourceListener)a).dragDropEnd(dsde);
        ((DragSourceListener)b).dragDropEnd(dsde);
    
public voiddragEnter(java.awt.dnd.DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dragEnter on listener-a and listener-b.

param
dsde the DragSourceDragEvent

        ((DragSourceListener)a).dragEnter(dsde);
        ((DragSourceListener)b).dragEnter(dsde);
    
public voiddragExit(java.awt.dnd.DragSourceEvent dse)
Handles the DragSourceEvent by invoking dragExit on listener-a and listener-b.

param
dse the DragSourceEvent

        ((DragSourceListener)a).dragExit(dse);
        ((DragSourceListener)b).dragExit(dse);
    
public voiddragMouseMoved(java.awt.dnd.DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dragMouseMoved on listener-a and listener-b.

param
dsde the DragSourceDragEvent

        ((DragSourceMotionListener)a).dragMouseMoved(dsde);
        ((DragSourceMotionListener)b).dragMouseMoved(dsde);
    
public voiddragOver(java.awt.dnd.DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dragOver on listener-a and listener-b.

param
e the DragSourceDragEvent

        ((DragSourceListener)a).dragOver(dsde);
        ((DragSourceListener)b).dragOver(dsde);
    
public voiddropActionChanged(java.awt.dnd.DragSourceDragEvent dsde)
Handles the DragSourceDragEvent by invoking dropActionChanged on listener-a and listener-b.

param
dsde the DragSourceDragEvent

        ((DragSourceListener)a).dropActionChanged(dsde);
        ((DragSourceListener)b).dropActionChanged(dsde);
    
public static java.awt.dnd.DragSourceListenerremove(java.awt.dnd.DragSourceListener l, java.awt.dnd.DragSourceListener oldl)
Removes the old drag-source-listener from drag-source-listener-l and returns the resulting multicast listener.

param
l drag-source-listener-l
param
oldl the drag-source-listener being removed

 
        return (DragSourceListener)removeInternal(l, oldl);
    
public static java.awt.dnd.DragSourceMotionListenerremove(java.awt.dnd.DragSourceMotionListener l, java.awt.dnd.DragSourceMotionListener ol)
Removes the old drag-source-motion-listener from drag-source-motion-listener-l and returns the resulting multicast listener.

param
l drag-source-motion-listener-l
param
ol the drag-source-motion-listener being removed

        return (DragSourceMotionListener)removeInternal(l, ol);
    
protected java.util.EventListenerremove(java.util.EventListener oldl)
Removes a listener from this multicaster and returns the resulting multicast listener.

param
oldl the listener to be removed

        if (oldl == a)  return b;
        if (oldl == b)  return a;
        EventListener a2 = removeInternal(a, oldl);
        EventListener b2 = removeInternal(b, oldl);
        if (a2 == a && b2 == b) {
            return this;        // it's not here
        }
        return addInternal(a2, b2);
    
protected static java.util.EventListenerremoveInternal(java.util.EventListener l, java.util.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.

param
l the listener being removed from
param
oldl the listener being removed

	if (l == oldl || l == null) {
	    return null;
	} else if (l instanceof DnDEventMulticaster) {
	    return ((DnDEventMulticaster)l).remove(oldl);
	} else {
	    return l;		// it's not here
	}
    
protected static voidsave(java.io.ObjectOutputStream s, java.lang.String k, java.util.EventListener l)

 
        AWTEventMulticaster.save(s, k, l);