Class DebugTransferHandler

java.lang.Object
javax.swing.TransferHandler
org.bzdev.swing.DebugTransferHandler
All Implemented Interfaces:
Serializable

public class DebugTransferHandler extends TransferHandler
TransferHandler that lists data flavors and objects being transferred. It outputs information about the transfer to an Appendable (a common interface implemented by a number of classes, including PrintStream, PrintWriter, CharBuffer, Writer, StringBuilder, and StringBuffer. This class should be used only for debugging and not as part of a released application. It is intended for cases in which one would like to trace the operation of a TransferHandler when the source code for the TransferHandler is not available or cannot be modified for some reason. For example, given a JComponent c, one could call

 c.setTransferHandler(new DebugTransferHandler(c.getTransferHandler(),
                                               System.out));
 
to trace a drag and drop operation, showing the data flavors that are available and their values. In some cases, the data flavor used is system dependent and may change from release to release, so being able to add tracing of drag and drop operations quickly is advantageous, and some of the data flavors used in practice are not mentioned in the Java documentation (for example, some if not all versions of the Nautilus file manager on Linux/Gnome systems will use lists of URLs when dragging and dropping files).

The class is a wrapper for an existing TransferHandler, with a default behavior if the wrapped TransferHandler is null.

See Also: