adams.core.io
Class CsvPdfProclet

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

public class CsvPdfProclet
extends AbstractPdfProclet
implements VariableFileExtensionPdfProclet

Adds CSV files as table.

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-comments <adams.core.io.PdfFont> (property: fontComments)
    The font to use for the comments.
    default: Helvetica-Italic-12
 
-color-comments <java.awt.Color> (property: colorComments)
    The color to use for the comments.
    default: #404040
 
-font-table-header <adams.core.io.PdfFont> (property: fontTableHeader)
    The font to use for the table header.
    default: Helvetica-Bold-12
 
-color-table-header <java.awt.Color> (property: colorTableHeader)
    The color to use for the table header.
    default: #000000
 
-font-general-content <adams.core.io.PdfFont> (property: fontGeneralContent)
    The font to use for non-numeric content in the table.
    default: Helvetica-Normal-12
 
-color-general-content <java.awt.Color> (property: colorGeneralContent)
    The color to use for general content.
    default: #000000
 
-font-numeric-content <adams.core.io.PdfFont> (property: fontNumericContent)
    The font to use for numeric content in the table.
    default: Helvetica-Normal-12
 
-color-numeric-content <java.awt.Color> (property: colorNumericContent)
    The color to use for numeric content.
    default: #000000
 
-num-decimals <int> (property: numDecimals)
    The number of decimals for numeric values in the table.
    default: 1
    minimum: 0
 
-extension <adams.core.base.BaseString> [-extension ...] (property: extensions)
    The file extension(s) that the processor will be used for.
    default: csv
 

Version:
$Revision: 6306 $
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_ColorComments
          the color for the comments.
protected  Color m_ColorGeneralContent
          the color for general content.
protected  Color m_ColorNumericContent
          the color for the numeric content.
protected  Color m_ColorTableHeader
          the color for the table header.
protected  BaseString[] m_Extensions
          the file extensions.
protected  PdfFont m_FontComments
          the font for the comments.
protected  PdfFont m_FontGeneralContent
          the font for general content.
protected  PdfFont m_FontNumericContent
          the font for numeric content.
protected  PdfFont m_FontTableHeader
          the font for the table header.
protected  int m_NumDecimals
          the number of decimals for numbers in tables.
 
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
CsvPdfProclet()
           
 
Method Summary
 String colorCommentsTipText()
          Returns the tip text for this property.
 String colorGeneralContentTipText()
          Returns the tip text for this property.
 String colorNumericContentTipText()
          Returns the tip text for this property.
 String colorTableHeaderTipText()
          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 fontCommentsTipText()
          Returns the tip text for this property.
 String fontGeneralContentTipText()
          Returns the tip text for this property.
 String fontNumericContentTipText()
          Returns the tip text for this property.
 String fontTableHeaderTipText()
          Returns the tip text for this property.
 Color getColorComments()
          Returns the color to use for the comments.
 Color getColorGeneralContent()
          Returns the color to use for general content.
 Color getColorNumericContent()
          Returns the color to use for numeric content.
 Color getColorTableHeader()
          Returns the color to use for the table header.
 BaseString[] getExtensions()
          Returns the extensions that the processor can process.
 PdfFont getFontComments()
          Returns the font to use for the comments.
 PdfFont getFontGeneralContent()
          Returns the font to use for adding the content.
 PdfFont getFontNumericContent()
          Returns the font to use for adding the content.
 PdfFont getFontTableHeader()
          Returns the font to use for the table header.
 int getNumDecimals()
          Returns the number of decimals for numbers in tables.
 String globalInfo()
          Returns a short description of the writer.
 String numDecimalsTipText()
          Returns the tip text for this property.
 void setColorComments(Color value)
          Sets the color to use for the comments.
 void setColorGeneralContent(Color value)
          Sets the color to use for general content.
 void setColorNumericContent(Color value)
          Sets the color to use for numeric content.
 void setColorTableHeader(Color value)
          Sets the color to use for the table header.
 void setExtensions(BaseString[] value)
          Sets the extensions that the processor can process.
 void setFontComments(PdfFont value)
          Sets the font to use for the comments.
 void setFontGeneralContent(PdfFont value)
          Sets the font to use for adding general content.
 void setFontNumericContent(PdfFont value)
          Sets the font to use for adding general content.
 void setFontTableHeader(PdfFont value)
          Sets the font to use for the table header.
 void setNumDecimals(int value)
          Sets the number of decimals for numbers in tables.
 
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_FontComments

protected PdfFont m_FontComments
the font for the comments.


m_ColorComments

protected Color m_ColorComments
the color for the comments.


m_FontTableHeader

protected PdfFont m_FontTableHeader
the font for the table header.


m_ColorTableHeader

protected Color m_ColorTableHeader
the color for the table header.


m_FontGeneralContent

protected PdfFont m_FontGeneralContent
the font for general content.


m_ColorGeneralContent

protected Color m_ColorGeneralContent
the color for general content.


m_FontNumericContent

protected PdfFont m_FontNumericContent
the font for numeric content.


m_ColorNumericContent

protected Color m_ColorNumericContent
the color for the numeric content.


m_Extensions

protected BaseString[] m_Extensions
the file extensions.


m_NumDecimals

protected int m_NumDecimals
the number of decimals for numbers in tables.

Constructor Detail

CsvPdfProclet

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

setFontComments

public void setFontComments(PdfFont value)
Sets the font to use for the comments.

Parameters:
value - the font

getFontComments

public PdfFont getFontComments()
Returns the font to use for the comments.

Returns:
the font

fontCommentsTipText

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

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

setColorComments

public void setColorComments(Color value)
Sets the color to use for the comments.

Parameters:
value - the color

getColorComments

public Color getColorComments()
Returns the color to use for the comments.

Returns:
the color

colorCommentsTipText

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

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

setFontTableHeader

public void setFontTableHeader(PdfFont value)
Sets the font to use for the table header.

Parameters:
value - the font

getFontTableHeader

public PdfFont getFontTableHeader()
Returns the font to use for the table header.

Returns:
the font

fontTableHeaderTipText

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

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

setColorTableHeader

public void setColorTableHeader(Color value)
Sets the color to use for the table header.

Parameters:
value - the color

getColorTableHeader

public Color getColorTableHeader()
Returns the color to use for the table header.

Returns:
the color

colorTableHeaderTipText

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

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

setFontGeneralContent

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

Parameters:
value - the font

getFontGeneralContent

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

Returns:
the font

fontGeneralContentTipText

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

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

setColorGeneralContent

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

Parameters:
value - the color

getColorGeneralContent

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

Returns:
the color

colorGeneralContentTipText

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

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

setFontNumericContent

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

Parameters:
value - the font

getFontNumericContent

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

Returns:
the font

fontNumericContentTipText

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

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

setColorNumericContent

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

Parameters:
value - the color

getColorNumericContent

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

Returns:
the color

colorNumericContentTipText

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

setNumDecimals

public void setNumDecimals(int value)
Sets the number of decimals for numbers in tables.

Parameters:
value - the number of decimals

getNumDecimals

public int getNumDecimals()
Returns the number of decimals for numbers in tables.

Returns:
the number of decimals

numDecimalsTipText

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

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 © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.