org.ujac.print.tag
Class PdfTableTag

java.lang.Object
  extended by org.ujac.print.BaseDocumentTag
      extended by org.ujac.print.tag.BaseElementTag
          extended by org.ujac.print.tag.PdfTableTag
All Implemented Interfaces:
CommonAttributesHolder, FontHolder, PdfCellContainer, PdfTableHolder, StyleHolder

public class PdfTableTag
extends BaseElementTag
implements PdfCellContainer, PdfTableHolder, FontHolder, StyleHolder

Name: PdfTableTag
Description: An item handling PDF tables.

Author:
lauerc

Field Summary
static int MAX_SEGMENT_SIZE
          The maximum number of lines for a table segment.
static String TAG_NAME
          The item's name.
 
Fields inherited from class org.ujac.print.BaseDocumentTag
actualContent, attributes, condition, content, customAttributes, DEFAULT_FONT, DEFAULT_FONT_COLOR, DEFAULT_FONT_ENCODING, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FONT_STYLE, DEFAULT_LEADING, DEFAULT_LINE_SPACING, depth, documentHandler, IMAGE_CHUNK_ATTR, log, NUMBER_OF_PAGES_TEMPLATES, parentItem, previousItem, styleParent, supportedAttributeMap, supportedChildMap, supportedStyleAttributeMap, tagFactory
 
Constructor Summary
PdfTableTag()
          Constructs a PdfTableTag instance with no specific attributes.
 
Method Summary
 void addCell(BaseDocumentTag item, com.lowagie.text.pdf.PdfPCell cell)
          Adds a cell to the table.
 void addHeaderCell(BaseDocumentTag item, com.lowagie.text.pdf.PdfPCell cell)
          Adds a header cell to the table.
protected  AttributeDefinitionMap buildSupportedAttributes()
          Gets the list of supported attributes.
 ChildDefinitionMap buildSupportedChilds()
          Gets the list of supported childs.
protected  AttributeDefinitionMap buildSupportedStyleAttributes()
          Gets the list of supported style attributes.
 void closeItem()
          Closes the item.
 boolean fitsPage()
          Checks whether the table fits the current page or not.
 CellAttributes getCellAttributes()
          Gets the cell attributes.
 String getDescription()
          Gets a brief description for the item.
 float getLeading()
          Gets the leading.
 float getLineSpacing()
          Gets the line spacing.
 int getNumColumns()
          Gets the number of columns, defined for the table.
 int getNumContentRows()
          Gets the number of content rows, that have been added to the current table so far.
 PdfTableHolder getPdfTable()
          Gets the PDF table holder.
 int getRemainingPdfColumns()
          Gets the number of remaining columns of the current row.
 com.lowagie.text.pdf.PdfPTable getTable()
          Gets the iText table.
 void initialize()
          Initializes the item.
 boolean isStyleable()
          Tells whether or not this tag does respect style attributes or not.
 void openItem()
          Opens the item.
 void openItem(boolean resetData)
          Opens the item.
 boolean splitTable(boolean newPage, boolean keepHeader)
          Splits the table vertically.
 
Methods inherited from class org.ujac.print.tag.BaseElementTag
getElementContainer
 
Methods inherited from class org.ujac.print.BaseDocumentTag
addAttributeDefinition, addChunk, addChunk, addChunk, addContent, addContent, addStyleAttributeDefinition, addToLatestCellContainer, addToLatestElementContainer, addToLatestPdfCellContainer, checkAttributes, colorFromString, createChunk, createFont, ensureNumberOfPagesTemplate, evalAttribute, evalAttribute, extendLeading, extendLeading, extendLeading, extendLeading, filterContents, flushContent, getActualContent, getAttribute, getAttribute, getAttributeDefinition, getAttributeHandler, getAttributes, getBackgroundColor, getBooleanAttribute, getBooleanAttribute, getBorderAttribute, getBorderAttribute, getColorAttribute, getColorAttribute, getCommonAttributesHolder, getContent, getCustomAttributes, getDepth, getDimensionAttribute, getDimensionAttribute, getDimensionAttribute, getDocumentHandler, getExamples, getFloatAttribute, getFloatAttribute, getFont, getHorizontalAlignmentAttribute, getHorizontalAlignmentAttribute, getIntegerAttribute, getIntegerAttribute, getLocalAttribute, getLocalFont, getLocalStyleAttribute, getName, getParentItem, getPhraseContent, getPhraseHeight, getPhraseWidth, getPreviousItem, getRawAttribute, getSortedAttributeDefinitions, getSortedStyleAttributeDefinitions, getStringAttribute, getStringAttribute, getStringAttribute, getStyle, getStyleAttribute, getStyleAttribute, getStyleAttributeDefinition, getStyleAttributes, getStyleClass, getSupportedAttributes, getSupportedChilds, getSupportedChildTags, getSupportedStyleAttributes, getTagFactory, getTextAttribute, getTextAttribute, getTrimmedContent, getVerticalAlignmentAttribute, getVerticalAlignmentAttribute, handleContent, handleFontAttributes, hasContent, int2FontStyle, isAttributeDefined, isAttributeDefined, isAttributeDefined, isAttributeDefined, isAttributeSupported, isAttributeSupported, isAttributeSupported, isAttributeSupported, isDocumentRoot, isEmptyContent, isEmptyString, isIgnoreFlush, isItemClosed, isItemOpened, isPhraseEmpty, isRendered, isStructureChecksDisabled, isStyleAttributeDefined, isTextBodyAllowed, isTrimBody, isTrimNextHead, isValid, isVirtualContainer, locator, preInitialize, printPhrase, processContents, processContents, resetContent, rotatePhrase, setAttributes, setBackgroundColor, setCustomAttributes, setDepth, setDocumentHandler, setItemClosed, setItemOpened, setLocalFont, setLocalFont, setName, setParentItem, setPreviousItem, setTagFactory, setTrimBody, setTrimNextHead, trimContentHead, trimContentTail, typeCastValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ujac.print.FontHolder
getFont
 
Methods inherited from interface org.ujac.print.StyleHolder
getStyleAttribute
 

Field Detail

TAG_NAME

public static final String TAG_NAME
The item's name.

See Also:
Constant Field Values

MAX_SEGMENT_SIZE

public static final int MAX_SEGMENT_SIZE
The maximum number of lines for a table segment. In case this size is reached, an automnatic table split is performed to keep the memory consumption low.

See Also:
Constant Field Values
Constructor Detail

PdfTableTag

public PdfTableTag()
Constructs a PdfTableTag instance with no specific attributes.

Method Detail

getDescription

public String getDescription()
Gets a brief description for the item.

Specified by:
getDescription in class BaseDocumentTag
Returns:
The item's description.

buildSupportedAttributes

protected AttributeDefinitionMap buildSupportedAttributes()
Gets the list of supported attributes.

Overrides:
buildSupportedAttributes in class BaseElementTag
Returns:
The attribute definitions.

buildSupportedStyleAttributes

protected AttributeDefinitionMap buildSupportedStyleAttributes()
Gets the list of supported style attributes.

Overrides:
buildSupportedStyleAttributes in class BaseDocumentTag
Returns:
The attribute definitions.

buildSupportedChilds

public ChildDefinitionMap buildSupportedChilds()
Gets the list of supported childs.

Overrides:
buildSupportedChilds in class BaseDocumentTag
Returns:
The child definitions.

isStyleable

public boolean isStyleable()
Tells whether or not this tag does respect style attributes or not.

Overrides:
isStyleable in class BaseDocumentTag
Returns:
always true.

getNumColumns

public int getNumColumns()
Gets the number of columns, defined for the table.

Specified by:
getNumColumns in interface PdfTableHolder
Returns:
The number of columns that have been defined for the table.

getNumContentRows

public int getNumContentRows()
Gets the number of content rows, that have been added to the current table so far.

Specified by:
getNumContentRows in interface PdfTableHolder
Returns:
The number of content rows, that have been added to the current table so far.

initialize

public void initialize()
                throws DocumentHandlerException
Initializes the item.

Overrides:
initialize in class BaseElementTag
Throws:
DocumentHandlerException - If something went badly wrong.

openItem

public void openItem()
              throws DocumentHandlerException
Opens the item.

Overrides:
openItem in class BaseElementTag
Throws:
DocumentHandlerException - Thrown in case something went wrong while opening the document item.

openItem

public void openItem(boolean resetData)
              throws DocumentHandlerException
Opens the item.

Parameters:
resetData - tells whether to reset some specific data or not (don't blame for this silly comment).
Throws:
DocumentHandlerException - Thrown in case something went wrong while opening the document item.

closeItem

public void closeItem()
               throws DocumentHandlerException
Closes the item.

Overrides:
closeItem in class BaseDocumentTag
Throws:
DocumentHandlerException - Thrown in case something went wrong while closing the document item.

addCell

public void addCell(BaseDocumentTag item,
                    com.lowagie.text.pdf.PdfPCell cell)
             throws DocumentHandlerException
Adds a cell to the table.

Specified by:
addCell in interface PdfCellContainer
Parameters:
item - The tag which performed the cell adding.
cell - The cell to be added.
Throws:
DocumentHandlerException - If something went wrong when adding the cell.

getRemainingPdfColumns

public int getRemainingPdfColumns()
Gets the number of remaining columns of the current row.

Specified by:
getRemainingPdfColumns in interface PdfCellContainer
Returns:
The number of remaining column to the end of the current row.

getPdfTable

public PdfTableHolder getPdfTable()
Gets the PDF table holder.

Specified by:
getPdfTable in interface PdfCellContainer
Returns:
The component that really holds a PDF table.

addHeaderCell

public void addHeaderCell(BaseDocumentTag item,
                          com.lowagie.text.pdf.PdfPCell cell)
                   throws DocumentHandlerException
Adds a header cell to the table.

Parameters:
item - The tag which performed the cell adding.
cell - The header cell to be added.
Throws:
DocumentHandlerException - If something went wrong when adding the header cell.

getTable

public com.lowagie.text.pdf.PdfPTable getTable()
Gets the iText table.

Returns:
The iText table.

fitsPage

public boolean fitsPage()
                 throws DocumentHandlerException
Checks whether the table fits the current page or not.

Specified by:
fitsPage in interface PdfTableHolder
Returns:
true if there's room enough for the table on the current page, else false.
Throws:
DocumentHandlerException - In case something went wrong.

splitTable

public boolean splitTable(boolean newPage,
                          boolean keepHeader)
                   throws DocumentHandlerException
Splits the table vertically.

Specified by:
splitTable in interface PdfTableHolder
Parameters:
newPage - Tells whether to start a new page or not.
keepHeader - Tells whether to keep the old header or not.
Returns:
true if a split has been really performed, else false.
Throws:
DocumentHandlerException - If something went wrong while splitting the table.

getCellAttributes

public CellAttributes getCellAttributes()
Gets the cell attributes.

Specified by:
getCellAttributes in interface PdfCellContainer
Returns:
The cell attributes.

getLineSpacing

public float getLineSpacing()
Gets the line spacing.

Specified by:
getLineSpacing in interface CommonAttributesHolder
Returns:
The current line spacing.

getLeading

public float getLeading()
Gets the leading.

Specified by:
getLeading in interface CommonAttributesHolder
Returns:
The current leading.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.