|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
org.faceless.pdf2.viewer2.feature.DragAndDrop
public class DragAndDrop
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 its processTransferable(java.awt.datatransfer.Transferable)
method called - this method will call the action(java.io.File)
methods for each File or URL specified.
The name of this feature is DragAndDrop
This 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.
Constructor Summary | |
---|---|
DragAndDrop()
Create a new DragAndDrop object |
Method Summary | |
---|---|
void |
action(File file)
Process a File from a Transferable. |
void |
action(URL url)
Process a URL from a Transferable, which is guaranteed not to be a file URL. |
static boolean |
canImport(DataFlavor flavor)
Return true if the DataFlavor can be processed by this class |
static boolean |
canImport(DataFlavor[] flavors)
Return true if the DataFlavor can be processed by this class |
TransferHandler |
getTransferHandler()
Return a TransferHandler which can be added to a JComponent . |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer |
boolean |
processTransferable(Transferable tran)
Process the Transferable object by calling action(File) or action(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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DragAndDrop()
Method Detail |
---|
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class ViewerFeature
public TransferHandler getTransferHandler()
TransferHandler
which can be added to a JComponent
.
JComponent.setTransferHandler(javax.swing.TransferHandler)
public static boolean canImport(DataFlavor[] flavors)
TransferHandler.canImport(JComponent, DataFlavor[])
public static boolean canImport(DataFlavor flavor)
TransferHandler.canImport(JComponent, DataFlavor[])
public boolean processTransferable(Transferable tran)
action(File)
or action(URL)
on each matching item being transfered.
TransferHandler.importData(JComponent, Transferable)
public void action(File file)
File
from a Transferable. By default called PDFViewer.loadPDF(File)
public void action(URL url)
URL
from a Transferable, which is guaranteed not to be a file
URL.
By default passes the URL stream to an Importer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |