org.pdfsam.guiclient.business.thumbnails.creators
Class JPodThumbnailCreator

java.lang.Object
  extended by org.pdfsam.guiclient.business.thumbnails.creators.AbstractThumbnailCreator
      extended by org.pdfsam.guiclient.business.thumbnails.creators.JPodThumbnailCreator
All Implemented Interfaces:
ThumbnailsCreator

public class JPodThumbnailCreator
extends AbstractThumbnailCreator

Thumbnail creator using JPod

Author:
Andrea Vacondio

Field Summary
static int JPOD_RESOLUTION
           
 
Fields inherited from interface org.pdfsam.guiclient.business.thumbnails.creators.ThumbnailsCreator
DEFAULT_RESIZE_PERCENTAGE, DEFAULT_SIZE
 
Constructor Summary
JPodThumbnailCreator()
           
 
Method Summary
protected  void finalizeThumbnailsCreation()
          generic finalization.
protected  java.util.concurrent.Callable<java.lang.Boolean> getCloserTask()
           
 java.lang.String getCreatorIdentifier()
           
 java.lang.String getCreatorName()
           
protected  DocumentInfo getDocumentInfo()
           
protected  java.util.Vector<VisualPageListItem> getDocumentModel(java.util.List<DocumentPage> template)
          The model to set on thumbnails list before the thumbnails generation starts.
protected  java.util.Collection<? extends java.util.concurrent.Callable<java.lang.Boolean>> getGenerationTasks(java.util.Vector<VisualPageListItem> modelList)
           
 java.awt.image.BufferedImage getPageImage(java.io.File inputFile, java.lang.String password, int page, int rotation)
           
 int getResolution()
           
 java.awt.image.BufferedImage getThumbnail(java.io.File inputFile, java.lang.String password, int page, float resizePercentage)
           
protected  void initThumbnailsCreation()
          initialization of the thumbnail creation process
protected  boolean openInputDocument()
          Opens the input document
 
Methods inherited from class org.pdfsam.guiclient.business.thumbnails.creators.AbstractThumbnailCreator
clean, getCurrentId, getInputFile, getPageImage, getPageImage, getPageImage, getPanel, getProvidedPassword, getScaledImage, getThumbnail, initThumbnailsPanel, initThumbnailsPanel, setProvidedPassword
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JPOD_RESOLUTION

public static final int JPOD_RESOLUTION
See Also:
Constant Field Values
Constructor Detail

JPodThumbnailCreator

public JPodThumbnailCreator()
Method Detail

getPageImage

public java.awt.image.BufferedImage getPageImage(java.io.File inputFile,
                                                 java.lang.String password,
                                                 int page,
                                                 int rotation)
                                          throws ThumbnailCreationException
rotation - page rotation in degrees
Returns:
the image
Throws:
ThumbnailCreationException

getThumbnail

public java.awt.image.BufferedImage getThumbnail(java.io.File inputFile,
                                                 java.lang.String password,
                                                 int page,
                                                 float resizePercentage)
                                          throws ThumbnailCreationException
Parameters:
inputFile - pdf document
password - document password or null if no password is needed
page - page nmber
resizePercentage - resize level
Returns:
a thumbnail of the given page
Throws:
ThumbnailCreationException

getResolution

public int getResolution()
Returns:
resolution of the created thumbnails

getCreatorName

public java.lang.String getCreatorName()
Returns:
the Name of the creator

getCreatorIdentifier

public java.lang.String getCreatorIdentifier()
Returns:
a unique identifier for the creator.

finalizeThumbnailsCreation

protected void finalizeThumbnailsCreation()
                                   throws ThumbnailCreationException
Description copied from class: AbstractThumbnailCreator
generic finalization. It shouldn't clean resources used by the Thumbnails Generation Tasks (Callable).

Specified by:
finalizeThumbnailsCreation in class AbstractThumbnailCreator
Throws:
ThumbnailCreationException

getCloserTask

protected java.util.concurrent.Callable<java.lang.Boolean> getCloserTask()
                                                                  throws ThumbnailCreationException
Specified by:
getCloserTask in class AbstractThumbnailCreator
Returns:
The Collable that is submitted when all the thumbnails generation tasks are terminated. Used to close the document or other clean operations.
Throws:
ThumbnailCreationException

getDocumentInfo

protected DocumentInfo getDocumentInfo()
                                throws ThumbnailCreationException
Specified by:
getDocumentInfo in class AbstractThumbnailCreator
Returns:
the DocumentiInfo to set on the thumbnails panel
Throws:
ThumbnailCreationException

getDocumentModel

protected java.util.Vector<VisualPageListItem> getDocumentModel(java.util.List<DocumentPage> template)
                                                         throws ThumbnailCreationException
Description copied from class: AbstractThumbnailCreator
The model to set on thumbnails list before the thumbnails generation starts. This is used to show hourglasses images as thumbnails.

Specified by:
getDocumentModel in class AbstractThumbnailCreator
Parameters:
template - Pages template. Used when loading an environment to set rotation and other informations
Returns:
a Vector of VisualPageListItem
Throws:
ThumbnailCreationException

getGenerationTasks

protected java.util.Collection<? extends java.util.concurrent.Callable<java.lang.Boolean>> getGenerationTasks(java.util.Vector<VisualPageListItem> modelList)
                                                                                                       throws ThumbnailCreationException
Specified by:
getGenerationTasks in class AbstractThumbnailCreator
Parameters:
modelList - the model list set on the Visual List Component
Returns:
a Collection of tasks that will run the thumbnails generation
Throws:
ThumbnailCreationException

initThumbnailsCreation

protected void initThumbnailsCreation()
                               throws ThumbnailCreationException
Description copied from class: AbstractThumbnailCreator
initialization of the thumbnail creation process

Specified by:
initThumbnailsCreation in class AbstractThumbnailCreator
Throws:
ThumbnailCreationException

openInputDocument

protected boolean openInputDocument()
                             throws ThumbnailCreationException
Description copied from class: AbstractThumbnailCreator
Opens the input document

Specified by:
openInputDocument in class AbstractThumbnailCreator
Returns:
true if opened correctly
Throws:
ThumbnailCreationException