|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.TransferHandler org.xnap.commons.gui.dnd.AbstractFileTransferHandler
public abstract class AbstractFileTransferHandler
Abstract handler class easing drag and drop support of file objects.
Also handles Linux Desktop file drag and drops which don't seem to translate
to the DataFlavor.javaFileListFlavor
.
Subclasses should override createTransferable(JComponent)
and importFiles(JComponent, List)
.
Field Summary | |
---|---|
static DataFlavor |
linuxURIFlavor
URI flavor used for file drag and drops on the Linux desktop. |
Fields inherited from class javax.swing.TransferHandler |
---|
COPY, COPY_OR_MOVE, MOVE, NONE |
Constructor Summary | |
---|---|
AbstractFileTransferHandler()
|
Method Summary | |
---|---|
boolean |
canImport(JComponent comp,
DataFlavor[] transferFlavors)
Returns true if one of the supported flavors is either DataFlavor.javaFileListFlavor or linuxURIFlavor . |
protected Transferable |
createTransferable(JComponent c)
Returns null . |
int |
getSourceActions(JComponent c)
Returns TransferHandler.COPY . |
boolean |
importData(JComponent comp,
Transferable t)
Overriden to extract the file lists from the different types of transferables. |
boolean |
importFiles(JComponent comp,
List<File> files)
Returns false , thus disallowing dropping of files on
the component comp . |
Methods inherited from class javax.swing.TransferHandler |
---|
exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static DataFlavor linuxURIFlavor
Constructor Detail |
---|
public AbstractFileTransferHandler()
Method Detail |
---|
public boolean canImport(JComponent comp, DataFlavor[] transferFlavors)
DataFlavor.javaFileListFlavor
or linuxURIFlavor
.
canImport
in class TransferHandler
public int getSourceActions(JComponent c)
TransferHandler.COPY
.
getSourceActions
in class TransferHandler
protected Transferable createTransferable(JComponent c)
null
.
Subclasses can return a FileTransferable
.
createTransferable
in class TransferHandler
public boolean importFiles(JComponent comp, List<File> files)
false
, thus disallowing dropping of files on
the component comp
.
Subclasses should import the list of files
and return true
on success.
public boolean importData(JComponent comp, Transferable t)
importData
in class TransferHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |