adams.core.io
Class PlainTextPdfProclet

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.PlainTextPdfProclet
All Implemented Interfaces:
Debuggable, Destroyable, VariableFileExtensionPdfProclet, OptionHandler, SizeOfHandler, Serializable

public class PlainTextPdfProclet
extends AbstractPdfProclet
implements VariableFileExtensionPdfProclet

Adds plain-text files line by line.

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
 
-font-content <adams.core.io.PdfFont> (property: fontContent)
    The font to use for the file content.
    default: Helvetica-Normal-12
 
-color-content <java.awt.Color> (property: colorContent)
    The color to use for the content.
    default: #000000
 
-extension <adams.core.base.BaseString> [-extension ...] (property: extensions)
    The file extension(s) that the processor will be used for.
    default: txt
 

Version:
$Revision: 6358 $
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_ColorContent
          the color for the content.
protected  BaseString[] m_Extensions
          the file extensions.
protected  PdfFont m_FontContent
          the font for the content.
 
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
PlainTextPdfProclet()
           
 
Method Summary
 String colorContentTipText()
          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 fontContentTipText()
          Returns the tip text for this property.
 Color getColorContent()
          Returns the color to use for the content.
 BaseString[] getExtensions()
          Returns the extensions that the processor can process.
 PdfFont getFontContent()
          Returns the font to use for adding the content.
 String globalInfo()
          Returns a short description of the writer.
 void setColorContent(Color value)
          Sets the color to use for the content.
 void setExtensions(BaseString[] value)
          Sets the extensions that the processor can process.
 void setFontContent(PdfFont value)
          Sets the font to use for adding the content.
 
Methods inherited from class adams.core.io.AbstractPdfProclet
addFilename, addFilenameTipText, canProcess, 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_FontContent

protected PdfFont m_FontContent
the font for the content.


m_ColorContent

protected Color m_ColorContent
the color for the content.


m_Extensions

protected BaseString[] m_Extensions
the file extensions.

Constructor Detail

PlainTextPdfProclet

public PlainTextPdfProclet()
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

setFontContent

public void setFontContent(PdfFont value)
Sets the font to use for adding the content.

Parameters:
value - the font

getFontContent

public PdfFont getFontContent()
Returns the font to use for adding the content.

Returns:
the font

fontContentTipText

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

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

setColorContent

public void setColorContent(Color value)
Sets the color to use for the content.

Parameters:
value - the color

getColorContent

public Color getColorContent()
Returns the color to use for the content.

Returns:
the color

colorContentTipText

public String colorContentTipText()
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.

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.