1. /*
  2. * @(#)DragSourceAdapter.java 1.4 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.dnd;
  8. /**
  9. * An abstract adapter class for receiving drag source events. The methods in
  10. * this class are empty. This class exists only as a convenience for creating
  11. * listener objects.
  12. * <p>
  13. * Extend this class to create a <code>DragSourceEvent</code> listener
  14. * and override the methods for the events of interest. (If you implement the
  15. * <code>DragSourceListener</code> interface, you have to define all of
  16. * the methods in it. This abstract class defines null methods for them
  17. * all, so you only have to define methods for events you care about.)
  18. * <p>
  19. * Create a listener object using the extended class and then register it with
  20. * a <code>DragSource</code>. When the drag enters, moves over, or exits
  21. * a drop site, when the drop action changes, and when the drag ends, the
  22. * relevant method in the listener object is invoked, and the
  23. * <code>DragSourceEvent</code> is passed to it.
  24. *
  25. * @see DragSourceEvent
  26. * @see DragSourceListener
  27. * @see DragSourceMotionListener
  28. *
  29. * @author David Mendenhall
  30. * @version 1.4, 01/23/03
  31. * @since 1.4
  32. */
  33. public abstract class DragSourceAdapter
  34. implements DragSourceListener, DragSourceMotionListener {
  35. /**
  36. * Called as the cursor's hotspot enters a platform-dependent drop site.
  37. * This method is invoked when all the following conditions are true:
  38. * <UL>
  39. * <LI>The cursor's hotspot enters the operable part of
  40. * a platform-dependent drop site.
  41. * <LI>The drop site is active.
  42. * <LI>The drop site accepts the drag.
  43. * </UL>
  44. *
  45. * @param dsde the <code>DragSourceDragEvent</code>
  46. */
  47. public void dragEnter(DragSourceDragEvent dsde) {}
  48. /**
  49. * Called as the cursor's hotspot moves over a platform-dependent drop site.
  50. * This method is invoked when all the following conditions are true:
  51. * <UL>
  52. * <LI>The cursor's hotspot has moved, but still intersects the
  53. * operable part of the drop site associated with the previous
  54. * dragEnter() invocation.
  55. * <LI>The drop site is still active.
  56. * <LI>The drop site accepts the drag.
  57. * </UL>
  58. *
  59. * @param dsde the <code>DragSourceDragEvent</code>
  60. */
  61. public void dragOver(DragSourceDragEvent dsde) {}
  62. /**
  63. * Called whenever the mouse is moved during a drag operation.
  64. *
  65. * @param dsde the <code>DragSourceDragEvent</code>
  66. */
  67. public void dragMouseMoved(DragSourceDragEvent dsde) {}
  68. /**
  69. * Called when the user has modified the drop gesture.
  70. * This method is invoked when the state of the input
  71. * device(s) that the user is interacting with changes.
  72. * Such devices are typically the mouse buttons or keyboard
  73. * modifiers that the user is interacting with.
  74. *
  75. * @param dsde the <code>DragSourceDragEvent</code>
  76. */
  77. public void dropActionChanged(DragSourceDragEvent dsde) {}
  78. /**
  79. * Called as the cursor's hotspot exits a platform-dependent drop site.
  80. * This method is invoked when any of the following conditions are true:
  81. * <UL>
  82. * <LI>The cursor's hotspot no longer intersects the operable part
  83. * of the drop site associated with the previous dragEnter() invocation.
  84. * </UL>
  85. * OR
  86. * <UL>
  87. * <LI>The drop site associated with the previous dragEnter() invocation
  88. * is no longer active.
  89. * </UL>
  90. * OR
  91. * <UL>
  92. * <LI> The current drop site has rejected the drag.
  93. * </UL>
  94. *
  95. * @param dse the <code>DragSourceEvent</code>
  96. */
  97. public void dragExit(DragSourceEvent dse) {}
  98. /**
  99. * This method is invoked to signify that the Drag and Drop
  100. * operation is complete. The getDropSuccess() method of
  101. * the <code>DragSourceDropEvent</code> can be used to
  102. * determine the termination state. The getDropAction() method
  103. * returns the operation that the drop site selected
  104. * to apply to the Drop operation. Once this method is complete, the
  105. * current <code>DragSourceContext</code> and
  106. * associated resources become invalid.
  107. *
  108. * @param dsde the <code>DragSourceDropEvent</code>
  109. */
  110. public void dragDropEnd(DragSourceDropEvent dsde) {}
  111. }