org.displaytag.render
Class ItextTableWriter

java.lang.Object
  extended by org.displaytag.render.TableWriterTemplate
      extended by org.displaytag.render.TableWriterAdapter
          extended by org.displaytag.render.ItextTableWriter

public class ItextTableWriter
extends TableWriterAdapter

A table writer that formats table as and writes it to an iText document.

Version:
$Id$
Author:
Jorge L. Barroso
See Also:
TableWriterTemplate

Nested Class Summary
static interface ItextTableWriter.ItextDecorator
          An implementor of this interface decorates tables and columns appearing in iText documents.
 
Field Summary
 
Fields inherited from class org.displaytag.render.TableWriterTemplate
GROUP_END, GROUP_NO_CHANGE, GROUP_START, GROUP_START_AND_END, NO_RESET_GROUP
 
Constructor Summary
ItextTableWriter(com.lowagie.text.Table table, com.lowagie.text.Document document)
          This table writer uses an iText table and document to do its work.
 
Method Summary
protected  com.lowagie.text.Font getCaptionFont()
          Obtain the caption font; Meant to be overriden if a different style is desired.
protected  int getCaptionHorizontalAlignment()
          Obtain the caption horizontal alignment; Meant to be overriden if a different style is desired.
protected  java.awt.Color getFooterBackgroundColor()
          Obtain the footer background color; Meant to be overriden if a different style is desired.
protected  com.lowagie.text.Font getFooterFont()
          Obtain the footer font; Meant to be overriden if a different style is desired.
protected  java.awt.Color getFooterFontColor()
          Obtain the footer font color; Meant to be overriden if a different style is desired.
protected  int getFooterHorizontalAlignment()
          Obtain the footer horizontal alignment; Meant to be overriden if a different style is desired.
protected  java.awt.Color getHeaderBackgroundColor()
          Obtain the background color used to render the header; Meant to be overridden if a different header background color is desired.
protected  com.lowagie.text.Font getHeaderFont()
          Obtain the font used to render the header text; Meant to be overridden if a different header font is desired.
protected  java.awt.Color getHeaderFontColor()
          Set the font color used to render the header text; Meant to be overridden if a different header style is desired.
protected  int getHeaderHorizontalAlignment()
          Obtain the horizontal alignment used to render header text; Meant to be overridden if a different alignment is desired.
protected  com.lowagie.text.Font getTableFont()
          Obtain the font used to render text in the table; Meant to be overriden if a different font is desired.
protected  void setFooterFontStyle(com.lowagie.text.Chunk cellContent)
          Set the font style used to render the header text; Meant to be overridden if a different header style is desired.
protected  void setHeaderFontStyle(com.lowagie.text.Chunk cellContent)
          Set the font style used to render the header text; Meant to be overridden if a different header style is desired.
protected  void writeCaption(TableModel model)
          Write the table's caption to a iText document.
protected  void writeColumnOpener(Column column)
          Write a column's opening structure to an iText document.
protected  void writeColumnValue(java.lang.Object value, Column column)
          Write a column's value to a iText document.
protected  void writeDecoratedRowFinish(TableModel model)
          Called by writeTableBody to decorate the table.
protected  void writeDecoratedRowStart(TableModel model)
          Decorators that help render the table to an iText document must implement ItextDecorator.
protected  void writeDecoratedTableFinish(TableModel model)
          Called by writeTable to decorate the table.
protected  void writePostBodyFooter(TableModel model)
          Called by writeTable to write table footer after table body.
protected  void writeTableHeader(TableModel model)
          Write the table's header columns to an iText document.
protected  void writeTableOpener(TableModel model)
          Initialize the main info holder table, like the appropriate number of columns.
 
Methods inherited from class org.displaytag.render.TableWriterAdapter
writeBottomBanner, writeColumnCloser, writeEmptyListMessage, writeEmptyListRowMessage, writePreBodyFooter, writeRowCloser, writeRowOpener, writeRowWithNoColumns, writeTableBodyCloser, writeTableBodyOpener, writeTableCloser, writeTopBanner
 
Methods inherited from class org.displaytag.render.TableWriterTemplate
groupColumns, writeTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItextTableWriter

public ItextTableWriter(com.lowagie.text.Table table,
                        com.lowagie.text.Document document)
This table writer uses an iText table and document to do its work.

Parameters:
table - iText representation of the table.
document - iText document to which the table is written.
Method Detail

writeTableOpener

protected void writeTableOpener(TableModel model)
Initialize the main info holder table, like the appropriate number of columns.

Overrides:
writeTableOpener in class TableWriterAdapter
Parameters:
model - The table being represented as iText.
See Also:
TableWriterTemplate.writeTableOpener(org.displaytag.model.TableModel)

getTableFont

protected com.lowagie.text.Font getTableFont()
Obtain the font used to render text in the table; Meant to be overriden if a different font is desired.

Returns:
The font used to render text in the table.

writeCaption

protected void writeCaption(TableModel model)
                     throws java.lang.Exception
Write the table's caption to a iText document.

Overrides:
writeCaption in class TableWriterAdapter
Parameters:
model - The table model for which the content is written.
Throws:
java.lang.Exception - if it encounters an error while writing.
See Also:
TableWriterTemplate.writeCaption(org.displaytag.model.TableModel)

getCaptionFont

protected com.lowagie.text.Font getCaptionFont()
Obtain the caption font; Meant to be overriden if a different style is desired.

