1. /*
  2. * @(#)DropTargetListener.java 1.13 01/11/29
  3. *
  4. * Copyright 2002 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. import java.awt.dnd.DropTargetContext;
  10. import java.awt.dnd.DropTargetDragEvent;
  11. import java.awt.dnd.DropTargetDropEvent;
  12. /**
  13. * The <code>DropTargetListener</code> interface
  14. * is the callback interface used by the
  15. * <code>DropTarget</code> class to provide
  16. * notification of DnD operations that involve
  17. * the subject <code>DropTarget</code>. Methods of
  18. * this interface may be implemented to provide
  19. * "drag under" visual feedback to the user throughout
  20. * the Drag and Drop operation.
  21. *
  22. * @version 1.13
  23. * @since JDK1.2
  24. */
  25. public interface DropTargetListener extends EventListener {
  26. /**
  27. * Called when a drag operation has
  28. * encountered the <code>DropTarget</code>.
  29. * <P>
  30. * @param dtde the <code>DropTargetDragEvent</code>
  31. */
  32. void dragEnter(DropTargetDragEvent dtde);
  33. /**
  34. * Called when a drag operation is ongoing
  35. * on the <code>DropTarget</code>.
  36. * <P>
  37. * @param dtde the <code>DropTargetDragEvent</code>
  38. */
  39. void dragOver(DropTargetDragEvent dtde);
  40. /**
  41. * Called if the user has modified
  42. * the current drop gesture.
  43. * <P>
  44. * @param dtde the <code>DropTargetDragEvent</code>
  45. */
  46. void dropActionChanged(DropTargetDragEvent dtde);
  47. /**
  48. * The drag operation has departed
  49. * the <code>DropTarget</code> without dropping.
  50. * <P>
  51. * @param dte the <code>DropTargetEvent</code>
  52. */
  53. void dragExit(DropTargetEvent dte);
  54. /**
  55. * The drag operation has terminated
  56. * with a drop on this <code>DropTarget</code>.
  57. * This method is responsible for undertaking
  58. * the transfer of the data associated with the
  59. * gesture. The <code>DropTargetDropEvent</code>
  60. * provides a means to obtain a <code>Transferable</code>
  61. * object that represents the data object(s) to
  62. * be transfered.<P>
  63. * From this method, the <code>DropTargetListener</code>
  64. * shall accept or reject the drop via the
  65. * acceptDrop(int dropAction) or rejectDrop() methods of the
  66. * <code>DropTargetDropEvent</code> parameter.
  67. * <P>
  68. * Subsequent to acceptDrop(), but not before,
  69. * <code>DropTargetDropEvent</code>'s getTransferable()
  70. * method may be invoked, and data transfer may be
  71. * performed via the returned <code>Transferable</code>'s
  72. * getTransferData() method.
  73. * <P>
  74. * At the completion of a drop, an implementation
  75. * of this method is required to signal the success/failure
  76. * of the drop by passing an appropriate
  77. * <code>boolean</code> to the <code>DropTargetDropEvent</code>'s
  78. * dropComplete(boolean success) method.
  79. * <P>
  80. * Note: The actual processing of the data transfer is not
  81. * required to finish before this method returns. It may be
  82. * deferred until later.
  83. * <P>
  84. * @param dtde the <code>DropTargetDropEvent</code>
  85. */
  86. void drop(DropTargetDropEvent dtde);
  87. }