org.ujac.print.tag
Class ForeachTag

java.lang.Object
  extended by org.ujac.print.BaseDocumentTag
      extended by org.ujac.print.tag.BaseElementTag
          extended by org.ujac.print.tag.BaseLoopTag
              extended by org.ujac.print.tag.ForeachTag
All Implemented Interfaces:
CellContainer, CommonAttributesHolder, Condition, DocumentEventRecorder, ElementContainer, PdfCellContainer, PhraseHolder

public class ForeachTag
extends BaseLoopTag
implements Condition, ElementContainer, CellContainer, PdfCellContainer, PhraseHolder

Name: ForeachTag
Description: A class iterating over a given sequence (list, table etc.) and repeats the nested body for each element of the sequence.

Author:
lauerc

Field Summary
protected  CellContainer cellContainer
          The cell container.
protected  boolean childsAdded
          Indicates, whether elements or cells have been added through this condition or not.
protected  PdfCellContainer pdfCellContainer
          The PDF cell container.
protected  com.lowagie.text.Phrase phrase
          The phrase which takes the content.
protected  PhraseHolder phraseHolder
          The phrase holder.
static String TAG_NAME
          The item's name.
 
Fields inherited from class org.ujac.print.tag.BaseLoopTag
insertItems, iterationIdx, sequenceHolder, sequenceIterator
 
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
ForeachTag()
          Constructs a ForeachTag instance with no specific attributes.
 
Method Summary
 void addCell(BaseDocumentTag item, com.lowagie.text.Cell cell)
          Adds a cell to the container.
 void addCell(BaseDocumentTag item, com.lowagie.text.pdf.PdfPCell cell)
          Adds a cell to the container.
 void addChunk(BaseDocumentTag item, com.lowagie.text.Chunk chunk)
          Adds the given chunk to the root phrase.
 void addChunk(BaseDocumentTag item, String chunk, DocumentFont font)
          Adds the given chunk to the root phrase.
 void addElement(BaseDocumentTag item, com.lowagie.text.Element element)
          Adds a element to the container.
protected  AttributeDefinitionMap buildSupportedAttributes()
          Gets the list of supported attributes.
 void flushContent()
          Flushes the content buffer.
 CellAttributes getCellAttributes()
          Gets the cell attributes.
 CellContainer getCellContainer()
          Gets the cell container.
 String getDescription()
          Gets a brief description for the item.
 float getLeading()
          Gets the fixed vertical leading distance.
 float getLineSpacing()
          Gets the line spacing.
 PdfCellContainer getPdfCellContainer()
          Gets the PDF cell container.
 PdfTableHolder getPdfTable()
          Gets the PDF table holder.
 int getRemainingColumns()
          Gets the number of remaining columns of the current row.
 int getRemainingPdfColumns()
          Gets the number of remaining columns of the current row.
 void initialize()
          Initializes the item.
 boolean isTextBodyAllowed()
          Tells whether textual content is allowed for the tag or not.
 boolean isTopLevel()
          Tells whether the element container is a top level container or not.
 boolean isVirtualContainer()
          Is the item virtual container, such as if, else or foreach.
 
Methods inherited from class org.ujac.print.tag.BaseLoopTag
closeItem, getCurrentValue, getLoopIdxVariable, getLoopVariable, getSequenceHolder, hasNext, isFirstLoop, isTrue, openItem, postLoopChildItems, postRepeatChildItems, preLoopChildItems, preRepeatChildItems, recordEvent, repeatChildItems, setCurrentValue, setLoopVariable, setSequenceHolder
 
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, buildSupportedChilds, buildSupportedStyleAttributes, checkAttributes, colorFromString, createChunk, createFont, ensureNumberOfPagesTemplate, evalAttribute, evalAttribute, extendLeading, extendLeading, extendLeading, extendLeading, filterContents, 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, isStyleable, isStyleAttributeDefined, isTrimBody, isTrimNextHead, isValid, 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.Condition
isTrue
 

Field Detail

TAG_NAME

public static final String TAG_NAME
The item's name.

See Also:
Constant Field Values

cellContainer

protected CellContainer cellContainer
The cell container.


pdfCellContainer

protected PdfCellContainer pdfCellContainer
The PDF cell container.


phraseHolder

protected PhraseHolder phraseHolder
The phrase holder.


phrase

protected com.lowagie.text.Phrase phrase
The phrase which takes the content.


childsAdded

protected boolean childsAdded
Indicates, whether elements or cells have been added through this condition or not.

Constructor Detail

ForeachTag

public ForeachTag()
Constructs a ForeachTag 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.

isVirtualContainer

public boolean isVirtualContainer()
Is the item virtual container, such as if, else or foreach.

Overrides:
isVirtualContainer in class BaseDocumentTag
Returns:
true if the item is such a container, else false.

isTextBodyAllowed

public boolean isTextBodyAllowed()
Tells whether textual content is allowed for the tag or not.

Overrides:
isTextBodyAllowed in class BaseDocumentTag
Returns:
true if the item is allowed to contain textual content, else false.

initialize

public void initialize()
                throws DocumentHandlerException
Initializes the item.

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

addElement

public void addElement(BaseDocumentTag item,
                       com.lowagie.text.Element element)
                throws DocumentHandlerException
Adds a element to the container.

Specified by:
addElement in interface ElementContainer
Parameters:
item - The document item.
element - The element to be added.
Throws:
DocumentHandlerException - If something went wrong when adding the element.

isTopLevel

public boolean isTopLevel()
Tells whether the element container is a top level container or not.

Specified by:
isTopLevel in interface ElementContainer
Returns:
true if the element container is a top level container, else false.

addCell

public void addCell(BaseDocumentTag item,
                    com.lowagie.text.Cell cell)
             throws DocumentHandlerException
Adds a cell to the container.

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

getRemainingColumns

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

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

addCell

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

Specified by:
addCell in interface PdfCellContainer
Parameters:
item - The document item.
cell - The PDF 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.

addChunk

public void addChunk(BaseDocumentTag item,
                     String chunk,
                     DocumentFont font)
              throws DocumentHandlerException
Adds the given chunk to the root phrase.

Specified by:
addChunk in interface PhraseHolder
Parameters:
item - The document item.
chunk - The chunk to add to the root phrase.
font - The font to use.
Throws:
DocumentHandlerException - In case the document processing failed.

addChunk

public void addChunk(BaseDocumentTag item,
                     com.lowagie.text.Chunk chunk)
              throws DocumentHandlerException
Adds the given chunk to the root phrase.

Specified by:
addChunk in interface PhraseHolder
Parameters:
item - The document item.
chunk - The chunk to add to the root phrase.
Throws:
DocumentHandlerException - In case the document processing failed.

getLeading

public float getLeading()
Gets the fixed vertical leading distance.

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

getLineSpacing

public float getLineSpacing()
Gets the line spacing.

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

flushContent

public void flushContent()
                  throws DocumentHandlerException
Flushes the content buffer.

Overrides:
flushContent in class BaseDocumentTag
Throws:
DocumentHandlerException - If something went wrong while flushing the content buffer.

getCellContainer

public CellContainer getCellContainer()
Gets the cell container.

Returns:
The cell container.

getPdfCellContainer

public PdfCellContainer getPdfCellContainer()
Gets the PDF cell container.

Returns:
The PDF cell container.

getCellAttributes

public CellAttributes getCellAttributes()
Gets the cell attributes.

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


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