|
||||||||||
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 org.xnap.commons.gui.dnd.DefaultTreeFileTransferHandler
public class DefaultTreeFileTransferHandler
Provides a default file transfer handler for JTree
s.
When a drag from a tree is initiated all selected paths are collected and
their last path components
, if
they are files, are added to the FileTransferable
that is created.
To support dragging of files you have to enable it for the tree, see
JTree.setDragEnabled(boolean)
.
When a transferable with files is dropped on the tree, the handler tries to
copy the dropped files to the first directory that is selected in the tree. A
confirmation dialog is shown before copying if the boolean setting
getShowCopyDialogSetting()
is true.
Field Summary |
---|
Fields inherited from class org.xnap.commons.gui.dnd.AbstractFileTransferHandler |
---|
linuxURIFlavor |
Fields inherited from class javax.swing.TransferHandler |
---|
COPY, COPY_OR_MOVE, MOVE, NONE |
Constructor Summary | |
---|---|
DefaultTreeFileTransferHandler()
Convenience constructor which creates a dummy boolean setting that says the copy confirmation dialog should not be shown. |
|
DefaultTreeFileTransferHandler(BooleanSetting showCopyDialog)
Constructs a file transfer handler for JTree s. |
Method Summary | |
---|---|
protected Transferable |
createTransferable(JComponent c)
Returns null . |
BooleanSetting |
getShowCopyDialogSetting()
Returns the boolean setting which decides if a confirmation dialog is shown before any files are copied. |
boolean |
importFiles(JComponent comp,
List<File> files)
Returns false if no directory is selected in the tree
where the files could be dropped into or the selected file is not an
existent directory. |
void |
setShowCopyDialogSetting(BooleanSetting setting)
Sets the boolean setting which decides if a confirmation dialog is shown before any files are copied. |
Methods inherited from class org.xnap.commons.gui.dnd.AbstractFileTransferHandler |
---|
canImport, getSourceActions, importData |
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 |
Constructor Detail |
---|
public DefaultTreeFileTransferHandler(BooleanSetting showCopyDialog)
JTree
s.
showCopyDialog
- the boolean setting which decides if a
confirmation dialog is shown before dropped files are copied to the
selected directory in the tree.
NullPointerException
- if showCopyDialog
is null.public DefaultTreeFileTransferHandler()
See DefaultTreeFileTransferHandler(BooleanSetting)
and
Dialogs.showCopyDialog(Component, File[], File, BooleanSetting)
.
Method Detail |
---|
public void setShowCopyDialogSetting(BooleanSetting setting)
See Dialogs.showCopyDialog(Component, File[], File, BooleanSetting)
.
NullPointerException
- if setting
is null.public BooleanSetting getShowCopyDialogSetting()
protected Transferable createTransferable(JComponent c)
AbstractFileTransferHandler
null
.
Subclasses can return a FileTransferable
.
createTransferable
in class AbstractFileTransferHandler
public boolean importFiles(JComponent comp, List<File> files)
false
if no directory is selected in the tree
where the files could be dropped into or the selected file is not an
existent directory.
Otherwise files
are copied to the specified directory
while a progress dialog is displayed.
importFiles
in class AbstractFileTransferHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |