com.alee.utils.drag
Class FileTransferable

java.lang.Object
  extended by com.alee.utils.drag.FileTransferable
All Implemented Interfaces:
java.awt.datatransfer.Transferable

public class FileTransferable
extends java.lang.Object
implements java.awt.datatransfer.Transferable

Custom transferable that represents File flavors in a few different ways. This is made to support files drop into system file managers like Windows Explorer, Mac OS X Finder and others.

Author:
Mikle Garin

Field Summary
protected  java.util.List<java.io.File> files
          Transfered files.
static java.awt.datatransfer.DataFlavor[] flavors
          FileTransferable data flavors.
 
Constructor Summary
FileTransferable(java.io.File file)
          Constructs new FileTransferable for a single file.
FileTransferable(java.util.List<java.io.File> files)
          Constructs new FileTransferable for a list of files.
 
Method Summary
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
          
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          
 boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flavors

public static final java.awt.datatransfer.DataFlavor[] flavors
FileTransferable data flavors. These are constant and will always be provided.


files

protected final java.util.List<java.io.File> files
Transfered files.

Constructor Detail

FileTransferable

public FileTransferable(java.io.File file)
Constructs new FileTransferable for a single file.

Parameters:
file - transferred file

FileTransferable

public FileTransferable(java.util.List<java.io.File> files)
Constructs new FileTransferable for a list of files.

Parameters:
files - transferred files list
Method Detail

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()

Specified by:
getTransferDataFlavors in interface java.awt.datatransfer.Transferable

isDataFlavorSupported

public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)

Specified by:
isDataFlavorSupported in interface java.awt.datatransfer.Transferable

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException

Specified by:
getTransferData in interface java.awt.datatransfer.Transferable
Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException