KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > dnd > DragSourceAdapter


1 /*
2  * @(#)DragSourceAdapter.java 1.6 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.dnd;
9
10 /**
11  * An abstract adapter class for receiving drag source events. The methods in
12  * this class are empty. This class exists only as a convenience for creating
13  * listener objects.
14  * <p>
15  * Extend this class to create a <code>DragSourceEvent</code> listener
16  * and override the methods for the events of interest. (If you implement the
17  * <code>DragSourceListener</code> interface, you have to define all of
18  * the methods in it. This abstract class defines null methods for them
19  * all, so you only have to define methods for events you care about.)
20  * <p>
21  * Create a listener object using the extended class and then register it with
22  * a <code>DragSource</code>. When the drag enters, moves over, or exits
23  * a drop site, when the drop action changes, and when the drag ends, the
24  * relevant method in the listener object is invoked, and the
25  * <code>DragSourceEvent</code> is passed to it.
26  * <p>
27  * The drop site is <i>associated with the previous <code>dragEnter()</code>
28  * invocation</i> if the latest invocation of <code>dragEnter()</code> on this
29  * adapter corresponds to that drop site and is not followed by a
30  * <code>dragExit()</code> invocation on this adapter.
31  *
32  * @see DragSourceEvent
33  * @see DragSourceListener
34  * @see DragSourceMotionListener
35  *
36  * @author David Mendenhall
37  * @version 1.6, 12/19/03
38  * @since 1.4
39  */

40 public abstract class DragSourceAdapter
41     implements DragSourceListener JavaDoc, DragSourceMotionListener JavaDoc {
42
43     /**
44      * Called as the cursor's hotspot enters a platform-dependent drop site.
45      * This method is invoked when all the following conditions are true:
46      * <UL>
47      * <LI>The cursor's hotspot enters the operable part of
48      * a platform-dependent drop site.
49      * <LI>The drop site is active.
50      * <LI>The drop site accepts the drag.
51      * </UL>
52      *
53      * @param dsde the <code>DragSourceDragEvent</code>
54      */

55     public void dragEnter(DragSourceDragEvent JavaDoc dsde) {}
56
57     /**
58      * Called as the cursor's hotspot moves over a platform-dependent drop site.
59      * This method is invoked when all the following conditions are true:
60      * <UL>
61      * <LI>The cursor's hotspot has moved, but still intersects the
62      * operable part of the drop site associated with the previous
63      * dragEnter() invocation.
64      * <LI>The drop site is still active.
65      * <LI>The drop site accepts the drag.
66      * </UL>
67      *
68      * @param dsde the <code>DragSourceDragEvent</code>
69      */

70     public void dragOver(DragSourceDragEvent JavaDoc dsde) {}
71
72     /**
73      * Called whenever the mouse is moved during a drag operation.
74      *
75      * @param dsde the <code>DragSourceDragEvent</code>
76      */

77     public void dragMouseMoved(DragSourceDragEvent JavaDoc dsde) {}
78
79     /**
80      * Called when the user has modified the drop gesture.
81      * This method is invoked when the state of the input
82      * device(s) that the user is interacting with changes.
83      * Such devices are typically the mouse buttons or keyboard
84      * modifiers that the user is interacting with.
85      *
86      * @param dsde the <code>DragSourceDragEvent</code>
87      */

88     public void dropActionChanged(DragSourceDragEvent JavaDoc dsde) {}
89
90     /**
91      * Called as the cursor's hotspot exits a platform-dependent drop site.
92      * This method is invoked when any of the following conditions are true:
93      * <UL>
94      * <LI>The cursor's hotspot no longer intersects the operable part
95      * of the drop site associated with the previous dragEnter() invocation.
96      * </UL>
97      * OR
98      * <UL>
99      * <LI>The drop site associated with the previous dragEnter() invocation
100      * is no longer active.
101      * </UL>
102      * OR
103      * <UL>
104      * <LI> The drop site associated with the previous dragEnter() invocation
105      * has rejected the drag.
106      * </UL>
107      *
108      * @param dse the <code>DragSourceEvent</code>
109      */

110     public void dragExit(DragSourceEvent JavaDoc dse) {}
111
112     /**
113      * This method is invoked to signify that the Drag and Drop
114      * operation is complete. The getDropSuccess() method of
115      * the <code>DragSourceDropEvent</code> can be used to
116      * determine the termination state. The getDropAction() method
117      * returns the operation that the drop site selected
118      * to apply to the Drop operation. Once this method is complete, the
119      * current <code>DragSourceContext</code> and
120      * associated resources become invalid.
121      *
122      * @param dsde the <code>DragSourceDropEvent</code>
123      */

124     public void dragDropEnd(DragSourceDropEvent JavaDoc dsde) {}
125 }
126
Popular Tags