14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package java.awt.dnd; 26 27 import java.awt.AWTEventMulticaster; 28 import java.io.ObjectOutputStream; 29 import java.io.IOException; 30 import java.util.EventListener; 31 32 33 /** 34 * A class extends <code>AWTEventMulticaster</code> to implement efficient and 35 * thread-safe multi-cast event dispatching for the drag-and-drop events defined 36 * in the java.awt.dnd package. 37 * 38 * @since 1.4 39 * @see AWTEventMulticaster 40 */ 41 42 class DnDEventMulticaster extends AWTEventMulticaster 43 implements DragSourceListener, DragSourceMotionListener { 44 45 /** 46 * Creates an event multicaster instance which chains listener-a 47 * with listener-b. Input parameters <code>a</code> and <code>b</code> 48 * should not be <code>null</code>, though implementations may vary in 49 * choosing whether or not to throw <code>NullPointerException</code> 50 * in that case. 51 * 52 * @param a listener-a 53 * @param b listener-b 54 */ 55 protected DnDEventMulticaster(EventListener a, EventListener b) { 56 super(a,b); 57 } 58 59 /** 60 * Handles the <code>DragSourceDragEvent</code> by invoking 61 * <code>dragEnter</code> on listener-a and listener-b. 62 * 63 * @param dsde the <code>DragSourceDragEvent</code> 64 */ 65 public void dragEnter(DragSourceDragEvent dsde) { 66 ((DragSourceListener)a).dragEnter(dsde); 67 ((DragSourceListener)b).dragEnter(dsde); 68 } 69 70 /** 71 * Handles the <code>DragSourceDragEvent</code> by invoking 72 * <code>dragOver</code> on listener-a and listener-b. 73 * 74 * @param dsde the <code>DragSourceDragEvent</code> 75 */ 76 public void dragOver(DragSourceDragEvent dsde) { 77 ((DragSourceListener)a).dragOver(dsde); 78 ((DragSourceListener)b).dragOver(dsde); 79 } 80 81 /** 82 * Handles the <code>DragSourceDragEvent</code> by invoking 83 * <code>dropActionChanged</code> on listener-a and listener-b. 84 * 85 * @param dsde the <code>DragSourceDragEvent</code> 86 */ 87 public void dropActionChanged(DragSourceDragEvent dsde) { 88 ((DragSourceListener)a).dropActionChanged(dsde); 89 ((DragSourceListener)b).dropActionChanged(dsde); 90 } 91 92 /** 93 * Handles the <code>DragSourceEvent</code> by invoking 94 * <code>dragExit</code> on listener-a and listener-b. 95 * 96 * @param dse the <code>DragSourceEvent</code> 97 */ 98 public void dragExit(DragSourceEvent dse) { 99 ((DragSourceListener)a).dragExit(dse); 100 ((DragSourceListener)b).dragExit(dse); 101 } 102 103 /** 104 * Handles the <code>DragSourceDropEvent</code> by invoking 105 * <code>dragDropEnd</code> on listener-a and listener-b. 106 * 107 * @param dsde the <code>DragSourceDropEvent</code> 108 */ 109 public void dragDropEnd(DragSourceDropEvent dsde) { 110 ((DragSourceListener)a).dragDropEnd(dsde); 111 ((DragSourceListener)b).dragDropEnd(dsde); 112 } 113 114 /** 115 * Handles the <code>DragSourceDragEvent</code> by invoking 116 * <code>dragMouseMoved</code> on listener-a and listener-b. 117 * 118 * @param dsde the <code>DragSourceDragEvent</code> 119 */ 120 public void dragMouseMoved(DragSourceDragEvent dsde) { 121 ((DragSourceMotionListener)a).dragMouseMoved(dsde); 122 ((DragSourceMotionListener)b).dragMouseMoved(dsde); 123 } 124 125 /** 126 * Adds drag-source-listener-a with drag-source-listener-b and 127 * returns the resulting multicast listener. 128 * 129 * @param a drag-source-listener-a 130 * @param b drag-source-listener-b 131 */ 132 public static DragSourceListener add(DragSourceListener a, 133 DragSourceListener b) { 134 return (DragSourceListener)addInternal(a, b); 135 } 136 137 /** 138 * Adds drag-source-motion-listener-a with drag-source-motion-listener-b and | 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package java.awt.dnd; 26 27 import java.awt.AWTEventMulticaster; 28 import java.io.ObjectOutputStream; 29 import java.io.IOException; 30 import java.util.EventListener; 31 32 33 /** 34 * A class extends {@code AWTEventMulticaster} to implement efficient and 35 * thread-safe multi-cast event dispatching for the drag-and-drop events defined 36 * in the java.awt.dnd package. 37 * 38 * @since 1.4 39 * @see AWTEventMulticaster 40 */ 41 42 class DnDEventMulticaster extends AWTEventMulticaster 43 implements DragSourceListener, DragSourceMotionListener { 44 45 /** 46 * Creates an event multicaster instance which chains listener-a 47 * with listener-b. Input parameters {@code a} and {@code b} 48 * should not be {@code null}, though implementations may vary in 49 * choosing whether or not to throw {@code NullPointerException} 50 * in that case. 51 * 52 * @param a listener-a 53 * @param b listener-b 54 */ 55 protected DnDEventMulticaster(EventListener a, EventListener b) { 56 super(a,b); 57 } 58 59 /** 60 * Handles the {@code DragSourceDragEvent} by invoking 61 * {@code dragEnter} on listener-a and listener-b. 62 * 63 * @param dsde the {@code DragSourceDragEvent} 64 */ 65 public void dragEnter(DragSourceDragEvent dsde) { 66 ((DragSourceListener)a).dragEnter(dsde); 67 ((DragSourceListener)b).dragEnter(dsde); 68 } 69 70 /** 71 * Handles the {@code DragSourceDragEvent} by invoking 72 * {@code dragOver} on listener-a and listener-b. 73 * 74 * @param dsde the {@code DragSourceDragEvent} 75 */ 76 public void dragOver(DragSourceDragEvent dsde) { 77 ((DragSourceListener)a).dragOver(dsde); 78 ((DragSourceListener)b).dragOver(dsde); 79 } 80 81 /** 82 * Handles the {@code DragSourceDragEvent} by invoking 83 * {@code dropActionChanged} on listener-a and listener-b. 84 * 85 * @param dsde the {@code DragSourceDragEvent} 86 */ 87 public void dropActionChanged(DragSourceDragEvent dsde) { 88 ((DragSourceListener)a).dropActionChanged(dsde); 89 ((DragSourceListener)b).dropActionChanged(dsde); 90 } 91 92 /** 93 * Handles the {@code DragSourceEvent} by invoking 94 * {@code dragExit} on listener-a and listener-b. 95 * 96 * @param dse the {@code DragSourceEvent} 97 */ 98 public void dragExit(DragSourceEvent dse) { 99 ((DragSourceListener)a).dragExit(dse); 100 ((DragSourceListener)b).dragExit(dse); 101 } 102 103 /** 104 * Handles the {@code DragSourceDropEvent} by invoking 105 * {@code dragDropEnd} on listener-a and listener-b. 106 * 107 * @param dsde the {@code DragSourceDropEvent} 108 */ 109 public void dragDropEnd(DragSourceDropEvent dsde) { 110 ((DragSourceListener)a).dragDropEnd(dsde); 111 ((DragSourceListener)b).dragDropEnd(dsde); 112 } 113 114 /** 115 * Handles the {@code DragSourceDragEvent} by invoking 116 * {@code dragMouseMoved} on listener-a and listener-b. 117 * 118 * @param dsde the {@code DragSourceDragEvent} 119 */ 120 public void dragMouseMoved(DragSourceDragEvent dsde) { 121 ((DragSourceMotionListener)a).dragMouseMoved(dsde); 122 ((DragSourceMotionListener)b).dragMouseMoved(dsde); 123 } 124 125 /** 126 * Adds drag-source-listener-a with drag-source-listener-b and 127 * returns the resulting multicast listener. 128 * 129 * @param a drag-source-listener-a 130 * @param b drag-source-listener-b 131 */ 132 public static DragSourceListener add(DragSourceListener a, 133 DragSourceListener b) { 134 return (DragSourceListener)addInternal(a, b); 135 } 136 137 /** 138 * Adds drag-source-motion-listener-a with drag-source-motion-listener-b and |