adams.core.io
Class HeadlinePdfProclet

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.core.io.AbstractPdfProclet
              extended by adams.core.io.HeadlinePdfProclet
All Implemented Interfaces:
Debuggable, Destroyable, VariableFileExtensionPdfProclet, OptionHandler, SizeOfHandler, Serializable

public class HeadlinePdfProclet
extends AbstractPdfProclet
implements VariableFileExtensionPdfProclet

Adds a simple headline, but no file content.

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to
    the console (0 = off).
    default: 0
    minimum: 0
 
-page-break-before (property: pageBreakBefore)
    If true, then a page-break is added before the content of the file is inserted.
 
-page-break-after (property: pageBreakAfter)
    If true, then a page-break is added after the content of the file is inserted.
 
-num-files <int> (property: numFilesPerPage)
    The number of files to put on a page before adding an automatic page break;
     use -1 for unlimited.
    default: -1
    minimum: -1
 
-add-filename (property: addFilename)
    Whether to add the file name before the actual file content as separate
    paragraph.
 
-font-filename <adams.core.io.PdfFont> (property: fontFilename)
    The font to use for printing the file name header.
    default: Helvetica-Bold-12
 
-color-filename <java.awt.Color> (property: colorFilename)
    The color to use for printing the file name header.
    default: #000000
 
-headline <adams.core.base.BaseText> (property: headline)
    The headline to add, can be multi-line.
    default: Fill in headline
 
-font-headline <adams.core.io.PdfFont> (property: fontHeadline)
    The font to use for the headline.
    default: Helvetica-Bold-14
 
-color-headline <java.awt.Color> (property: colorHeadline)
    The color to use for the headline.
    default: #000000
 
-extension <adams.core.base.BaseString> [-extension ...] (property: extensions)
    The file extension(s) that the processor will be used for.
    default: *
 
-first-page-only (property: firstPageOnly)
    If set to true, then the headline is only added to the first page.
 

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class adams.core.io.AbstractPdfProclet
AbstractPdfProclet.DocumentState
 
Field Summary
protected  Color m_ColorHeadline
          the color for the headline.
protected  BaseString[] m_Extensions
          the file extensions.
protected  boolean m_FirstPageOnly
          whether to add it only on the first page.
protected  PdfFont m_FontHeadline
          the font for the headline.
protected  BaseText m_Headline
          the headline to add.
 
Fields inherited from class adams.core.io.AbstractPdfProclet
m_AddFilename, m_ColorFilename, m_FontFilename, m_NumFilesPerPage, m_PageBreakAfter, m_PageBreakBefore, MATCH_ALL_EXTENSION
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
HeadlinePdfProclet()
           
 
Method Summary
 boolean canProcess(AbstractPdfProclet.DocumentState state, File file)
          Whether the processor can handle this particular file.
 String colorHeadlineTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  boolean doProcess(com.itextpdf.text.Document doc, AbstractPdfProclet.DocumentState state, File file)
          The actual processing of the document.
 String extensionsTipText()
          Returns the tip text for this property.
 String firstPageOnlyTipText()
          Returns the tip text for this property.
 String fontHeadlineTipText()
          Returns the tip text for this property.
 Color getColorHeadline()
          Returns the color to use for the headline.
 BaseString[] getExtensions()
          Returns the extensions that the processor can process.
 boolean getFirstPageOnly()
          Returns the whether to add the headline only on the first page.
 PdfFont getFontHeadline()
          Returns the font to use for the headline.
 BaseText getHeadline()
          Returns the headline to add.
 String globalInfo()
          Returns a short description of the writer.
 String headlineTipText()
          Returns the tip text for this property.
 void setColorHeadline(Color value)
          Sets the color to use for the headline.
 void setExtensions(BaseString[] value)
          Sets the extensions that the processor can process.
 void setFirstPageOnly(boolean value)
          Sets the whether to add the headline only on the first page.
 void setFontHeadline(PdfFont value)
          Sets the font to use for the headline.
 void setHeadline(BaseText value)
          Sets the headline to add.
 
Methods inherited from class adams.core.io.AbstractPdfProclet
addFilename, addFilenameTipText, colorFilenameTipText, fontFilenameTipText, getAddFilename, getColorFilename, getFontFilename, getNumFilesPerPage, getPageBreakAfter, getPageBreakBefore, numFilesPerPageTipText, pageBreakAfterTipText, pageBreakBeforeTipText, postProcess, preProcess, process, setAddFilename, setColorFilename, setFontFilename, setNumFilesPerPage, setPageBreakAfter, setPageBreakBefore
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Headline

protected BaseText m_Headline
the headline to add.


m_FontHeadline

protected PdfFont m_FontHeadline
the font for the headline.


m_ColorHeadline

protected Color m_ColorHeadline
the color for the headline.


m_Extensions

protected BaseString[] m_Extensions
the file extensions.


m_FirstPageOnly

protected boolean m_FirstPageOnly
whether to add it only on the first page.

Constructor Detail

HeadlinePdfProclet

public HeadlinePdfProclet()
Method Detail

globalInfo

public String globalInfo()
Returns a short description of the writer.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description of the writer

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractPdfProclet

setHeadline

public void setHeadline(BaseText value)
Sets the headline to add.

Parameters:
value - the headline

getHeadline

public BaseText getHeadline()
Returns the headline to add.

Returns:
the headline

headlineTipText

public String headlineTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setFontHeadline

public void setFontHeadline(PdfFont value)
Sets the font to use for the headline.

Parameters:
value - the font

getFontHeadline

public PdfFont getFontHeadline()
Returns the font to use for the headline.

Returns:
the font

fontHeadlineTipText

public String fontHeadlineTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setColorHeadline

public void setColorHeadline(Color value)
Sets the color to use for the headline.

Parameters:
value - the color

getColorHeadline

public Color getColorHeadline()
Returns the color to use for the headline.

Returns:
the color

colorHeadlineTipText

public String colorHeadlineTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

getExtensions

public BaseString[] getExtensions()
Returns the extensions that the processor can process.

Specified by:
getExtensions in class AbstractPdfProclet
Returns:
the extensions (no dot)

setExtensions

public void setExtensions(BaseString[] value)
Sets the extensions that the processor can process.

Specified by:
setExtensions in interface VariableFileExtensionPdfProclet
Parameters:
value - the extensions (no dot)

extensionsTipText

public String extensionsTipText()
Returns the tip text for this property.

Specified by:
extensionsTipText in interface VariableFileExtensionPdfProclet
Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setFirstPageOnly

public void setFirstPageOnly(boolean value)
Sets the whether to add the headline only on the first page.

Parameters:
value - if true then the headline is only added on the first page

getFirstPageOnly

public boolean getFirstPageOnly()
Returns the whether to add the headline only on the first page.

Returns:
true if the headline is only on the first page

firstPageOnlyTipText

public String firstPageOnlyTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

canProcess

public boolean canProcess(AbstractPdfProclet.DocumentState state,
                          File file)
Whether the processor can handle this particular file.

Overrides:
canProcess in class AbstractPdfProclet
Parameters:
state - the document state
file - the file to check
Returns:
true if the file can be handled

doProcess

protected boolean doProcess(com.itextpdf.text.Document doc,
                            AbstractPdfProclet.DocumentState state,
                            File file)
                     throws Exception
The actual processing of the document.

Specified by:
doProcess in class AbstractPdfProclet
Parameters:
doc - the PDF document to add the file content to
state - the current document state
file - the file to add
Returns:
true if successfully added
Throws:
Exception - if something goes wrong


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.