src/java.desktop/share/classes/javax/swing/TransferHandler.java

Print this page




 193     /**
 194      * This class encapsulates all relevant details of a clipboard
 195      * or drag and drop transfer, and also allows for customizing
 196      * aspects of the drag and drop experience.
 197      * <p>
 198      * The main purpose of this class is to provide the information
 199      * needed by a developer to determine the suitability of a
 200      * transfer or to import the data contained within. But it also
 201      * doubles as a controller for customizing properties during drag
 202      * and drop, such as whether or not to show the drop location,
 203      * and which drop action to use.
 204      * <p>
 205      * Developers typically need not create instances of this
 206      * class. Instead, they are something provided by the DnD
 207      * implementation to certain methods in <code>TransferHandler</code>.
 208      *
 209      * @see #canImport(TransferHandler.TransferSupport)
 210      * @see #importData(TransferHandler.TransferSupport)
 211      * @since 1.6
 212      */
 213     public final static class TransferSupport {
 214         private boolean isDrop;
 215         private Component component;
 216 
 217         private boolean showDropLocationIsSet;
 218         private boolean showDropLocation;
 219 
 220         private int dropAction = -1;
 221 
 222         /**
 223          * The source is a {@code DropTargetDragEvent} or
 224          * {@code DropTargetDropEvent} for drops,
 225          * and a {@code Transferable} otherwise
 226          */
 227         private Object source;
 228 
 229         private DropLocation dropLocation;
 230 
 231         /**
 232          * Create a <code>TransferSupport</code> with <code>isDrop()</code>
 233          * <code>true</code> for the given component, event, and index.




 193     /**
 194      * This class encapsulates all relevant details of a clipboard
 195      * or drag and drop transfer, and also allows for customizing
 196      * aspects of the drag and drop experience.
 197      * <p>
 198      * The main purpose of this class is to provide the information
 199      * needed by a developer to determine the suitability of a
 200      * transfer or to import the data contained within. But it also
 201      * doubles as a controller for customizing properties during drag
 202      * and drop, such as whether or not to show the drop location,
 203      * and which drop action to use.
 204      * <p>
 205      * Developers typically need not create instances of this
 206      * class. Instead, they are something provided by the DnD
 207      * implementation to certain methods in <code>TransferHandler</code>.
 208      *
 209      * @see #canImport(TransferHandler.TransferSupport)
 210      * @see #importData(TransferHandler.TransferSupport)
 211      * @since 1.6
 212      */
 213     public static final class TransferSupport {
 214         private boolean isDrop;
 215         private Component component;
 216 
 217         private boolean showDropLocationIsSet;
 218         private boolean showDropLocation;
 219 
 220         private int dropAction = -1;
 221 
 222         /**
 223          * The source is a {@code DropTargetDragEvent} or
 224          * {@code DropTargetDropEvent} for drops,
 225          * and a {@code Transferable} otherwise
 226          */
 227         private Object source;
 228 
 229         private DropLocation dropLocation;
 230 
 231         /**
 232          * Create a <code>TransferSupport</code> with <code>isDrop()</code>
 233          * <code>true</code> for the given component, event, and index.