0N/A/*
2362N/A * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.awt.dnd;
0N/A
0N/Aimport java.util.EventListener;
0N/A
0N/Aimport java.awt.dnd.DropTargetDragEvent;
0N/Aimport java.awt.dnd.DropTargetDropEvent;
0N/A
0N/A/**
0N/A * The <code>DropTargetListener</code> interface
0N/A * is the callback interface used by the
0N/A * <code>DropTarget</code> class to provide
0N/A * notification of DnD operations that involve
0N/A * the subject <code>DropTarget</code>. Methods of
0N/A * this interface may be implemented to provide
0N/A * "drag under" visual feedback to the user throughout
0N/A * the Drag and Drop operation.
0N/A * <p>
0N/A * Create a listener object by implementing the interface and then register it
0N/A * with a <code>DropTarget</code>. When the drag enters, moves over, or exits
0N/A * the operable part of the drop site for that <code>DropTarget</code>, when
0N/A * the drop action changes, and when the drop occurs, the relevant method in
0N/A * the listener object is invoked, and the <code>DropTargetEvent</code> is
0N/A * passed to it.
0N/A * <p>
0N/A * The operable part of the drop site for the <code>DropTarget</code> is
0N/A * the part of the associated <code>Component</code>'s geometry that is not
0N/A * obscured by an overlapping top-level window or by another
0N/A * <code>Component</code> higher in the Z-order that has an associated active
0N/A * <code>DropTarget</code>.
0N/A * <p>
0N/A * During the drag, the data associated with the current drag operation can be
0N/A * retrieved by calling <code>getTransferable()</code> on
0N/A * <code>DropTargetDragEvent</code> instances passed to the listener's
0N/A * methods.
0N/A * <p>
0N/A * Note that <code>getTransferable()</code> on the
0N/A * <code>DropTargetDragEvent</code> instance should only be called within the
0N/A * respective listener's method and all the necessary data should be retrieved
0N/A * from the returned <code>Transferable</code> before that method returns.
0N/A *
0N/A * @since 1.2
0N/A */
0N/A
0N/Apublic interface DropTargetListener extends EventListener {
0N/A
0N/A /**
0N/A * Called while a drag operation is ongoing, when the mouse pointer enters
0N/A * the operable part of the drop site for the <code>DropTarget</code>
0N/A * registered with this listener.
0N/A *
0N/A * @param dtde the <code>DropTargetDragEvent</code>
0N/A */
0N/A
0N/A void dragEnter(DropTargetDragEvent dtde);
0N/A
0N/A /**
0N/A * Called when a drag operation is ongoing, while the mouse pointer is still
0N/A * over the operable part of the drop site for the <code>DropTarget</code>
0N/A * registered with this listener.
0N/A *
0N/A * @param dtde the <code>DropTargetDragEvent</code>
0N/A */
0N/A
0N/A void dragOver(DropTargetDragEvent dtde);
0N/A
0N/A /**
0N/A * Called if the user has modified
0N/A * the current drop gesture.
0N/A * <P>
0N/A * @param dtde the <code>DropTargetDragEvent</code>
0N/A */
0N/A
0N/A void dropActionChanged(DropTargetDragEvent dtde);
0N/A
0N/A /**
0N/A * Called while a drag operation is ongoing, when the mouse pointer has
0N/A * exited the operable part of the drop site for the
0N/A * <code>DropTarget</code> registered with this listener.
0N/A *
0N/A * @param dte the <code>DropTargetEvent</code>
0N/A */
0N/A
0N/A void dragExit(DropTargetEvent dte);
0N/A
0N/A /**
0N/A * Called when the drag operation has terminated with a drop on
0N/A * the operable part of the drop site for the <code>DropTarget</code>
0N/A * registered with this listener.
0N/A * <p>
0N/A * This method is responsible for undertaking
0N/A * the transfer of the data associated with the
0N/A * gesture. The <code>DropTargetDropEvent</code>
0N/A * provides a means to obtain a <code>Transferable</code>
0N/A * object that represents the data object(s) to
0N/A * be transfered.<P>
0N/A * From this method, the <code>DropTargetListener</code>
0N/A * shall accept or reject the drop via the
0N/A * acceptDrop(int dropAction) or rejectDrop() methods of the
0N/A * <code>DropTargetDropEvent</code> parameter.
0N/A * <P>
0N/A * Subsequent to acceptDrop(), but not before,
0N/A * <code>DropTargetDropEvent</code>'s getTransferable()
0N/A * method may be invoked, and data transfer may be
0N/A * performed via the returned <code>Transferable</code>'s
0N/A * getTransferData() method.
0N/A * <P>
0N/A * At the completion of a drop, an implementation
0N/A * of this method is required to signal the success/failure
0N/A * of the drop by passing an appropriate
0N/A * <code>boolean</code> to the <code>DropTargetDropEvent</code>'s
0N/A * dropComplete(boolean success) method.
0N/A * <P>
0N/A * Note: The data transfer should be completed before the call to the
0N/A * <code>DropTargetDropEvent</code>'s dropComplete(boolean success) method.
0N/A * After that, a call to the getTransferData() method of the
0N/A * <code>Transferable</code> returned by
0N/A * <code>DropTargetDropEvent.getTransferable()</code> is guaranteed to
0N/A * succeed only if the data transfer is local; that is, only if
0N/A * <code>DropTargetDropEvent.isLocalTransfer()</code> returns
0N/A * <code>true</code>. Otherwise, the behavior of the call is
0N/A * implementation-dependent.
0N/A * <P>
0N/A * @param dtde the <code>DropTargetDropEvent</code>
0N/A */
0N/A
0N/A void drop(DropTargetDropEvent dtde);
0N/A}