public abstract class Importer.ImporterTask extends LongRunningTask
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.
Modifier and Type | Field and Description |
---|---|
protected File |
file
The file passed to the constructor
|
protected InputStream |
in
The InputStream passed to the constructor
|
protected int |
pagenumber
The initial pagenumber to request
|
protected String |
title
The title passed to the constructor
|
protected PDFViewer |
viewer
The viewer passed to the constructor
|
Modifier | Constructor and Description |
---|---|
protected |
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. |
Modifier and Type | Method and Description |
---|---|
boolean |
addToMostRecent()
Return true if the file should be added to the "Most Recent" list of files,
false otherwise.
|
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.
|
void |
setFile(File file)
Set the default file to save the file to if the PDF is later saved.
|
void |
setPageNumber(int pagenumber)
Set the initial pagenumber to display.
|
addPropertyChangeListener, cancel, getProgress, isCancelled, isModal, isRunning, removePropertyChangeListener, setCancellable, setModal, start, start
protected final PDFViewer viewer
protected final File file
protected final InputStream in
protected String title
protected int pagenumber
protected ImporterTask(PDFViewer viewer, InputStream in, String title, File file)
in
is null) or from an InputStream.viewer
- the Viewer this task is going to add the PDF toin
- the InputStream to read the PDF from, or null
to read
the PDF from the file
parametertitle
- the title of the PDF - may be nullfile
- 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.public boolean isCancellable()
LongRunningTask
isCancellable
in class LongRunningTask
public void run() throws IOException
LongRunningTask
LongRunningTask.start(javax.swing.JComponent, java.lang.String)
, this method
should typically not be called directly.run
in class LongRunningTask
IOException
public void setPageNumber(int pagenumber)
public void setFile(File file)
Save
feature will try to resolve it against the last directory used by the userfile
- If the PDF is later saved, the file to initialize the path to. Should
be an absolute file if one is required, and may also be null
.public abstract PDF loadPDF() throws IOException
InputStream
in
if it's specified
of the File
file
if it's notIOException
public boolean addToMostRecent()
Copyright © 2001-2017 Big Faceless Organization