org.ujac.print.tag
Class BaseLoopTag

java.lang.Object
  extended by org.ujac.print.BaseDocumentTag
      extended by org.ujac.print.tag.BaseElementTag
          extended by org.ujac.print.tag.BaseLoopTag
All Implemented Interfaces:
DocumentEventRecorder
Direct Known Subclasses:
ForeachTag, IndexTag, PrintTableTag, SegmentTag, TocTag

public abstract class BaseLoopTag
extends BaseElementTag
implements DocumentEventRecorder

Name: BaseLoopTag
Description: A base class for loop tags like the <foreach> and <print-table> tag.

Author:
lauerc

Field Summary
protected  boolean insertItems
          Flag which rules, whether the nested items should be added to the document or not.
protected  SequenceIndex iterationIdx
          The iteration index.
protected  Object sequenceHolder
          The sequence holder.
protected  Iterator sequenceIterator
          The sequence iterator.
 
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
BaseLoopTag(String name)
          Constructs a BaseLoopTag instance with specific attributes.
 
Method Summary
 void closeItem()
          Closes the item.
 Object getCurrentValue()
          Gets the the current value.
 String getLoopIdxVariable()
          Gets the the loop index variable.
 String getLoopVariable()
          Gets the the loop variable.
 Object getSequenceHolder()
          Gets the the sequence holder.
 boolean hasNext()
          Tells whether or not the sequence iteration has more elements.
 void initialize()
          Initializes the item.
 boolean isFirstLoop()
          Tells, whether this is the first iteration loop or not.
 boolean isTrue()
          Checks whether the condition is true or not.
 void openItem()
          Opens the item.
protected  void postLoopChildItems()
          Method called, after the child items are printed.
protected  void postRepeatChildItems()
          Post-processes the child items of the foreach item.
protected  void preLoopChildItems()
          Method called, before the child items are printed.
protected  boolean preRepeatChildItems()
          Pre-processes the child items of the foreach item.
 void recordEvent(DocumentEvent event)
          Records the given document event.
protected  void repeatChildItems()
          Repeating the child items of the foreach item.
 void setCurrentValue(Object currentValue)
          Sets the the current value.
protected  void setLoopVariable(String loopVariable)
          Sets the the loop variable.
protected  void setSequenceHolder(Object sequenceHolder)
          Sets the the sequence holder.
 
Methods inherited from class org.ujac.print.tag.BaseElementTag
buildSupportedAttributes, 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, flushContent, getActualContent, getAttribute, getAttribute, getAttributeDefinition, getAttributeHandler, getAttributes, getBackgroundColor, getBooleanAttribute, getBooleanAttribute, getBorderAttribute, getBorderAttribute, getColorAttribute, getColorAttribute, getCommonAttributesHolder, getContent, getCustomAttributes, getDepth, getDescription, 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, 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
 

Field Detail

insertItems

protected boolean insertItems
Flag which rules, whether the nested items should be added to the document or not.


sequenceHolder

protected Object sequenceHolder
The sequence holder.


sequenceIterator

protected Iterator sequenceIterator
The sequence iterator.


iterationIdx

protected SequenceIndex iterationIdx
The iteration index.

Constructor Detail

BaseLoopTag

public BaseLoopTag(String name)
Constructs a BaseLoopTag instance with specific attributes.

Parameters:
name - The tag name.
Method Detail

getSequenceHolder

public Object getSequenceHolder()
Gets the the sequence holder.

Returns:
The sequence holder instance.

setSequenceHolder

protected void setSequenceHolder(Object sequenceHolder)
Sets the the sequence holder.

Parameters:
sequenceHolder - The sequence holder instance to set.

getCurrentValue

public Object getCurrentValue()
Gets the the current value.

Returns:
The current value instance.

setCurrentValue

public void setCurrentValue(Object currentValue)
Sets the the current value.

Parameters:
currentValue - The value instance to set.

getLoopVariable

public String getLoopVariable()
Gets the the loop variable.

Returns:
The loop variable name.

setLoopVariable

protected void setLoopVariable(String loopVariable)
Sets the the loop variable.

Parameters:
loopVariable - The loop variable name to set.

getLoopIdxVariable

public String getLoopIdxVariable()
Gets the the loop index variable.

Returns:
The loop index variable name.

hasNext

public boolean hasNext()
Tells whether or not the sequence iteration has more elements.

Returns:
true if the sequence iterator has more elements, else false.

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 foreach 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 foreach item.

preLoopChildItems

protected void preLoopChildItems()
                          throws DocumentHandlerException
Method called, before the child items are printed.

Throws:
DocumentHandlerException - Thrown in case something went wrong.

postLoopChildItems

protected void postLoopChildItems()
                           throws DocumentHandlerException
Method called, after the child items are printed.

Throws:
DocumentHandlerException - Thrown in case something went wrong.

isTrue

public boolean isTrue()
Checks whether the condition is true or not.

Returns:
true, if the condition evaluates to true, else false.

isFirstLoop

public boolean isFirstLoop()
Tells, whether this is the first iteration loop or not.

Returns:
true if is the first iteration loop, else false.

preRepeatChildItems

protected boolean preRepeatChildItems()
                               throws DocumentHandlerException
Pre-processes the child items of the foreach item.

Returns:
Tells, whether or not to repeat the child items, returning false skips the execution for the current item.
Throws:
DocumentHandlerException - Thrown in case something went wrong.

postRepeatChildItems

protected void postRepeatChildItems()
                             throws DocumentHandlerException
Post-processes the child items of the foreach item.

Throws:
DocumentHandlerException - Thrown in case something went wrong.

repeatChildItems

protected void repeatChildItems()
                         throws DocumentHandlerException
Repeating the child items of the foreach item.

Throws:
DocumentHandlerException - Thrown in case something went wrong while opening ot closing a child item.

recordEvent

public void recordEvent(DocumentEvent event)
Description copied from interface: DocumentEventRecorder
Records the given document event.

Specified by:
recordEvent in interface DocumentEventRecorder
Parameters:
event - The document event to record.
See Also:
DocumentEventRecorder.recordEvent(org.ujac.print.DocumentEvent)


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