toolbox.pdf.table
Class PdfTable

Package class diagram package PdfTable
java.lang.Object
  extended by toolbox.pdf.table.PdfTable

public class PdfTable
extends java.lang.Object

Class that generates PDF documents with a Table structure as the contents of the document.


Constructor Summary
PdfTable(java.lang.String name, java.lang.String type, java.lang.String width, java.lang.String align)
          Construct a new PdfTable.
 
Method Summary
 void addColumn(java.lang.String lang, java.lang.String srcAttr, java.lang.String format, boolean rollup, java.lang.String heading, java.lang.String width)
          Add a column descriptor to this table
 void addTitle(java.lang.String lang, java.lang.String content)
          Add a title to this table.
 void generatePDF(java.lang.String lang, java.lang.String type, java.util.List data, java.util.List totalData, java.io.OutputStream os)
          Generate a PDF document based on this PdfTable and direct the output to the given OutputStream
 java.lang.String getAlignment()
          Returns the default alignment of this table.
 java.util.LinkedHashMap getColumnCollection(java.lang.String lang)
          Returns the column collection for the given language as map.
 java.util.ArrayList getHeadings(java.lang.String lang)
          Returns the column headings for the specified language as an ArrayList.
 java.lang.String getTitle(java.lang.String lang)
          Returns the title for the given language.
 java.lang.String getWidth()
          Returns the default width of this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfTable

public PdfTable(java.lang.String name,
                java.lang.String type,
                java.lang.String width,
                java.lang.String align)
Construct a new PdfTable.

Parameters:
name - Name of the document.
type - Default type of table - portrait or landscape
width - Default width.
align - Default alignment.
Method Detail

addTitle

public void addTitle(java.lang.String lang,
                     java.lang.String content)
Add a title to this table.

Parameters:
lang - Two letter language code.
content - Contents of the title.

addColumn

public void addColumn(java.lang.String lang,
                      java.lang.String srcAttr,
                      java.lang.String format,
                      boolean rollup,
                      java.lang.String heading,
                      java.lang.String width)
Add a column descriptor to this table

Parameters:
lang - Two letter language code.
srcAttr - Name of the attribute that will be contained in the content source for this document.
format - The format for the specified column.
rollup - This column must be totaled up.
heading - The heading for this column to be used in the table header
width - Column width in percentage.

getWidth

public java.lang.String getWidth()
Returns the default width of this table.

Returns:
String containing default width.

getAlignment

public java.lang.String getAlignment()
Returns the default alignment of this table.

Returns:
String containing default alignment.

getColumnCollection

public java.util.LinkedHashMap getColumnCollection(java.lang.String lang)
Returns the column collection for the given language as map.

Parameters:
lang - The language.
Returns:
LinkedHashMap containing column descriptors

getHeadings

public java.util.ArrayList getHeadings(java.lang.String lang)
Returns the column headings for the specified language as an ArrayList.

Parameters:
lang - Language.
Returns:
ArrayList of headings.

getTitle

public java.lang.String getTitle(java.lang.String lang)
Returns the title for the given language.

Parameters:
lang - Language.
Returns:
String containing title.

generatePDF

public void generatePDF(java.lang.String lang,
                        java.lang.String type,
                        java.util.List data,
                        java.util.List totalData,
                        java.io.OutputStream os)
                 throws java.io.IOException
Generate a PDF document based on this PdfTable and direct the output to the given OutputStream

Parameters:
lang - Two letter language code to indicate the target language.
type - Override the default type with this type.
data - Table instance containing main table contents.
totalData - Table instance containing rollup column contents.
os - Target OutputStream.
Throws:
java.io.IOException - if the document cannot be written.