Returns:
The caption font.

getCaptionHorizontalAlignment

protected int getCaptionHorizontalAlignment()
Obtain the caption horizontal alignment; Meant to be overriden if a different style is desired.

Returns:
The caption horizontal alignment.

writeTableHeader

protected void writeTableHeader(TableModel model)
                         throws com.lowagie.text.BadElementException
Write the table's header columns to an iText document.

Overrides:
writeTableHeader in class TableWriterAdapter
Parameters:
model - The table model for which the content is written.
Throws:
com.lowagie.text.BadElementException - if an error occurs while writing header.
See Also:
TableWriterTemplate.writeTableHeader(org.displaytag.model.TableModel)

writePostBodyFooter

protected void writePostBodyFooter(TableModel model)
                            throws com.lowagie.text.DocumentException
Description copied from class: TableWriterTemplate
Called by writeTable to write table footer after table body.

Overrides:
writePostBodyFooter in class TableWriterAdapter
Parameters:
model - The table model for which the content is written.
Throws:
com.lowagie.text.DocumentException - if an error occurs while writing post-body footer.
See Also:
TableWriterTemplate.writePostBodyFooter(org.displaytag.model.TableModel)

getFooterBackgroundColor

protected java.awt.Color getFooterBackgroundColor()
Obtain the footer background color; Meant to be overriden if a different style is desired.

Returns:
The footer background color.

getFooterHorizontalAlignment

protected int getFooterHorizontalAlignment()
Obtain the footer horizontal alignment; Meant to be overriden if a different style is desired.

Returns:
The footer horizontal alignment.

setFooterFontStyle

protected void setFooterFontStyle(com.lowagie.text.Chunk cellContent)
Set the font style used to render the header text; Meant to be overridden if a different header style is desired.

Parameters:
cellContent - The header content whose font will be modified.

getFooterFontColor

protected java.awt.Color getFooterFontColor()
Obtain the footer font color; Meant to be overriden if a different style is desired.

Returns:
The footer font color.

getFooterFont

protected com.lowagie.text.Font getFooterFont()
Obtain the footer font; Meant to be overriden if a different style is desired.

Returns:
The footer font.

writeDecoratedRowStart

protected void writeDecoratedRowStart(TableModel model)
Decorators that help render the table to an iText document must implement ItextDecorator.

Overrides:
writeDecoratedRowStart in class TableWriterAdapter
Parameters:
model - The table model for which the content is written.
See Also:
TableWriterTemplate.writeDecoratedRowStart(org.displaytag.model.TableModel)

writeDecoratedRowFinish

protected void writeDecoratedRowFinish(TableModel model)
                                throws java.lang.Exception
Description copied from class: TableWriterTemplate
Called by writeTableBody to decorate the table.

Overrides:
writeDecoratedRowFinish in class TableWriterAdapter
Parameters:
model - The table model for which the content is written.
Throws:
java.lang.Exception - if it encounters an error while writing.
See Also:
TableWriterTemplate.writeDecoratedRowFinish(org.displaytag.model.TableModel)

writeColumnOpener

protected void writeColumnOpener(Column column)
                          throws ObjectLookupException,
                                 DecoratorException
Write a column's opening structure to an iText document.

Overrides:
writeColumnOpener in class TableWriterAdapter
Parameters:
column - The table column for which the content is written.
Throws:
ObjectLookupException
DecoratorException
See Also:
TableWriterTemplate.writeColumnOpener(org.displaytag.model.Column)

writeColumnValue

protected void writeColumnValue(java.lang.Object value,
                                Column column)
                         throws com.lowagie.text.BadElementException
Write a column's value to a iText document.

Overrides:
writeColumnValue in class TableWriterAdapter
Parameters:
value - The column value.
column - The table column for which the content is written.
Throws:
com.lowagie.text.BadElementException
See Also:
TableWriterTemplate.writeColumnValue(Object,org.displaytag.model.Column)

writeDecoratedTableFinish

protected void writeDecoratedTableFinish(TableModel model)
Description copied from class: TableWriterTemplate
Called by writeTable to decorate the table.

Overrides:
writeDecoratedTableFinish in class TableWriterAdapter
Parameters:
model - The table model for which the content is written.
See Also:
TableWriterTemplate.writeDecoratedTableFinish(org.displaytag.model.TableModel)

getHeaderFont

protected com.lowagie.text.Font getHeaderFont()
Obtain the font used to render the header text; Meant to be overridden if a different header font is desired.

Returns:
The font used to render the header text.

getHeaderBackgroundColor

protected java.awt.Color getHeaderBackgroundColor()
Obtain the background color used to render the header; Meant to be overridden if a different header background color is desired.

Returns:
The backgrounc color used to render the header.

setHeaderFontStyle

protected void setHeaderFontStyle(com.lowagie.text.Chunk cellContent)
Set the font style used to render the header text; Meant to be overridden if a different header style is desired.

Parameters:
cellContent - The header content whose font will be modified.

getHeaderFontColor

protected java.awt.Color getHeaderFontColor()
Set the font color used to render the header text; Meant to be overridden if a different header style is desired.

Returns:
The font color used to render the header text.

getHeaderHorizontalAlignment

protected int getHeaderHorizontalAlignment()
Obtain the horizontal alignment used to render header text; Meant to be overridden if a different alignment is desired.

Returns:
The horizontal alignment used to render header text;


Copyright © 2002-2007 the Displaytag team. All Rights Reserved.