1. /*
  2. * @(#)DragSourceListener.java 1.15 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.awt.dnd;
  11. import java.util.EventListener;
  12. import java.awt.dnd.DragSourceDragEvent;
  13. import java.awt.dnd.DragSourceDropEvent;
  14. /**
  15. * The <code>DragSourceListener</code> defines the
  16. * event interface for originators of
  17. * Drag and Drop operations to track the state of the user's gesture, and to
  18. * provide appropriate "drag over"
  19. * feedback to the user throughout the
  20. * Drag and Drop operation.
  21. *
  22. * @version 1.15, 02/02/00
  23. * @since 1.2
  24. */
  25. public interface DragSourceListener extends EventListener {
  26. /**
  27. * Called as the hotspot enters a platform dependent drop site.
  28. * This method is invoked when the following conditions are true:
  29. * <UL>
  30. * <LI>The logical cursor's hotspot initially intersects
  31. * a GUI <code>Component</code>'s visible geometry.
  32. * <LI>That <code>Component</code> has an active
  33. * <code>DropTarget</code> associated with it.
  34. * <LI>The <code>DropTarget</code>'s registered
  35. * <code>DropTargetListener</code> dragEnter() method is invoked and
  36. * returns successfully.
  37. * <LI>The registered <code>DropTargetListener</code> invokes
  38. * the <code>DropTargetDragEvent</code>'s acceptDrag() method to
  39. * accept the drag based upon interrogation of the source's
  40. * potential drop action(s) and available data types
  41. * (<code>DataFlavor</code>s).
  42. * </UL>
  43. *<P>
  44. *@param dsde the <code>DragSourceDragEvent</code>
  45. */
  46. void dragEnter(DragSourceDragEvent dsde);
  47. /**
  48. * Called as the hotspot moves over a platform dependent drop site.
  49. * This method is invoked when the following conditions
  50. * are true:
  51. *<UL>
  52. *<LI>The cursor's logical hotspot has moved but still
  53. * intersects the visible geometry of the <code>Component</code>
  54. * associated with the previous dragEnter() invocation.
  55. * <LI>That <code>Component</code> still has a
  56. * <code>DropTarget</code> associated with it.
  57. * <LI>That <code>DropTarget</code> is still active.
  58. * <LI>The <code>DropTarget</code>'s registered
  59. * <code>DropTargetListener</code> dragOver() method
  60. * is invoked and returns successfully.
  61. * <LI>The <code>DropTarget</code> does not reject
  62. * the drag via rejectDrag()
  63. * </UL>
  64. * <P>
  65. * @param dsde the <code>DragSourceDragEvent</code>
  66. */
  67. void dragOver(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. * <P>
  75. * @param dsde the <code>DragSourceDragEvent</code>
  76. */
  77. void dropActionChanged(DragSourceDragEvent dsde);
  78. /**
  79. * Called as the hotspot exits a platform dependent drop site.
  80. * This method is invoked when the following conditions
  81. * are true:
  82. * <UL>
  83. * <LI>The cursor's logical hotspot no longer
  84. * intersects the visible geometry of the <code>Component</code>
  85. * associated with the previous dragEnter() invocation.
  86. * </UL>
  87. * OR
  88. * <UL>
  89. * <LI>The <code>Component</code> that the logical cursor's hotspot
  90. * intersected that resulted in the previous dragEnter() invocation
  91. * no longer has an active <code>DropTarget</code> or
  92. * <code>DropTargetListener</code> associated with it.
  93. * </UL>
  94. * OR
  95. * <UL>
  96. * <LI> The current <code>DropTarget</code>'s
  97. * <code>DropTargetListener</code> has invoked rejectDrag()
  98. * since the last dragEnter() or dragOver() invocation.
  99. * </UL>
  100. * <P>
  101. * @param dse the <code>DragSourceEvent</code>
  102. */
  103. void dragExit(DragSourceEvent dse);
  104. /**
  105. * This method is invoked to signify that the Drag and Drop
  106. * operation is complete. The getDropSuccess() method of
  107. * the <code>DragSourceDropEvent</code> can be used to
  108. * determine the termination state. The getDropAction() method
  109. * returns the operation that the <code>DropTarget</code>
  110. * selected (via the DropTargetDropEvent acceptDrop() parameter)
  111. * to apply to the Drop operation. Once this method is complete, the
  112. * current <code>DragSourceContext</code> and
  113. * associated resources become invalid.
  114. * <P>
  115. * @param dsde the <code>DragSourceDropEvent</code>
  116. */
  117. void dragDropEnd(DragSourceDropEvent dsde);
  118. }