Class FileTransferHandler
java.lang.Object
javax.swing.TransferHandler
is.codion.swing.common.ui.transfer.FileTransferHandler
- All Implemented Interfaces:
Serializable
Handles the importing of files during drag'n drop operations.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class TransferHandler
TransferHandler.DropLocation, TransferHandler.TransferSupport -
Field Summary
Fields inherited from class TransferHandler
COPY, COPY_OR_MOVE, LINK, MOVE, NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSingleFileDragAndDropSupport(JTextComponent textComponent) Makes the text component accept files during drag and drop operations and insert the absolute path of the dropped file (the first file in a list if more than one file is dropped)booleancanImport(TransferHandler.TransferSupport transferSupport) static booleanfileDataFlavor(TransferHandler.TransferSupport transferSupport) booleanimportData(TransferHandler.TransferSupport transferSupport) protected abstract booleanimportFiles(Component component, List<File> files) Called after a successful importtransferFiles(TransferHandler.TransferSupport transferSupport) Returns the files described by the given transfer support object.Methods inherited from class TransferHandler
canImport, createTransferable, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getDragImage, getDragImageOffset, getPasteAction, getSourceActions, getVisualRepresentation, importData, setDragImage, setDragImageOffset
-
Constructor Details
-
FileTransferHandler
public FileTransferHandler()
-
-
Method Details
-
canImport
- Overrides:
canImportin classTransferHandler
-
importData
- Overrides:
importDatain classTransferHandler
-
addSingleFileDragAndDropSupport
Makes the text component accept files during drag and drop operations and insert the absolute path of the dropped file (the first file in a list if more than one file is dropped)- Parameters:
textComponent- the text component
-
fileDataFlavor
- Parameters:
transferSupport- a drag'n drop transfer support instance- Returns:
- true if the given transfer support instance represents a file or a list of files
-
transferFiles
Returns the files described by the given transfer support object. An empty list is returned if no files are found.- Parameters:
transferSupport- the drag'n drop transfer support- Returns:
- the files described by the given transfer support object
- Throws:
RuntimeException- in case of an exception
-
importFiles
-