1. /*
  2. * @(#)DragSourceListener.java 1.18 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. import java.util.EventListener;
  9. /**
  10. * The <code>DragSourceListener</code> defines the
  11. * event interface for originators of
  12. * Drag and Drop operations to track the state of the user's gesture, and to
  13. * provide appropriate "drag over"
  14. * feedback to the user throughout the
  15. * Drag and Drop operation.
  16. *
  17. * @version 1.18, 01/23/03
  18. * @since 1.2
  19. */
  20. public interface DragSourceListener extends EventListener {
  21. /**
  22. * Called as the cursor's hotspot enters a platform-dependent drop site.
  23. * This method is invoked when all the following conditions are true:
  24. * <UL>
  25. * <LI>The cursor's hotspot enters the operable part of a platform-
  26. * dependent drop site.
  27. * <LI>The drop site is active.
  28. * <LI>The drop site accepts the drag.
  29. * </UL>
  30. *
  31. * @param dsde the <code>DragSourceDragEvent</code>
  32. */
  33. void dragEnter(DragSourceDragEvent dsde);
  34. /**
  35. * Called as the cursor's hotspot moves over a platform-dependent drop site.
  36. * This method is invoked when all the following conditions are true:
  37. * <UL>
  38. * <LI>The cursor's hotspot has moved, but still intersects the
  39. * operable part of the drop site associated with the previous
  40. * dragEnter() invocation.
  41. * <LI>The drop site is still active.
  42. * <LI>The drop site accepts the drag.
  43. * </UL>
  44. *
  45. * @param dsde the <code>DragSourceDragEvent</code>
  46. */
  47. void dragOver(DragSourceDragEvent dsde);
  48. /**
  49. * Called when the user has modified the drop gesture.
  50. * This method is invoked when the state of the input
  51. * device(s) that the user is interacting with changes.
  52. * Such devices are typically the mouse buttons or keyboard
  53. * modifiers that the user is interacting with.
  54. *
  55. * @param dsde the <code>DragSourceDragEvent</code>
  56. */
  57. void dropActionChanged(DragSourceDragEvent dsde);
  58. /**
  59. * Called as the cursor's hotspot exits a platform-dependent drop site.
  60. * This method is invoked when any of the following conditions are true:
  61. * <UL>
  62. * <LI>The cursor's hotspot no longer intersects the operable part
  63. * of the drop site associated with the previous dragEnter() invocation.
  64. * </UL>
  65. * OR
  66. * <UL>
  67. * <LI>The drop site associated with the previous dragEnter() invocation
  68. * is no longer active.
  69. * </UL>
  70. * OR
  71. * <UL>
  72. * <LI> The current drop site has rejected the drag.
  73. * </UL>
  74. *
  75. * @param dse the <code>DragSourceEvent</code>
  76. */
  77. void dragExit(DragSourceEvent dse);
  78. /**
  79. * This method is invoked to signify that the Drag and Drop
  80. * operation is complete. The getDropSuccess() method of
  81. * the <code>DragSourceDropEvent</code> can be used to
  82. * determine the termination state. The getDropAction() method
  83. * returns the operation that the drop site selected
  84. * to apply to the Drop operation. Once this method is complete, the
  85. * current <code>DragSourceContext</code> and
  86. * associated resources become invalid.
  87. *
  88. * @param dsde the <code>DragSourceDropEvent</code>
  89. */
  90. void dragDropEnd(DragSourceDropEvent dsde);
  91. }