Class DragAndDrop
- java.lang.Object
-
- org.faceless.pdf2.viewer2.ViewerFeature
-
- org.faceless.pdf2.viewer2.feature.DragAndDrop
-
public class DragAndDrop extends ViewerFeature
A feature which will add the ability to drag and drop files into the PDFViewer in a standard way. This class can be added as-is to the viewer to support that, or it can be subclassed and itsprocessTransferable(java.awt.datatransfer.Transferable)
method called - this method will call theaction(java.io.File)
methods for each File or URL specified. The name of this feature is DragAndDropThis code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
- Since:
- 2.10.3
-
-
Constructor Summary
Constructors Constructor Description DragAndDrop()
Create a new DragAndDrop object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
action(File file)
Process aFile
from a Transferable.void
action(URL url)
Process aURL
from a Transferable, which is guaranteed not to be afile
URL.static boolean
canImport(DataFlavor flavor)
Return true if the DataFlavor can be processed by this classstatic boolean
canImport(DataFlavor[] flavors)
Return true if the DataFlavor can be processed by this classTransferHandler
getTransferHandler()
Return aTransferHandler
which can be added to aJComponent
.void
initialize(PDFViewer viewer)
Called when the feature is first added to a viewerboolean
processTransferable(Transferable tran)
Process the Transferable object by callingaction(File)
oraction(URL)
on each matching item being transfered.-
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown, toString
-
-
-
-
Method Detail
-
initialize
public void initialize(PDFViewer viewer)
Description copied from class:ViewerFeature
Called when the feature is first added to a viewer- Overrides:
initialize
in classViewerFeature
-
getTransferHandler
public TransferHandler getTransferHandler()
Return aTransferHandler
which can be added to aJComponent
.
-
canImport
public static boolean canImport(DataFlavor[] flavors)
Return true if the DataFlavor can be processed by this class
-
canImport
public static boolean canImport(DataFlavor flavor)
Return true if the DataFlavor can be processed by this class
-
processTransferable
public boolean processTransferable(Transferable tran)
Process the Transferable object by callingaction(File)
oraction(URL)
on each matching item being transfered.
-
action
public void action(File file)
Process aFile
from a Transferable. By default calledPDFViewer.loadPDF(File)
-
action
public void action(URL url)
-
-