org.faceless.pdf2.viewer2.feature
Class DragAndDrop

java.lang.Object
  extended by org.faceless.pdf2.viewer2.ViewerFeature
      extended by 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 its processTransferable(java.awt.datatransfer.Transferable) method called - this method will call the action(java.io.File) methods for each File or URL specified.

Since:
2.10.3

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.
 boolean canImport(DataFlavor flavor)
          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
getAllFeatures, getCustomJavaScript, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DragAndDrop

public DragAndDrop()
Create a new DragAndDrop object

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 class ViewerFeature

getTransferHandler

public TransferHandler getTransferHandler()
Return a TransferHandler which can be added to a JComponent.

See Also:
JComponent.setTransferHandler(javax.swing.TransferHandler)

canImport

public boolean canImport(DataFlavor flavor)
Return true if the DataFlavor can be processed by this class

See Also:
TransferHandler.canImport(JComponent, DataFlavor[])

processTransferable

public boolean processTransferable(Transferable tran)
Process the Transferable object by calling action(File) or action(URL) on each matching item being transfered.

See Also:
TransferHandler.importData(JComponent, Transferable)

action

public void action(File file)
Process a File from a Transferable. By default called PDFViewer.loadPDF(File)


action

public void action(URL url)
Process a URL from a Transferable, which is guaranteed not to be a file URL. By default passes the URL stream to an Importer



Copyright © 2001-2008 Big Faceless Organization