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