to implement efficient and
thread-safe multi-cast event dispatching for the drag-and-drop events defined
in the java.awt.dnd package.
| Method from java.awt.dnd.DnDEventMulticaster Detail: |
public static DragSourceListener add(DragSourceListener a,
DragSourceListener b) {
return (DragSourceListener)addInternal(a, b);
}
Adds drag-source-listener-a with drag-source-listener-b and
returns the resulting multicast listener. |
public static DragSourceMotionListener add(DragSourceMotionListener a,
DragSourceMotionListener b) {
return (DragSourceMotionListener)addInternal(a, 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) {
if (a == null) return b;
if (b == null) return a;
return new DnDEventMulticaster(a, 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. |
public void dragDropEnd(DragSourceDropEvent dsde) {
((DragSourceListener)a).dragDropEnd(dsde);
((DragSourceListener)b).dragDropEnd(dsde);
}
Handles the DragSourceDropEvent by invoking
dragDropEnd on listener-a and listener-b. |
public void dragEnter(DragSourceDragEvent dsde) {
((DragSourceListener)a).dragEnter(dsde);
((DragSourceListener)b).dragEnter(dsde);
}
Handles the DragSourceDragEvent by invoking
dragEnter on listener-a and listener-b. |
public void dragExit(DragSourceEvent dse) {
((DragSourceListener)a).dragExit(dse);
((DragSourceListener)b).dragExit(dse);
}
Handles the DragSourceEvent by invoking
dragExit on listener-a and listener-b. |
public void dragMouseMoved(DragSourceDragEvent dsde) {
((DragSourceMotionListener)a).dragMouseMoved(dsde);
((DragSourceMotionListener)b).dragMouseMoved(dsde);
}
Handles the DragSourceDragEvent by invoking
dragMouseMoved on listener-a and listener-b. |
public void dragOver(DragSourceDragEvent dsde) {
((DragSourceListener)a).dragOver(dsde);
((DragSourceListener)b).dragOver(dsde);
}
Handles the DragSourceDragEvent by invoking
dragOver on listener-a and listener-b. |
public void dropActionChanged(DragSourceDragEvent dsde) {
((DragSourceListener)a).dropActionChanged(dsde);
((DragSourceListener)b).dropActionChanged(dsde);
}
Handles the DragSourceDragEvent by invoking
dropActionChanged on listener-a and listener-b. |
protected EventListener remove(EventListener oldl) {
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);
}
Removes a listener from this multicaster and returns the
resulting multicast listener. |
public static DragSourceListener remove(DragSourceListener l,
DragSourceListener oldl) {
return (DragSourceListener)removeInternal(l, oldl);
}
Removes the old drag-source-listener from drag-source-listener-l
and returns the resulting multicast listener. |
public static DragSourceMotionListener remove(DragSourceMotionListener l,
DragSourceMotionListener ol) {
return (DragSourceMotionListener)removeInternal(l, ol);
}
Removes the old drag-source-motion-listener from
drag-source-motion-listener-l and returns the resulting multicast
listener. |
protected static EventListener removeInternal(EventListener l,
EventListener oldl) {
if (l == oldl || l == null) {
return null;
} else if (l instanceof DnDEventMulticaster) {
return ((DnDEventMulticaster)l).remove(oldl);
} else {
return l; // it's not here
}
}
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. |
protected static void save(ObjectOutputStream s,
String k,
EventListener l) throws IOException {
AWTEventMulticaster.save(s, k, l);
}
|