org.faceless.pdf2.viewer2
Class Importer.ImporterTask

java.lang.Object
  extended by org.faceless.pdf2.viewer2.LongRunningTask
      extended by org.faceless.pdf2.viewer2.Importer.ImporterTask
Enclosing class:
Importer

public abstract class Importer.ImporterTask
extends LongRunningTask

This class is a LongRunningTask that can be run to load a PDF into the viewer. Subclasses of Importer need to implement a concrete subclass of this which implemented the loadPDF() method. By default this task is cancellable, but that may be overridden too.

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.

Since:
2.10.2

Field Summary
protected  File file
          The file passed to the constructor
protected  InputStream in
          The InputStream passed to the constructor
protected  String title
          The title passed to the constructor
protected  PDFViewer viewer
          The viewer passed to the constructor
 
Constructor Summary
protected Importer.ImporterTask(PDFViewer viewer, InputStream in, String title, File file)
          Create a new ImporterTask which will read it's input from a File (if in is null) or from an InputStream.
 
Method Summary
 boolean isCancellable()
          Return true if this task can be cancelled before completion by the user.
abstract  PDF loadPDF()
          Load and return a PDF.
 void run()
          Run the current task.
 
Methods inherited from class org.faceless.pdf2.viewer2.LongRunningTask
cancel, getProgress, isCancelled, isRunning, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewer

protected final PDFViewer viewer
The viewer passed to the constructor


file

protected final File file
The file passed to the constructor


in

protected final InputStream in
The InputStream passed to the constructor


title

protected String title
The title passed to the constructor

Constructor Detail

Importer.ImporterTask

protected Importer.ImporterTask(PDFViewer viewer,
                                InputStream in,
                                String title,
                                File file)
Create a new ImporterTask which will read it's input from a File (if in is null) or from an InputStream.

Parameters:
viewer - the Viewer this task is going to add the PDF to
in - the InputStream to read the PDF from, or null to read the PDF from the file parameter
title - the title of the PDF - may be null
file - If in is null, the File to read the PDF from (may not be null). If in is not null, the file that is used as the default when this PDF is save, in which case it may be null.
Method Detail

isCancellable

public boolean isCancellable()
Description copied from class: LongRunningTask
Return true if this task can be cancelled before completion by the user.

Specified by:
isCancellable in class LongRunningTask

run

public void run()
         throws IOException
Description copied from class: LongRunningTask
Run the current task. Called by LongRunningTask.start(javax.swing.JComponent, java.lang.String), this method should typically not be called directly.

Specified by:
run in class LongRunningTask
Throws:
IOException

loadPDF

public abstract PDF loadPDF()
                     throws IOException
Load and return a PDF. Subclasses must implement this method, loading the PDF from the InputStream in if it's specified of the File file if it's not

Returns:
the PDF
Throws:
IOException


Copyright © 2001-2008 Big Faceless Organization