1 /*
   2  * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.dnd;
  27 
  28 /**
  29  * An abstract adapter class for receiving drop target events. The methods in
  30  * this class are empty. This class exists only as a convenience for creating
  31  * listener objects.
  32  * <p>
  33  * Extend this class to create a {@code DropTargetEvent} listener
  34  * and override the methods for the events of interest. (If you implement the
  35  * {@code DropTargetListener} interface, you have to define all of
  36  * the methods in it. This abstract class defines a null implementation for
  37  * every method except {@code drop(DropTargetDropEvent)}, so you only have
  38  * to define methods for events you care about.) You must provide an
  39  * implementation for at least {@code drop(DropTargetDropEvent)}. This
  40  * method cannot have a null implementation because its specification requires
  41  * that you either accept or reject the drop, and, if accepted, indicate
  42  * whether the drop was successful.
  43  * <p>
  44  * Create a listener object using the extended class and then register it with
  45  * a {@code DropTarget}. When the drag enters, moves over, or exits
  46  * the operable part of the drop site for that {@code DropTarget}, when
  47  * the drop action changes, and when the drop occurs, the relevant method in
  48  * the listener object is invoked, and the {@code DropTargetEvent} is
  49  * passed to it.
  50  * <p>
  51  * The operable part of the drop site for the {@code DropTarget} is
  52  * the part of the associated {@code Component}'s geometry that is not
  53  * obscured by an overlapping top-level window or by another
  54  * {@code Component} higher in the Z-order that has an associated active
  55  * {@code DropTarget}.
  56  * <p>
  57  * During the drag, the data associated with the current drag operation can be
  58  * retrieved by calling {@code getTransferable()} on
  59  * {@code DropTargetDragEvent} instances passed to the listener's
  60  * methods.
  61  * <p>
  62  * Note that {@code getTransferable()} on the
  63  * {@code DropTargetDragEvent} instance should only be called within the
  64  * respective listener's method and all the necessary data should be retrieved
  65  * from the returned {@code Transferable} before that method returns.
  66  *
  67  * @see DropTargetEvent
  68  * @see DropTargetListener
  69  *
  70  * @author David Mendenhall
  71  * @since 1.4
  72  */
  73 public abstract class DropTargetAdapter implements DropTargetListener {
  74 
  75     /**
  76      * Constructs a {@code DropTargetAdapter}.
  77      */
  78     protected DropTargetAdapter() {}
  79 
  80     /**
  81      * Called while a drag operation is ongoing, when the mouse pointer enters
  82      * the operable part of the drop site for the {@code DropTarget}
  83      * registered with this listener.
  84      *
  85      * @param dtde the {@code DropTargetDragEvent}
  86      */
  87     public void dragEnter(DropTargetDragEvent dtde) {}
  88 
  89     /**
  90      * Called when a drag operation is ongoing, while the mouse pointer is still
  91      * over the operable part of the drop site for the {@code DropTarget}
  92      * registered with this listener.
  93      *
  94      * @param dtde the {@code DropTargetDragEvent}
  95      */
  96     public void dragOver(DropTargetDragEvent dtde) {}
  97 
  98     /**
  99      * Called if the user has modified
 100      * the current drop gesture.
 101      *
 102      * @param dtde the {@code DropTargetDragEvent}
 103      */
 104     public void dropActionChanged(DropTargetDragEvent dtde) {}
 105 
 106     /**
 107      * Called while a drag operation is ongoing, when the mouse pointer has
 108      * exited the operable part of the drop site for the
 109      * {@code DropTarget} registered with this listener.
 110      *
 111      * @param dte the {@code DropTargetEvent}
 112      */
 113     public void dragExit(DropTargetEvent dte) {}
 114 }
--- EOF ---