TransferHandler.java revision 3909
3261N/A * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 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 * 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, 2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class is used to handle the transfer of a <code>Transferable</code> 0N/A * to and from Swing components. The <code>Transferable</code> is used to 0N/A * represent data that is exchanged via a cut, copy, or paste 0N/A * to/from a clipboard. It is also used in drag-and-drop operations 0N/A * to represent a drag from a component, and a drop to a component. 0N/A * Swing provides functionality that automatically supports cut, copy, 0N/A * and paste keyboard bindings that use the functionality provided by 0N/A * an implementation of this class. Swing also provides functionality 0N/A * that automatically supports drag and drop that uses the functionality 0N/A * provided by an implementation of this class. The Swing developer can 0N/A * concentrate on specifying the semantics of a transfer primarily by setting 0N/A * the <code>transferHandler</code> property on a Swing component. 0N/A * This class is implemented to provide a default behavior of transferring 0N/A * a component property simply by specifying the name of the property in 0N/A * the constructor. For example, to transfer the foreground color from 0N/A * one component to another either via the clipboard or a drag and drop operation 0N/A * a <code>TransferHandler</code> can be constructed with the string "foreground". The 0N/A * built in support will use the color returned by <code>getForeground</code> as the source 0N/A * of the transfer, and <code>setForeground</code> for the target of a transfer. 0N/A * How to Use Drag and Drop and Data Transfer</a>, 0N/A * a section in <em>The Java Tutorial</em>, for more information. 0N/A * @author Timothy Prinzing 0N/A * @author Shannon Hickey 0N/A * An <code>int</code> representing no transfer action. 0N/A * An <code>int</code> representing a "copy" transfer action. 0N/A * This value is used when data is copied to a clipboard 0N/A * or copied elsewhere in a drag and drop operation. 0N/A * An <code>int</code> representing a "move" transfer action. 0N/A * This value is used when data is moved to a clipboard (i.e. a cut) 0N/A * or moved elsewhere in a drag and drop operation. 0N/A * An <code>int</code> representing a source action capability of either 0N/A * "copy" or "move". 0N/A * An <code>int</code> representing a "link" transfer action. 0N/A * This value is used to specify that data should be linked in a drag 0N/A * and drop operation. 0N/A * @see java.awt.dnd.DnDConstants#ACTION_LINK 0N/A * An interface to tag things with a {@code getTransferHandler} method. 0N/A /** Returns the {@code TransferHandler}. 0N/A * @return The {@code TransferHandler} or {@code null} 0N/A * Represents a location where dropped data should be inserted. 0N/A * This is a base class that only encapsulates a point. 0N/A * Components supporting drop may provide subclasses of this 0N/A * containing more information. 0N/A * Developers typically shouldn't create instances of, or extend, this 0N/A * class. Instead, these are something provided by the DnD 0N/A * implementation by <code>TransferSupport</code> instances and by 0N/A * components with a <code>getDropLocation()</code> method. 0N/A * @see javax.swing.TransferHandler.TransferSupport#getDropLocation 0N/A * Constructs a drop location for the given point. 0N/A * @param dropPoint the drop point, representing the mouse's 0N/A * current location within the component. 0N/A * @throws IllegalArgumentException if the point 0N/A * is <code>null</code> 0N/A * Returns the drop point, representing the mouse's 0N/A * current location within the component. 0N/A * @return the drop point. 0N/A * Returns a string representation of this drop location. 0N/A * This method is intended to be used for debugging purposes, 0N/A * and the content and format of the returned string may vary 0N/A * between implementations. 0N/A * @return a string representation of this drop location 0N/A * This class encapsulates all relevant details of a clipboard 0N/A * or drag and drop transfer, and also allows for customizing 0N/A * aspects of the drag and drop experience. 0N/A * The main purpose of this class is to provide the information 0N/A * needed by a developer to determine the suitability of a 0N/A * transfer or to import the data contained within. But it also 0N/A * doubles as a controller for customizing properties during drag 0N/A * and drop, such as whether or not to show the drop location, 0N/A * and which drop action to use. 0N/A * Developers typically need not create instances of this 0N/A * class. Instead, they are something provided by the DnD 0N/A * implementation to certain methods in <code>TransferHandler</code>. 0N/A * @see #canImport(TransferHandler.TransferSupport) 0N/A * @see #importData(TransferHandler.TransferSupport) 0N/A * The source is a {@code DropTargetDragEvent} or 0N/A * {@code DropTargetDropEvent} for drops, 0N/A * and a {@code Transferable} otherwise 0N/A * Create a <code>TransferSupport</code> with <code>isDrop()</code> 0N/A * <code>true</code> for the given component, event, and index. 0N/A * @param component the target component 0N/A * @param event a <code>DropTargetEvent</code> 0N/A * Create a <code>TransferSupport</code> with <code>isDrop()</code> 0N/A * <code>false</code> for the given component and 0N/A * <code>Transferable</code>. 0N/A * @param component the target component 0N/A * @param transferable the transferable 0N/A * @throws NullPointerException if either parameter 0N/A * is <code>null</code> 0N/A * Allows for a single instance to be reused during DnD. 0N/A * @param component the target component 0N/A * @param event a <code>DropTargetEvent</code> 0N/A * The drop location may be null at this point if the component 0N/A * doesn't return custom drop locations. In this case, a point-only 0N/A * drop location will be created lazily when requested. 0N/A * Returns whether or not this <code>TransferSupport</code> 0N/A * represents a drop operation. 0N/A * @return <code>true</code> if this is a drop operation, 0N/A * <code>false</code> otherwise. 0N/A * Returns the target component of this transfer. 0N/A * @return the target component 0N/A * Checks that this is a drop and throws an 0N/A * {@code IllegalStateException} if it isn't. 0N/A * @throws IllegalStateException if {@code isDrop} is false. 0N/A * Returns the current (non-{@code null}) drop location for the component, 0N/A * when this {@code TransferSupport} represents a drop. 0N/A * Note: For components with built-in drop support, this location 0N/A * will be a subclass of {@code DropLocation} of the same type 0N/A * returned by that component's {@code getDropLocation} method. 0N/A * This method is only for use with drag and drop transfers. 0N/A * Calling it when {@code isDrop()} is {@code false} results 0N/A * in an {@code IllegalStateException}. 0N/A * @return the drop location 0N/A * @throws IllegalStateException if this is not a drop 0N/A * component didn't give us a custom drop location, 0N/A * so lazily create a point-only location 0N/A * Sets whether or not the drop location should be visually indicated 0N/A * for the transfer - which must represent a drop. This is applicable to 0N/A * those components that automatically 0N/A * show the drop location when appropriate during a drag and drop 0N/A * operation). By default, the drop location is shown only when the 0N/A * {@code TransferHandler} has said it can accept the import represented 0N/A * by this {@code TransferSupport}. With this method you can force the 0N/A * drop location to always be shown, or always not be shown. 0N/A * This method is only for use with drag and drop transfers. 0N/A * Calling it when {@code isDrop()} is {@code false} results 0N/A * in an {@code IllegalStateException}. 0N/A * @param showDropLocation whether or not to indicate the drop location 0N/A * @throws IllegalStateException if this is not a drop 0N/A * Sets the drop action for the transfer - which must represent a drop 0N/A * - to the given action, 0N/A * instead of the default user drop action. The action must be 0N/A * supported by the source's drop actions, and must be one 0N/A * of {@code COPY}, {@code MOVE} or {@code LINK}. 0N/A * This method is only for use with drag and drop transfers. 0N/A * Calling it when {@code isDrop()} is {@code false} results 0N/A * in an {@code IllegalStateException}. 0N/A * @param dropAction the drop action 0N/A * @throws IllegalStateException if this is not a drop 0N/A * @throws IllegalArgumentException if an invalid action is specified 0N/A * @see #getDropAction 0N/A * @see #getUserDropAction 0N/A * @see #getSourceDropActions 0N/A * Returns the action chosen for the drop, when this 0N/A * {@code TransferSupport} represents a drop. 0N/A * Unless explicitly chosen by way of {@code setDropAction}, 0N/A * this returns the user drop action provided by 0N/A * {@code getUserDropAction}. 0N/A * You may wish to query this in {@code TransferHandler}'s 0N/A * {@code importData} method to customize processing based 0N/A * This method is only for use with drag and drop transfers. 0N/A * Calling it when {@code isDrop()} is {@code false} results 0N/A * in an {@code IllegalStateException}. 0N/A * @return the action chosen for the drop 0N/A * @throws IllegalStateException if this is not a drop 0N/A * @see #setDropAction 0N/A * @see #getUserDropAction 0N/A * Returns the user drop action for the drop, when this 0N/A * {@code TransferSupport} represents a drop. 0N/A * The user drop action is chosen for a drop as described in the 0N/A * documentation for {@link java.awt.dnd.DropTargetDragEvent} and 0N/A * {@link java.awt.dnd.DropTargetDropEvent}. A different action 0N/A * may be chosen as the drop action by way of the {@code setDropAction} 0N/A * You may wish to query this in {@code TransferHandler}'s 0N/A * {@code canImport} method when determining the suitability of a 0N/A * drop or when deciding on a drop action to explicitly choose. 0N/A * This method is only for use with drag and drop transfers. 0N/A * Calling it when {@code isDrop()} is {@code false} results 0N/A * in an {@code IllegalStateException}. 0N/A * @return the user drop action 0N/A * @throws IllegalStateException if this is not a drop 0N/A * @see #setDropAction 0N/A * @see #getDropAction 0N/A * Returns the drag source's supported drop actions, when this 0N/A * {@code TransferSupport} represents a drop. 0N/A * The source actions represent the set of actions supported by the 0N/A * source of this transfer, and are represented as some bitwise-OR 0N/A * combination of {@code COPY}, {@code MOVE} and {@code LINK}. 0N/A * You may wish to query this in {@code TransferHandler}'s 0N/A * {@code canImport} method when determining the suitability of a drop 0N/A * or when deciding on a drop action to explicitly choose. To determine 0N/A * if a particular action is supported by the source, bitwise-AND 0N/A * the action with the source drop actions, and then compare the result 0N/A * against the original action. For example: 0N/A * boolean copySupported = (COPY & getSourceDropActions()) == COPY; 0N/A * This method is only for use with drag and drop transfers. 0N/A * Calling it when {@code isDrop()} is {@code false} results 0N/A * in an {@code IllegalStateException}. 0N/A * @return the drag source's supported drop actions 0N/A * @throws IllegalStateException if this is not a drop 0N/A * Returns the data flavors for this transfer. 0N/A * @return the data flavors for this transfer 0N/A * Returns whether or not the given data flavor is supported. 0N/A * @param df the <code>DataFlavor</code> to test 0N/A * @return whether or not the given flavor is supported. 0N/A * Returns the <code>Transferable</code> associated with this transfer. 0N/A * Note: Unless it is necessary to fetch the <code>Transferable</code> 0N/A * directly, use one of the other methods on this class to inquire about 0N/A * the transfer. This may perform better than fetching the 0N/A * <code>Transferable</code> and asking it directly. 0N/A * @return the <code>Transferable</code> associated with this transfer 0N/A * Returns an {@code Action} that performs cut operations to the 0N/A * clipboard. When performed, this action operates on the {@code JComponent} 0N/A * source of the {@code ActionEvent} by invoking {@code exportToClipboard}, 0N/A * with a {@code MOVE} action, on the component's {@code TransferHandler}. 0N/A * @return an {@code Action} for performing cuts to the clipboard 0N/A * Returns an {@code Action} that performs copy operations to the 0N/A * clipboard. When performed, this action operates on the {@code JComponent} 0N/A * source of the {@code ActionEvent} by invoking {@code exportToClipboard}, 0N/A * with a {@code COPY} action, on the component's {@code TransferHandler}. 0N/A * @return an {@code Action} for performing copies to the clipboard 0N/A * Returns an {@code Action} that performs paste operations from the 0N/A * clipboard. When performed, this action operates on the {@code JComponent} 0N/A * source of the {@code ActionEvent} by invoking {@code importData}, 0N/A * with the clipboard contents, on the component's {@code TransferHandler}. 0N/A * @return an {@code Action} for performing pastes from the clipboard 0N/A * Constructs a transfer handler that can transfer a Java Bean property 0N/A * from one component to another via the clipboard or a drag and drop 0N/A * @param property the name of the property to transfer; this can 0N/A * be <code>null</code> if there is no property associated with the transfer 0N/A * handler (a subclass that performs some other kind of transfer, for example) 0N/A * Convenience constructor for subclasses. 0N/A * image for the {@code startDrag} method 0N/A * @see java.awt.dnd.DragGestureEvent#startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl) 0N/A * anchor offset for the {@code startDrag} method 0N/A * @see java.awt.dnd.DragGestureEvent#startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable transferable, DragSourceListener dsl) 0N/A * Sets the drag image parameter. The image has to be prepared 0N/A * for rendering by the moment of the call. The image is stored 0N/A * by reference because of some performance reasons. 0N/A * @param img an image to drag 0N/A * Returns the drag image. If there is no image to drag, 0N/A * the returned value is {@code null}. 0N/A * @return the reference to the drag image 0N/A * Sets an anchor offset for the image to drag. 0N/A * It can not be {@code null}. 0N/A * @param p a {@code Point} object that corresponds 0N/A * to coordinates of an anchor offset of the image 0N/A * relative to the upper left corner of the image 0N/A * Returns an anchor offset for the image to drag. 0N/A * @return a {@code Point} object that corresponds 0N/A * to coordinates of an anchor offset of the image 0N/A * relative to the upper left corner of the image. 0N/A * The point {@code (0,0)} returns by default. 0N/A * Causes the Swing drag support to be initiated. This is called by 0N/A * the various UI implementations in the <code>javax.swing.plaf.basic</code> 0N/A * package if the dragEnabled property is set on the component. 0N/A * This can be called by custom UI 0N/A * implementations to use the Swing drag support. This method can also be called 0N/A * by a Swing extension written as a subclass of <code>JComponent</code> 0N/A * to take advantage of the Swing drag support. 0N/A * The transfer <em>will not necessarily</em> have been completed at the 0N/A * return of this call (i.e. the call does not block waiting for the drop). 0N/A * The transfer will take place through the Swing implementation of the 0N/A * <code>java.awt.dnd</code> mechanism, requiring no further effort 0N/A * from the developer. The <code>exportDone</code> method will be called 0N/A * when the transfer has completed. 0N/A * @param comp the component holding the data to be transferred; 0N/A * provided to enable sharing of <code>TransferHandler</code>s 0N/A * @param e the event that triggered the transfer 0N/A * @param action the transfer action initially requested; 0N/A * either {@code COPY}, {@code MOVE} or {@code LINK}; 0N/A * the DnD system may change the action used during the 0N/A * course of the drag operation 0N/A // only mouse events supported for drag operations 0N/A // only support known actions 0N/A // only support valid source actions 0N/A * Causes a transfer from the given component to the 0N/A * given clipboard. This method is called by the default cut and 0N/A * copy actions registered in a component's action map. 0N/A * The transfer will take place using the <code>java.awt.datatransfer</code> 0N/A * mechanism, requiring no further effort from the developer. Any data 0N/A * transfer <em>will</em> be complete and the <code>exportDone</code> 0N/A * method will be called with the action that occurred, before this method 0N/A * returns. Should the clipboard be unavailable when attempting to place 0N/A * data on it, the <code>IllegalStateException</code> thrown by 0N/A * {@link Clipboard#setContents(Transferable, ClipboardOwner)} will 0N/A * be propogated through this method. However, 0N/A * <code>exportDone</code> will first be called with an action 0N/A * of <code>NONE</code> for consistency. 0N/A * @param comp the component holding the data to be transferred; 0N/A * provided to enable sharing of <code>TransferHandler</code>s 0N/A * @param clip the clipboard to transfer the data into 0N/A * @param action the transfer action requested; this should 0N/A * be a value of either <code>COPY</code> or <code>MOVE</code>; 0N/A * the operation performed is the intersection of the transfer 0N/A * capabilities given by getSourceActions and the requested action; 0N/A * the intersection may result in an action of <code>NONE</code> 0N/A * if the requested action isn't supported 0N/A * @throws IllegalStateException if the clipboard is currently unavailable 0N/A * @see Clipboard#setContents(Transferable, ClipboardOwner) 0N/A * Causes a transfer to occur from a clipboard or a drag and 0N/A * drop operation. The <code>Transferable</code> to be 0N/A * imported and the component to transfer to are contained 0N/A * within the <code>TransferSupport</code>. 0N/A * While the drag and drop implementation calls {@code canImport} 0N/A * to determine the suitability of a transfer before calling this 0N/A * method, the implementation of paste does not. As such, it cannot 0N/A * be assumed that the transfer is acceptable upon a call to 0N/A * this method for paste. It is recommended that {@code canImport} be 0N/A * explicitly called to cover this case. 0N/A * Note: The <code>TransferSupport</code> object passed to this method 0N/A * is only valid for the duration of the method call. It is undefined 0N/A * what values it may contain after this method returns. 0N/A * @param support the object containing the details of 0N/A * the transfer, not <code>null</code>. 0N/A * @return true if the data was inserted into the component, 0N/A * @throws NullPointerException if <code>support</code> is {@code null} 0N/A * @see #canImport(TransferHandler.TransferSupport) 0N/A * Causes a transfer to a component from a clipboard or a 0N/A * DND drop operation. The <code>Transferable</code> represents 0N/A * the data to be imported into the component. 0N/A * Note: Swing now calls the newer version of <code>importData</code> 0N/A * that takes a <code>TransferSupport</code>, which in turn calls this 0N/A * method (if the component in the {@code TransferSupport} is a 0N/A * {@code JComponent}). Developers are encouraged to call and override the 0N/A * newer version as it provides more information (and is the only 0N/A * version that supports use with a {@code TransferHandler} set directly 0N/A * on a {@code JFrame} or other non-{@code JComponent}). 0N/A * @param comp the component to receive the transfer; 0N/A * provided to enable sharing of <code>TransferHandler</code>s 0N/A * @param t the data to import 0N/A * @return true if the data was inserted into the component, false otherwise 0N/A * @see #importData(TransferHandler.TransferSupport) 0N/A // read-only property. ignore 0N/A // zero or more than one argument, ignore 0N/A * This method is called repeatedly during a drag and drop operation 0N/A * to allow the developer to configure properties of, and to return 0N/A * the acceptability of transfers; with a return value of {@code true} 0N/A * indicating that the transfer represented by the given 0N/A * {@code TransferSupport} (which contains all of the details of the 0N/A * transfer) is acceptable at the current time, and a value of {@code false} 0N/A * rejecting the transfer. 0N/A * For those components that automatically display a drop location during 0N/A * drag and drop, accepting the transfer, by default, tells them to show 0N/A * the drop location. This can be changed by calling 0N/A * {@code setShowDropLocation} on the {@code TransferSupport}. 0N/A * By default, when the transfer is accepted, the chosen drop action is that 0N/A * picked by the user via their drag gesture. The developer can override 0N/A * this and choose a different action, from the supported source 0N/A * actions, by calling {@code setDropAction} on the {@code TransferSupport}. 0N/A * On every call to {@code canImport}, the {@code TransferSupport} contains 0N/A * fresh state. As such, any properties set on it must be set on every 0N/A * call. Upon a drop, {@code canImport} is called one final time before 0N/A * calling into {@code importData}. Any state set on the 0N/A * {@code TransferSupport} during that last call will be available in 0N/A * {@code importData}. 0N/A * This method is not called internally in response to paste operations. 0N/A * As such, it is recommended that implementations of {@code importData} 0N/A * explicitly call this method for such cases and that this method 0N/A * be prepared to return the suitability of paste operations as well. 0N/A * Note: The <code>TransferSupport</code> object passed to this method 0N/A * is only valid for the duration of the method call. It is undefined 0N/A * what values it may contain after this method returns. 0N/A * @param support the object containing the details of 0N/A * the transfer, not <code>null</code>. 0N/A * @return <code>true</code> if the import can happen, 0N/A * <code>false</code> otherwise 0N/A * @throws NullPointerException if <code>support</code> is {@code null} 0N/A * @see #importData(TransferHandler.TransferSupport) 0N/A * @see javax.swing.TransferHandler.TransferSupport#setShowDropLocation 0N/A * @see javax.swing.TransferHandler.TransferSupport#setDropAction 0N/A * Indicates whether a component will accept an import of the given 0N/A * set of data flavors prior to actually attempting to import it. 0N/A * Note: Swing now calls the newer version of <code>canImport</code> 0N/A * that takes a <code>TransferSupport</code>, which in turn calls this 0N/A * method (only if the component in the {@code TransferSupport} is a 0N/A * {@code JComponent}). Developers are encouraged to call and override the 0N/A * newer version as it provides more information (and is the only 0N/A * version that supports use with a {@code TransferHandler} set directly 0N/A * on a {@code JFrame} or other non-{@code JComponent}). 0N/A * @param comp the component to receive the transfer; 0N/A * provided to enable sharing of <code>TransferHandler</code>s 0N/A * @param transferFlavors the data formats available 0N/A * @return true if the data can be inserted into the component, false otherwise 0N/A * @see #canImport(TransferHandler.TransferSupport) 0N/A // read-only property. ignore 0N/A // zero or more than one argument, ignore 0N/A * Returns the type of transfer actions supported by the source; 0N/A * any bitwise-OR combination of {@code COPY}, {@code MOVE} 0N/A * Some models are not mutable, so a transfer operation of {@code MOVE} 0N/A * should not be advertised in that case. Returning {@code NONE} 0N/A * disables transfers from the component. 0N/A * @param c the component holding the data to be transferred; 0N/A * provided to enable sharing of <code>TransferHandler</code>s 0N/A * @return {@code COPY} if the transfer property can be found, 0N/A * otherwise returns <code>NONE</code> 0N/A * Returns an object that establishes the look of a transfer. This is 0N/A * useful for both providing feedback while performing a drag operation and for 0N/A * representing the transfer in a clipboard implementation that has a visual 0N/A * appearance. The implementation of the <code>Icon</code> interface should 0N/A * not alter the graphics clip or alpha level. 0N/A * The icon implementation need not be rectangular or paint all of the 0N/A * bounding rectangle and logic that calls the icons paint method should 0N/A * not assume the all bits are painted. <code>null</code> is a valid return value 0N/A * for this method and indicates there is no visual representation provided. 0N/A * In that case, the calling logic is free to represent the 0N/A * transferable however it wants. 0N/A * The default Swing logic will not do an alpha blended drag animation if 0N/A * the return is <code>null</code>. 0N/A * @param t the data to be transferred; this value is expected to have been 0N/A * created by the <code>createTransferable</code> method 0N/A * @return <code>null</code>, indicating 0N/A * there is no default visual representation 0N/A * Creates a <code>Transferable</code> to use as the source for 0N/A * a data transfer. Returns the representation of the data to 0N/A * be transferred, or <code>null</code> if the component's 0N/A * property is <code>null</code> 0N/A * @param c the component holding the data to be transferred; 0N/A * provided to enable sharing of <code>TransferHandler</code>s 0N/A * @return the representation of the data to be transferred, or 0N/A * <code>null</code> if the property associated with <code>c</code> 0N/A * is <code>null</code> 0N/A * Invoked after data has been exported. This method should remove 0N/A * the data that was transferred if the action was <code>MOVE</code>. 0N/A * This method is implemented to do nothing since <code>MOVE</code> 0N/A * is not a supported action of this implementation 0N/A * (<code>getSourceActions</code> does not include <code>MOVE</code>). 0N/A * @param source the component that was the source of the data 0N/A * @param data The data that was transferred or possibly null 0N/A * if the action is <code>NONE</code>. 0N/A * @param action the actual action that was performed 3749N/A * Fetches the property descriptor for the property assigned to this transfer 3749N/A * handler on the given component (transfer handler may be shared). This 3749N/A * returns <code>null</code> if the property descriptor can't be found 3749N/A * or there is an error attempting to fetch the property descriptor. 0N/A // found the desired descriptor 0N/A * Fetches the data flavor from the array of possible flavors that 0N/A * has data of the type represented by property type. Null is 0N/A * returned if there is no match. 0N/A // --- Transferable methods ---------------------------------------------- 0N/A * Returns an array of <code>DataFlavor</code> objects indicating the flavors the data 0N/A * can be provided in. The array should be ordered according to preference 0N/A * for providing the data (from most richly descriptive to least descriptive). 0N/A * @return an array of data flavors in which this data can be transferred 0N/A * Returns whether the specified data flavor is supported for 0N/A * @param flavor the requested flavor for the data 0N/A * @return true if this <code>DataFlavor</code> is supported, 0N/A * Returns an object which represents the data to be transferred. The class 0N/A * of the object returned is defined by the representation class of the flavor. 0N/A * @param flavor the requested flavor for the data 0N/A * @see DataFlavor#getRepresentationClass 0N/A * @exception IOException if the data is no longer available 0N/A * in the requested flavor. 0N/A * @exception UnsupportedFlavorException if the requested data flavor is 0N/A * This is the default drop target for drag and drop operations if 0N/A * one isn't provided by the developer. <code>DropTarget</code> 0N/A * only supports one <code>DropTargetListener</code> and doesn't 0N/A * function properly if it isn't set. 0N/A * This class sets the one listener as the linkage of drop handling 0N/A * to the <code>TransferHandler</code>, and adds support for 0N/A * additional listeners which some of the <code>ComponentUI</code> 0N/A * implementations install to manipulate a drop insertion location. 0N/A // addDropTargetListener is overridden 0N/A // we specifically need to add to the superclass 0N/A // Since the super class only supports one DropTargetListener, 0N/A // and we add one from the constructor, we always add to the 0N/A // --- DropTargetListener methods (multicast) -------------------------- 0N/A * Update the geometry of the autoscroll region. The geometry is 0N/A * maintained as a pair of rectangles. The region can cause 0N/A * a scroll if the pointer sits inside it for the duration of the 0N/A * timer. The region that causes the timer countdown is the area 0N/A * between the two rectangles. 0N/A * This is implemented to use the visible area of the component 0N/A * as the outer rectangle, and the insets are fixed at 10. Should 0N/A * the component be smaller than a total of 20 in any direction, 0N/A * autoscroll will not occur in that direction. 0N/A // compute the outer 0N/A // set the inner from the insets 0N/A * Perform an autoscroll operation. This is implemented to scroll by the 0N/A * unit increment of the Scrollable using scrollRectToVisible. If the 0N/A * cursor is in a corner of the autoscroll region, more than one axis will 0N/A * Initializes the internal properties if they haven't been already 0N/A * inited. This is done lazily to avoid loading of desktop properties. 0N/A * The timer fired, perform autoscroll if the pointer is within the 0N/A * autoscroll region. 0N/A * @param e the <code>ActionEvent</code> 0N/A // --- DropTargetListener methods ----------------------------------- 0N/A * Work-around for Linux bug where dropActionChanged 0N/A * is called before dragEnter. 0N/A * This is the default drag handler for drag and drop operations that 0N/A * use the <code>TransferHandler</code>. 2661N/A // --- DragGestureListener methods ----------------------------------- 2661N/A * a Drag gesture has been recognized 0N/A // --- DragSourceListener methods ----------------------------------- 0N/A * as the hotspot enters a platform dependent drop site 0N/A * as the hotspot moves over a platform dependent drop site * as the hotspot exits a platform dependent drop site * as the operation completes * register this DragGestureRecognizer's Listeners with the Component * unregister this DragGestureRecognizer's Listeners with the Component * subclasses must override this method // any of these calls may throw IllegalStateException // clipboard was unavailable // this is a paste action, import data into the component * Key used in app context to lookup Clipboard to use if access to * System clipboard is denied.