org.ujac.print
Class BaseDocumentTag

java.lang.Object
  extended by org.ujac.print.BaseDocumentTag
Direct Known Subclasses:
AddColumnTag, AddRowTag, AlterColumnTag, AssertTag, AttributeTag, BaseCellTag, BaseCustomTag, BaseElementTag, BaseGraphicsTag, CellTag, ColorDefTag, CustomTagTag, DateFormatTag, DefineColumnTag, DefineTableTag, DocumentTag, DynamicContentContainer, EncryptionTag, ExtraRowTag, FontDefTag, GraphicsTag, HeaderFooterPartTag, ImportTag, InsertColumnTag, InsertDocumentTag, ItemsTag, ItemTag, JavascriptTag, LogTag, MacroDefTag, MacroTag, MetaTag, ModuleTag, NewPageTag, NumberFormatTag, OptionTag, OutlineTag, OverlayTag, PageFormatTag, ParameterDefTag, ParameterTag, PdfCellBlockTag, PdfTableHeaderTag, PdfTableRowTag, PdfTableSplitTag, PrintRowTag, RegisterFontTag, RegisterTagTag, RemoveColumnTag, ResourceBundleTag, SetFieldTag, SetFormatTag, SetPropertyTag, StickyTag, StyleDefTag, SwitchTag, TextChartItemTag, TogglePropertyTag, ViewerPreferencesTag

public abstract class BaseDocumentTag
extends Object

Name: BaseDocumentTag
Description: Base implementation for tags, processed by the DocumentHandler class.

Author:
lauerc

Field Summary
protected  String actualContent
          The item's actual content, used for debugging issues.
protected  Attributes attributes
          The item's attributes.
protected  Condition condition
          The condition.
protected  StringBuffer content
          The item's content.
protected  Map customAttributes
          The item's custom attributes.
static DocumentFont DEFAULT_FONT
          The default font.
static Color DEFAULT_FONT_COLOR
          The default font color.
static String DEFAULT_FONT_ENCODING
          The default font encoding.
static String DEFAULT_FONT_FAMILY
          The default font family.
static float DEFAULT_FONT_SIZE
          The default font size.
static int DEFAULT_FONT_STYLE
          The default font style.
static float DEFAULT_LEADING
          The default fixed vertical leading distance.
static float DEFAULT_LINE_SPACING
          The factor by which to multiply the font size to get the default leading.
protected  int depth
          The item's depth in the document tree.
protected  DocumentHandler documentHandler
          The document handler.
static String IMAGE_CHUNK_ATTR
          The IMAGE chunk attribute.
protected  org.apache.commons.logging.Log log
          The logger.
static String NUMBER_OF_PAGES_TEMPLATES
          The resource name of the number of pages template.
protected  BaseDocumentTag parentItem
          The parent item.
protected  BaseDocumentTag previousItem
          The previous item.
protected  StyleHolder styleParent
          The parent style holder.
protected  AttributeDefinitionMap supportedAttributeMap
          The supported attribute map.
protected  ChildDefinitionMap supportedChildMap
          The supported child map.
protected  AttributeDefinitionMap supportedStyleAttributeMap
          The supported attribute map.
protected  DocumentTagFactory tagFactory
          The tag factory.
 
Constructor Summary
BaseDocumentTag()
          Constructs a BaseDocumentTag instance with no specific attributes.
BaseDocumentTag(String name)
          Constructs a BaseDocumentTag instance with specific attributes.
 
Method Summary
protected  void addAttributeDefinition(AttributeDefinition definition)
          Adds the given attribute definition to the set of supported attributes.
 com.lowagie.text.Phrase addChunk(BaseDocumentTag tag, com.lowagie.text.Phrase phrase, String chunk, DocumentFont font, float fixedLeading, float lineSpacing)
          Adds the given chunk to the root phrase.
 com.lowagie.text.Phrase addChunk(com.lowagie.text.Phrase phrase, com.lowagie.text.Chunk chunk, float fixedLeading, float lineSpacing)
          Adds the given chunk to the root phrase.
 com.lowagie.text.Phrase addChunk(com.lowagie.text.Phrase phrase, float fixedLeading, float lineSpacing)
          Adds the current content to the given root phrase while taking care of ${pageCount} expressions.
 void addContent(char[] content, int offset, int length)
          Adds the specified subset of the given character array to the content buffer.
 void addContent(String content)
          Adds the given String to the content buffer.
protected  void addStyleAttributeDefinition(AttributeDefinition definition)
          Adds the given attribute definition to the set of supported attributes.
protected  void addToLatestCellContainer(com.lowagie.text.Cell cell)
          Adds the cell at the latest parent item.
protected  void addToLatestElementContainer(com.lowagie.text.Element element)
          Adds the element at the latest parent item.
protected  void addToLatestPdfCellContainer(com.lowagie.text.pdf.PdfPCell cell)
          Adds the cell at the latest parent item.
protected  AttributeDefinitionMap buildSupportedAttributes()
          Builds the map of supported attributes.
protected  ChildDefinitionMap buildSupportedChilds()
          Builds the map of supported child definitions.
protected  AttributeDefinitionMap buildSupportedStyleAttributes()
          Builds the map of supported style attributes.
protected  void checkAttributes()
          Checks for unsupported attributes.
 void closeItem()
          Closes the item.
protected  Color colorFromString(String attrName, Object color, boolean evaluate)
          Gets the color from the given String.
protected  com.lowagie.text.Chunk createChunk(String text, DocumentFont font)
          Creates a new chunk.
protected  DocumentFont createFont(String family, String encoding, float size, int style, float textRise, Color color)
          Creates the item's font according to the item's attributes.
protected  com.lowagie.text.pdf.PdfTemplate ensureNumberOfPagesTemplate(DocumentFont font, com.lowagie.text.pdf.PdfContentByte cb)
          Ensures the 'number of pages' template for the given font.
 Object evalAttribute(AttributeDefinition attrDef)
          Gets the value for the given attribute definition.
 Object evalAttribute(String name)
          Gets the value for the given attribute's name.
protected  void extendLeading(com.lowagie.text.Phrase phrase, com.lowagie.text.Chunk extender, float fixedLeading, float lineSpacing)
          Extends the leading of the given phrase.
protected  void extendLeading(com.lowagie.text.Phrase phrase, float leading)
          Extends the leading of the given phrase.
protected  void extendLeading(com.lowagie.text.Phrase phrase, com.lowagie.text.Font font, float fixedLeading, float lineSpacing)
          Extends the leading of the given phrase.
protected  void extendLeading(com.lowagie.text.Phrase phrase, com.lowagie.text.Phrase extender)
          Extends the leading of the given phrase.
protected  void filterContents(BaseDocumentTag tag, String contents, StringBuffer buffer, boolean trimHead)
          Processes the escape sequences from the given content string and writes the result into the given buffer.
 void flushContent()
          Flushes the content buffer.
 String getActualContent()
          Gets the actual content.
 Object getAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef, TypedAttributeHandler attrHandler)
          Gets the value for the given attribute's name.
 Object getAttribute(AttributeDefinition attrDef, Object defaultValue, boolean evaluate, AttributeDefinition styleAttrDef, TypedAttributeHandler attrHandler)
          Gets the value for the given attribute's name.
 AttributeDefinition getAttributeDefinition(String name)
          Gets the attribute definition for the given name
 AttributeHandler getAttributeHandler()
          Getter method for the the property attributeHandler.
 Attributes getAttributes()
          Gets the item's attributes.
 Color getBackgroundColor()
          Getter method for the the property backgroundColor.
 boolean getBooleanAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the boolean value for the given attribute's name.
 boolean getBooleanAttribute(AttributeDefinition attrDef, boolean defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the boolean value for the given attribute's name.
 int getBorderAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the border value for the given attribute's name.
 int getBorderAttribute(AttributeDefinition attrDef, int defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the border value for the given attribute's name.
 Color getColorAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the color value for the given attribute's name.
 Color getColorAttribute(AttributeDefinition attrDef, Color defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the color value for the given attribute's name.
 CommonAttributesHolder getCommonAttributesHolder()
          Gets the element container.
 String getContent()
          Gets the current content.
 Map getCustomAttributes()
          Gets the item's custom attributes.
 int getDepth()
          Gets the item's depth in the document tree.
abstract  String getDescription()
          Gets a description for the item.
 float getDimensionAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the dimension value for the given attribute's name.
 float getDimensionAttribute(AttributeDefinition attrDef, float defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the dimension value for the given attribute's name.
 float getDimensionAttribute(AttributeDefinition attrDef, Float defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the dimension value for the given attribute's name.
 DocumentHandler getDocumentHandler()
          Gets the document handler.
 String getExamples()
          Gets examples for the item.
 float getFloatAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the float value for the given attribute's name.
 float getFloatAttribute(AttributeDefinition attrDef, float defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the float value for the given attribute's name.
 DocumentFont getFont()
          Gets the font from the surrounding FontHolder tag.
 int getHorizontalAlignmentAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the horizontal alignment value for the given attribute's name.
 int getHorizontalAlignmentAttribute(AttributeDefinition attrDef, int defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the horizontal alignment value for the given attribute's name.
 int getIntegerAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the integer value for the given attribute's name.
 int getIntegerAttribute(AttributeDefinition attrDef, int defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the integer value for the given attribute's name.
 Object getLocalAttribute(String name, boolean evaluate)
          Gets the local value for the given attribute's name.
 DocumentFont getLocalFont()
          Gets the locally defined font.
 Object getLocalStyleAttribute(String name)
          Gets the style attribute with the given name.
 String getName()
          Gets the item's name.
 BaseDocumentTag getParentItem()
          Gets the parent item.
protected  String getPhraseContent(com.lowagie.text.Phrase item)
          Gets the content of the given phrase.
protected  float getPhraseHeight(com.lowagie.text.Phrase item)
          Gets the height of the given phrase.
protected  float getPhraseWidth(com.lowagie.text.Phrase item)
          Gets the width of the given phrase.
 BaseDocumentTag getPreviousItem()
          Gets the previous item.
 String getRawAttribute(String name)
          Gets the raw value for the given attribute's name.
 List getSortedAttributeDefinitions()
          Gets the sorted list of supported attributes.
 List getSortedStyleAttributeDefinitions()
          Gets the sorted list of supported style attributes.
 String getStringAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the value for the given attribute's name.
 String getStringAttribute(AttributeDefinition attrDef, String defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the value for the given attribute's name.
 String getStringAttribute(String attrName, String defaultValue, boolean evaluate, String styleAttrName)
          Gets the value for the given attribute's name.
 String getStyle()
          Gets the inline style attributes.
 Object getStyleAttribute(AttributeDefinition styleAttrDef)
          Gets the style attribute with the given name.
 Object getStyleAttribute(String name)
          Gets the style attribute with the given name.
 AttributeDefinition getStyleAttributeDefinition(String name)
          Gets the attribute definition for the given name
 Map getStyleAttributes()
          Gets the style attribute with the given name.
 String getStyleClass()
          Gets the style class.
 AttributeDefinitionMap getSupportedAttributes()
          Gets the map of supported attributes.
 ChildDefinitionMap getSupportedChilds()
          Gets the list of supported childs.
 List getSupportedChildTags()
          Finds the supported child tags from the DocumentTagFactory using the informations from the methods getSupportedChilds and getExcludedChilds.
 AttributeDefinitionMap getSupportedStyleAttributes()
          Gets the map of supported style attributes.
 DocumentTagFactory getTagFactory()
          Gets the document tag factory.
 String getTextAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the value for the given attribute's name.
 String getTextAttribute(AttributeDefinition attrDef, String defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the value for the given attribute's name.
 String getTrimmedContent()
          Gets the trimmed content.
 int getVerticalAlignmentAttribute(AttributeDefinition attrDef, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the vertical alignment value for the given attribute's name.
 int getVerticalAlignmentAttribute(AttributeDefinition attrDef, int defaultValue, boolean evaluate, AttributeDefinition styleAttrDef)
          Gets the vertical alignment value for the given attribute's name.
 void handleContent(PhraseHolder phraseHolder)
          Adds the current content to the given PhraseHolder while taking care of ${pageCount} expressions.
protected  void handleFontAttributes()
          Handles the font attributes.
 boolean hasContent()
          Gets the current content.
 void initialize()
          Initializes the item.
protected  String int2FontStyle(int fontStyle)
          Gets the font style from the given integer.
 boolean isAttributeDefined(AttributeDefinition attrDef)
          Checks whether the given attribute is defined or not.
 boolean isAttributeDefined(AttributeDefinition attrDef, AttributeDefinition styleAttrDef)
          Checks whether the given attribute is defined or not.
 boolean isAttributeDefined(String name)
          Checks whether the given attribute is defined or not.
 boolean isAttributeDefined(String name, String styleName)
          Checks whether the given attribute is defined or not.
 boolean isAttributeSupported(AttributeDefinition attrDef)
          Checks, if the given attribute is supported.
 boolean isAttributeSupported(AttributeDefinition attrDef, AttributeDefinition styleAttrDef)
          Checks, if the given attribute or style attribute is supported.
 boolean isAttributeSupported(String name)
          Checks, if the given attribute is supported.
 boolean isAttributeSupported(String name, String styleName)
          Checks, if the given attribute or style attribute is supported.
 boolean isDocumentRoot()
          Is the item a possible document root tag, such as <document> or <module>.
protected  boolean isEmptyContent()
          Checks if the content contains no or no real data.
protected  boolean isEmptyString(String text)
          Checks if the given string contains no or no real data.
protected  boolean isIgnoreFlush()
          Gets the ignore flush flag.
 boolean isItemClosed()
          Gets the item closed flag.
 boolean isItemOpened()
          Gets the item opened flag.
protected  boolean isPhraseEmpty(com.lowagie.text.Phrase phrase)
          Tells whether the given phrase is empty or not.
protected  boolean isRendered()
          Tells whether or not this tag is rendered.
 boolean isStructureChecksDisabled()
          Tells whether or not to disable checks which test if this tag fits into its parent tag.
 boolean isStyleable()
          Tells whether or not this tag does respect style attributes or not.
 boolean isStyleAttributeDefined(String name)
          Checks whether the given attribute is defined or not.
 boolean isTextBodyAllowed()
          Tells whether textual content is allowed for the tag or not.
 boolean isTrimBody()
          Getter method for the the property trimBody.
 boolean isTrimNextHead()
          Gets the 'trim next head' flag.
protected  boolean isValid()
          Checks whether the condition is valid or not.
 boolean isVirtualContainer()
          Is the item virtual container, such as <if>, <else> or <foreach>.
 Locator locator()
          Gets the document locator, which describes the position of this item.
 void openItem()
          Opens the item.
 void preInitialize()
          Pre-initializes the item.
protected  void printPhrase(com.lowagie.text.pdf.PdfTemplate template, com.lowagie.text.Phrase phrase, float xPos, float yPos)
          Prints a phrase into the given template.
 com.lowagie.text.Phrase processContents(BaseDocumentTag tag, com.lowagie.text.Phrase phrase, String contents, DocumentFont font, float fixedLeading, float lineSpacing)
          Processes the given contents an adds the computed elements to the given phrase.
 com.lowagie.text.Phrase processContents(float fixedLeading, float lineSpacing)
          Creates a chunk for the current content.
 void resetContent()
          Clears the current content.
protected  com.lowagie.text.Phrase rotatePhrase(com.lowagie.text.Phrase phrase, float rotate)
          Rotates the given phrase.
protected  void setAttributes(Attributes attributes)
          Sets the item's attributes.
protected  void setBackgroundColor(Color backgroundColor)
          Setter method for the the property backgroundColor.
 void setCustomAttributes(Map customAttributes)
          Sets the item's custom attributes.
protected  void setDepth(int depth)
          Sets the item's depht in the document tree.
protected  void setDocumentHandler(DocumentHandler documentHandler)
          Sets the document handler.
 void setItemClosed(boolean itemClosed)
          Sets the item closed flag.
 void setItemOpened(boolean itemOpened)
          Sets the item opened flag.
protected  void setLocalFont(DocumentFont localFont)
          Sets the local font.
protected  void setLocalFont(String fontDef)
          Sets the local font.
protected  void setName(String name)
          Sets the item's name.
 void setParentItem(BaseDocumentTag item)
          Sets the parent item.
protected  void setPreviousItem(BaseDocumentTag item)
          Sets the previous item.
protected  void setTagFactory(DocumentTagFactory tagFactory)
          Sets the document tag factory.
 void setTrimBody(boolean trimBody)
          Setter method for the the property trimBody.
 void setTrimNextHead(boolean trimNextHead)
          Sets the 'trim next head' flag in dependency of the 'trim body' flag.
protected  void trimContentHead()
          Trims off the heading white spaces of the content buffer.
protected  void trimContentTail()
          Trims off the trailing white spaces of the content buffer.
protected  Object typeCastValue(String text, String type)
          Gets a well typed value for the given one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGE_CHUNK_ATTR

public static final String IMAGE_CHUNK_ATTR
The IMAGE chunk attribute.

See Also:
Constant Field Values

NUMBER_OF_PAGES_TEMPLATES

public static final String NUMBER_OF_PAGES_TEMPLATES
The resource name of the number of pages template.

See Also:
Constant Field Values

DEFAULT_FONT_FAMILY

public static final String DEFAULT_FONT_FAMILY
The default font family.

See Also:
Constant Field Values

DEFAULT_FONT_ENCODING

public static final String DEFAULT_FONT_ENCODING
The default font encoding.

See Also:
Constant Field Values

DEFAULT_FONT_SIZE

public static final float DEFAULT_FONT_SIZE
The default font size.

See Also:
Constant Field Values

DEFAULT_FONT_COLOR

public static final Color DEFAULT_FONT_COLOR
The default font color.


DEFAULT_FONT_STYLE

public static final int DEFAULT_FONT_STYLE
The default font style.

See Also:
Constant Field Values

DEFAULT_FONT

public static DocumentFont DEFAULT_FONT
The default font.


DEFAULT_LEADING

public static final float DEFAULT_LEADING
The default fixed vertical leading distance.

See Also:
Constant Field Values

DEFAULT_LINE_SPACING

public static final float DEFAULT_LINE_SPACING
The factor by which to multiply the font size to get the default leading.

See Also:
Constant Field Values

log

protected org.apache.commons.logging.Log log
The logger.


documentHandler

protected DocumentHandler documentHandler
The document handler.


tagFactory

protected DocumentTagFactory tagFactory
The tag factory.


depth

protected int depth
The item's depth in the document tree.


supportedAttributeMap

protected AttributeDefinitionMap supportedAttributeMap
The supported attribute map.


supportedStyleAttributeMap

protected AttributeDefinitionMap supportedStyleAttributeMap
The supported attribute map.


supportedChildMap

protected ChildDefinitionMap supportedChildMap
The supported child map.


attributes

protected Attributes attributes
The item's attributes.


customAttributes

protected Map customAttributes
The item's custom attributes.


actualContent

protected String actualContent
The item's actual content, used for debugging issues.


content

protected StringBuffer content
The item's content.


parentItem

protected BaseDocumentTag parentItem
The parent item.


previousItem

protected BaseDocumentTag previousItem
The previous item.


condition

protected Condition condition
The condition.


styleParent

protected StyleHolder styleParent
The parent style holder.

Constructor Detail

BaseDocumentTag

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


BaseDocumentTag

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

Parameters:
name - The tag name.
Method Detail

getName

public String getName()
Gets the item's name.

Returns:
The item's name.

setName

protected void setName(String name)
Sets the item's name.

Parameters:
name - The name to set.

getDescription

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

Returns:
The item's description.

getExamples

public String getExamples()
Gets examples for the item.

Returns:
one ore more examples for the item's usage..

getSupportedAttributes

public AttributeDefinitionMap getSupportedAttributes()
Gets the map of supported attributes.

Returns:
The attribute definitions.

getSupportedStyleAttributes

public AttributeDefinitionMap getSupportedStyleAttributes()
Gets the map of supported style attributes.

Returns:
The attribute definitions.

getSupportedChilds

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

Returns:
The child definitions.

buildSupportedAttributes

protected AttributeDefinitionMap buildSupportedAttributes()
Builds the map of supported attributes.

Returns:
The attribute definitions.

buildSupportedStyleAttributes

protected AttributeDefinitionMap buildSupportedStyleAttributes()
Builds the map of supported style attributes.

Returns:
The attribute definitions.

buildSupportedChilds

protected ChildDefinitionMap buildSupportedChilds()
Builds the map of supported child definitions.

Returns:
The child definitions.

getSortedAttributeDefinitions

public List getSortedAttributeDefinitions()
Gets the sorted list of supported attributes.

Returns:
The attribute definitions.

getSortedStyleAttributeDefinitions

public List getSortedStyleAttributeDefinitions()
Gets the sorted list of supported style attributes.

Returns:
The attribute definitions.

isVirtualContainer

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

Returns:
true if the item is such a container, else false.

isDocumentRoot

public boolean isDocumentRoot()
Is the item a possible document root tag, such as <document> or <module>.

Returns:
true if the item is a possible root tag, else false.

isTextBodyAllowed

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

Returns:
true if the item is allowed to contain textual content, else false.

isStructureChecksDisabled

public boolean isStructureChecksDisabled()
Tells whether or not to disable checks which test if this tag fits into its parent tag. This method should be overwritten by custom classes which extent the default tag base of UJAC.

Returns:
true if structure checks are disabled for this tag.

getSupportedChildTags

public List getSupportedChildTags()
                           throws TagInstantiationException
Finds the supported child tags from the DocumentTagFactory using the informations from the methods getSupportedChilds and getExcludedChilds.

Returns:
The child definitions.
Throws:
TagInstantiationException - In case the method DocumentTagFactory.getAllPossibleChilds failed.

getDocumentHandler

public DocumentHandler getDocumentHandler()
Gets the document handler.

Returns:
The document handler.

setDocumentHandler

protected void setDocumentHandler(DocumentHandler documentHandler)
Sets the document handler.

Parameters:
documentHandler - The document handler to set.

getTagFactory

public DocumentTagFactory getTagFactory()
Gets the document tag factory.

Returns:
The document tag factory.

setTagFactory

protected void setTagFactory(DocumentTagFactory tagFactory)
Sets the document tag factory.

Parameters:
tagFactory - The document tag factory to set.

getDepth

public int getDepth()
Gets the item's depth in the document tree.

Returns:
The item's depth.

setDepth

protected void setDepth(int depth)
Sets the item's depht in the document tree.

Parameters:
depth - The depth to set.

getAttributes

public Attributes getAttributes()
Gets the item's attributes.

Returns:
The item's attributes.

setAttributes

protected void setAttributes(Attributes attributes)
Sets the item's attributes.

Parameters:
attributes - The attributes to set.

getCustomAttributes

public Map getCustomAttributes()
Gets the item's custom attributes.

Returns:
The item's custom attributes.

setCustomAttributes

public void setCustomAttributes(Map customAttributes)
Sets the item's custom attributes.

Parameters:
customAttributes - The custom attributes to set.

getParentItem

public BaseDocumentTag getParentItem()
Gets the parent item.

Returns:
The parent item.

setParentItem

public void setParentItem(BaseDocumentTag item)
Sets the parent item.

Parameters:
item - The parent item to set.

getPreviousItem

public BaseDocumentTag getPreviousItem()
Gets the previous item.

Returns:
The previous item.

setPreviousItem

protected void setPreviousItem(BaseDocumentTag item)
Sets the previous item.

Parameters:
item - The previous item to set.

setItemOpened

public void setItemOpened(boolean itemOpened)
Sets the item opened flag.

Parameters:
itemOpened - The item opened flag to set.

isItemOpened

public boolean isItemOpened()
Gets the item opened flag.

Returns:
The item opened flag.

isTrimBody

public boolean isTrimBody()
Getter method for the the property trimBody.

Returns:
The current value of property trimBody.

setTrimBody

public void setTrimBody(boolean trimBody)
Setter method for the the property trimBody.

Parameters:
trimBody - The value to set for the property trimBody.

setTrimNextHead

public void setTrimNextHead(boolean trimNextHead)
Sets the 'trim next head' flag in dependency of the 'trim body' flag.

Parameters:
trimNextHead - The 'trim next head' flag to set.

isTrimNextHead

public boolean isTrimNextHead()
Gets the 'trim next head' flag.

Returns:
The 'trim next head' flag.

setItemClosed

public void setItemClosed(boolean itemClosed)
Sets the item closed flag.

Parameters:
itemClosed - The item closed flag to set.

isItemClosed

public boolean isItemClosed()
Gets the item closed flag.

Returns:
The item closed flag.

locator

public Locator locator()
Gets the document locator, which describes the position of this item.

Returns:
This item's locator.

preInitialize

public void preInitialize()
                   throws DocumentHandlerException
Pre-initializes the item.

Throws:
DocumentHandlerException - If something went badly wrong.

initialize

public void initialize()
                throws DocumentHandlerException
Initializes the item.

Throws:
DocumentHandlerException - If something went badly wrong.

checkAttributes

protected void checkAttributes()
                        throws TagAttributeException
Checks for unsupported attributes.

Throws:
TagAttributeException - If an unsupported attribute was detected.

resetContent

public void resetContent()
Clears the current content.


addContent

public void addContent(char[] content,
                       int offset,
                       int length)
Adds the specified subset of the given character array to the content buffer.

Parameters:
content - The given content.
offset - The offset from which to add the content.
length - The number of characters to copy.

addContent

public void addContent(String content)
Adds the given String to the content buffer.

Parameters:
content - The content to add.

hasContent

public boolean hasContent()
Gets the current content.

Returns:
The current content as StringBuffer.

getContent

public String getContent()
Gets the current content.

Returns:
The current content as StringBuffer.

getActualContent

public String getActualContent()
Gets the actual content. This method is intended for testing purposes.

Returns:
The last content.

getTrimmedContent

public String getTrimmedContent()
Gets the trimmed content.

Returns:
The current content as trimmed String.

flushContent

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

Throws:
DocumentHandlerException - In case a problem occured while processing the content.

trimContentHead

protected void trimContentHead()
Trims off the heading white spaces of the content buffer.


trimContentTail

protected void trimContentTail()
Trims off the trailing white spaces of the content buffer.


isIgnoreFlush

protected boolean isIgnoreFlush()
Gets the ignore flush flag.

Returns:
The ignore flush flag.

isAttributeSupported

public boolean isAttributeSupported(String name)
Checks, if the given attribute is supported.

Parameters:
name - The attribute name.
Returns:
true if the attribute is supported, else false.

isAttributeSupported

public boolean isAttributeSupported(AttributeDefinition attrDef)
Checks, if the given attribute is supported.

Parameters:
attrDef - The attribute definition.
Returns:
true if the attribute is supported, else false.

isAttributeSupported

public boolean isAttributeSupported(String name,
                                    String styleName)
Checks, if the given attribute or style attribute is supported.

Parameters:
name - The attribute name.
styleName - The style attribute name.
Returns:
true if the attribute is supported, else false.

isAttributeSupported

public boolean isAttributeSupported(AttributeDefinition attrDef,
                                    AttributeDefinition styleAttrDef)
Checks, if the given attribute or style attribute is supported.

Parameters:
attrDef - The attribute definition.
styleAttrDef - The style attribute definition.
Returns:
true if the attribute is supported, else false.

getAttributeDefinition

public AttributeDefinition getAttributeDefinition(String name)
Gets the attribute definition for the given name

Parameters:
name - The attribute name.
Returns:
The attribute definition.

addAttributeDefinition

protected void addAttributeDefinition(AttributeDefinition definition)
Adds the given attribute definition to the set of supported attributes.

Parameters:
definition - The attribute definition to register with the tag.

isAttributeDefined

public boolean isAttributeDefined(AttributeDefinition attrDef)
Checks whether the given attribute is defined or not.

Parameters:
attrDef - The attribute definition.
Returns:
true, if the attribute is defined or not.

isAttributeDefined

public boolean isAttributeDefined(String name)
Checks whether the given attribute is defined or not.

Parameters:
name - The attribute's name.
Returns:
true, if the attribute is defined or not.

isAttributeDefined

public boolean isAttributeDefined(String name,
                                  String styleName)
Checks whether the given attribute is defined or not.

Parameters:
name - The attribute's name.
styleName - The according style name.
Returns:
true, if the attribute is defined or not.

isAttributeDefined

public boolean isAttributeDefined(AttributeDefinition attrDef,
                                  AttributeDefinition styleAttrDef)
Checks whether the given attribute is defined or not.

Parameters:
attrDef - The attribute definition.
styleAttrDef - The style attribute definition.
Returns:
true, if the attribute is defined or not.

getStyleAttributeDefinition

public AttributeDefinition getStyleAttributeDefinition(String name)
Gets the attribute definition for the given name

Parameters:
name - The attribute name.
Returns:
The attribute definition.

addStyleAttributeDefinition

protected void addStyleAttributeDefinition(AttributeDefinition definition)
Adds the given attribute definition to the set of supported attributes.

Parameters:
definition - The attribute definition to register with the tag.

isStyleAttributeDefined

public boolean isStyleAttributeDefined(String name)
Checks whether the given attribute is defined or not.

Parameters:
name - The attribute's name.
Returns:
true, if the attribute is defined or not.

evalAttribute

public Object evalAttribute(String name)
                     throws TagAttributeException
Gets the value for the given attribute's name.

Parameters:
name - The attribute's name.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getRawAttribute

public String getRawAttribute(String name)
                       throws TagAttributeException
Gets the raw value for the given attribute's name.

Parameters:
name - The attribute's name.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

evalAttribute

public Object evalAttribute(AttributeDefinition attrDef)
                     throws TagAttributeException
Gets the value for the given attribute definition.

Parameters:
attrDef - The attribute definition.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getAttribute

public Object getAttribute(AttributeDefinition attrDef,
                           boolean evaluate,
                           AttributeDefinition styleAttrDef,
                           TypedAttributeHandler attrHandler)
                    throws TagAttributeException
Gets the value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The style attribute to consider.
attrHandler - The attribute handler to use.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getAttribute

public Object getAttribute(AttributeDefinition attrDef,
                           Object defaultValue,
                           boolean evaluate,
                           AttributeDefinition styleAttrDef,
                           TypedAttributeHandler attrHandler)
                    throws TagAttributeException
Gets the value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The style attribute to consider.
attrHandler - The attribute handler to use.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getLocalAttribute

public Object getLocalAttribute(String name,
                                boolean evaluate)
                         throws TagAttributeException
Gets the local value for the given attribute's name.

Parameters:
name - The attribute's name.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

isStyleable

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

Returns:
always false as default.

getStyleAttribute

public Object getStyleAttribute(String name)
                         throws TagAttributeException
Gets the style attribute with the given name.

Parameters:
name - The name of the style attribute to get.
Returns:
The style value or null, if not defined.
Throws:
TagAttributeException - In case the tag attribute evaluation failed.

getStyleAttribute

public Object getStyleAttribute(AttributeDefinition styleAttrDef)
                         throws TagAttributeException
Gets the style attribute with the given name.

Parameters:
styleAttrDef - The definition of the style attribute to get.
Returns:
The style value or null, if not defined.
Throws:
TagAttributeException - In case the tag attribute evaluation failed.

getLocalStyleAttribute

public Object getLocalStyleAttribute(String name)
                              throws TagAttributeException
Gets the style attribute with the given name.

Parameters:
name - The name of the style attribute to get.
Returns:
The style value or null, if not defined.
Throws:
TagAttributeException - In case the tag attribute evaluation failed.

getStyleAttributes

public Map getStyleAttributes()
Gets the style attribute with the given name.

Parameters:
name - The name of the style attribute to get.
Returns:
The style value or null, if not defined.
Throws:
TagAttributeException - In case the tag attribute evaluation failed.

getAttributeHandler

public AttributeHandler getAttributeHandler()
Getter method for the the property attributeHandler.

Returns:
The current value of property attributeHandler.

getTextAttribute

public String getTextAttribute(AttributeDefinition attrDef,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the value for the given attribute's name. Works like method getStringAttribute(java.lang.String, boolean) but takes care of escape sequences.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getTextAttribute

public String getTextAttribute(AttributeDefinition attrDef,
                               String defaultValue,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the value for the given attribute's name. Works like method getStringAttribute(java.lang.String, java.lang.String, boolean) but takes care of escape sequences.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getStringAttribute

public String getStringAttribute(AttributeDefinition attrDef,
                                 boolean evaluate,
                                 AttributeDefinition styleAttrDef)
                          throws TagAttributeException
Gets the value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getStringAttribute

public String getStringAttribute(AttributeDefinition attrDef,
                                 String defaultValue,
                                 boolean evaluate,
                                 AttributeDefinition styleAttrDef)
                          throws TagAttributeException
Gets the value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getStringAttribute

public String getStringAttribute(String attrName,
                                 String defaultValue,
                                 boolean evaluate,
                                 String styleAttrName)
                          throws TagAttributeException
Gets the value for the given attribute's name.

Parameters:
attrName - The attribute name.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrName - The name of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getFloatAttribute

public float getFloatAttribute(AttributeDefinition attrDef,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the float value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getFloatAttribute

public float getFloatAttribute(AttributeDefinition attrDef,
                               float defaultValue,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the float value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getDimensionAttribute

public float getDimensionAttribute(AttributeDefinition attrDef,
                                   boolean evaluate,
                                   AttributeDefinition styleAttrDef)
                            throws TagAttributeException
Gets the dimension value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getDimensionAttribute

public float getDimensionAttribute(AttributeDefinition attrDef,
                                   float defaultValue,
                                   boolean evaluate,
                                   AttributeDefinition styleAttrDef)
                            throws TagAttributeException
Gets the dimension value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getDimensionAttribute

public float getDimensionAttribute(AttributeDefinition attrDef,
                                   Float defaultValue,
                                   boolean evaluate,
                                   AttributeDefinition styleAttrDef)
                            throws TagAttributeException
Gets the dimension value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getIntegerAttribute

public int getIntegerAttribute(AttributeDefinition attrDef,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the integer value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getIntegerAttribute

public int getIntegerAttribute(AttributeDefinition attrDef,
                               int defaultValue,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the integer value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getBooleanAttribute

public boolean getBooleanAttribute(AttributeDefinition attrDef,
                                   boolean evaluate,
                                   AttributeDefinition styleAttrDef)
                            throws TagAttributeException
Gets the boolean value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getBooleanAttribute

public boolean getBooleanAttribute(AttributeDefinition attrDef,
                                   boolean defaultValue,
                                   boolean evaluate,
                                   AttributeDefinition styleAttrDef)
                            throws TagAttributeException
Gets the boolean value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

getColorAttribute

public Color getColorAttribute(AttributeDefinition attrDef,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the color value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getColorAttribute

public Color getColorAttribute(AttributeDefinition attrDef,
                               Color defaultValue,
                               boolean evaluate,
                               AttributeDefinition styleAttrDef)
                        throws TagAttributeException
Gets the color value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getBorderAttribute

public int getBorderAttribute(AttributeDefinition attrDef,
                              boolean evaluate,
                              AttributeDefinition styleAttrDef)
                       throws TagAttributeException
Gets the border value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value (default is NO_BORDER).
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getBorderAttribute

public int getBorderAttribute(AttributeDefinition attrDef,
                              int defaultValue,
                              boolean evaluate,
                              AttributeDefinition styleAttrDef)
                       throws TagAttributeException
Gets the border value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value (default is NO_BORDER).
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getHorizontalAlignmentAttribute

public int getHorizontalAlignmentAttribute(AttributeDefinition attrDef,
                                           boolean evaluate,
                                           AttributeDefinition styleAttrDef)
                                    throws TagAttributeException
Gets the horizontal alignment value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getHorizontalAlignmentAttribute

public int getHorizontalAlignmentAttribute(AttributeDefinition attrDef,
                                           int defaultValue,
                                           boolean evaluate,
                                           AttributeDefinition styleAttrDef)
                                    throws TagAttributeException
Gets the horizontal alignment value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getVerticalAlignmentAttribute

public int getVerticalAlignmentAttribute(AttributeDefinition attrDef,
                                         boolean evaluate,
                                         AttributeDefinition styleAttrDef)
                                  throws TagAttributeException
Gets the vertical alignment value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getVerticalAlignmentAttribute

public int getVerticalAlignmentAttribute(AttributeDefinition attrDef,
                                         int defaultValue,
                                         boolean evaluate,
                                         AttributeDefinition styleAttrDef)
                                  throws TagAttributeException
Gets the vertical alignment value for the given attribute's name.

Parameters:
attrDef - The attribute definition.
defaultValue - The default value to use in case the attribute was not defined.
evaluate - If this flag is set to true, the attribute will get evaluated.
styleAttrDef - The definition of the style to consider.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

openItem

public void openItem()
              throws DocumentHandlerException
Opens the item.

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

handleFontAttributes

protected void handleFontAttributes()
                             throws DocumentHandlerException
Handles the font attributes.

Throws:
DocumentHandlerException

int2FontStyle

protected String int2FontStyle(int fontStyle)
Gets the font style from the given integer.

Parameters:
fontStyle - The font style to transform into text.
Returns:
The font style as textual attribute.

closeItem

public void closeItem()
               throws DocumentHandlerException
Closes the item.

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

addChunk

public com.lowagie.text.Phrase addChunk(com.lowagie.text.Phrase phrase,
                                        float fixedLeading,
                                        float lineSpacing)
                                 throws DocumentHandlerException
Adds the current content to the given root phrase while taking care of ${pageCount} expressions.

Parameters:
phrase - The phrase to add the content to.
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.
Returns:
The phrase to which the chunk was added.
Throws:
DocumentHandlerException - In case the document processing failed.

handleContent

public void handleContent(PhraseHolder phraseHolder)
                   throws DocumentHandlerException
Adds the current content to the given PhraseHolder while taking care of ${pageCount} expressions.

Parameters:
phraseHolder - The PhraseHolder to submit the content to.
Throws:
DocumentHandlerException - In case the content processing failed.

addChunk

public com.lowagie.text.Phrase addChunk(com.lowagie.text.Phrase phrase,
                                        com.lowagie.text.Chunk chunk,
                                        float fixedLeading,
                                        float lineSpacing)
Adds the given chunk to the root phrase.

Parameters:
phrase - The phrase to add the chunk to.
chunk - The chunk to add to the root phrase.
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.
Returns:
The phrase the chunk has been added to.

addChunk

public com.lowagie.text.Phrase addChunk(BaseDocumentTag tag,
                                        com.lowagie.text.Phrase phrase,
                                        String chunk,
                                        DocumentFont font,
                                        float fixedLeading,
                                        float lineSpacing)
                                 throws DocumentHandlerException
Adds the given chunk to the root phrase.

Parameters:
tag - The document tag instance.
phrase - The phrase to add the chunk to.
chunk - The chunk to add to the root phrase.
font - The font to use.
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.
Returns:
The phrase to which the chunk was added.
Throws:
DocumentHandlerException - In case the document processing failed.

processContents

public com.lowagie.text.Phrase processContents(float fixedLeading,
                                               float lineSpacing)
                                        throws DocumentHandlerException
Creates a chunk for the current content.

Parameters:
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.
Returns:
The created chunk.
Throws:
DocumentHandlerException - In case the document processing failed.

processContents

public com.lowagie.text.Phrase processContents(BaseDocumentTag tag,
                                               com.lowagie.text.Phrase phrase,
                                               String contents,
                                               DocumentFont font,
                                               float fixedLeading,
                                               float lineSpacing)
                                        throws DocumentHandlerException
Processes the given contents an adds the computed elements to the given phrase.

Parameters:
tag - The document tag.
phrase - The phrase to add the contents to. In case null is given, an empty phrase is created.
contents - The contents to process.
font - The font to use.
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.
Returns:
The phrase to which the chunk was added.
Throws:
DocumentHandlerException - In case the document processing failed.

filterContents

protected void filterContents(BaseDocumentTag tag,
                              String contents,
                              StringBuffer buffer,
                              boolean trimHead)
                       throws DocumentHandlerException
Processes the escape sequences from the given content string and writes the result into the given buffer.

Parameters:
tag - The tag used to tell the document position.
contents - The contents to parse for escape sequences
buffer - The buffer to write to.
trimHead - Tells whether or not to trim the leading white spaces
Throws:
DocumentHandlerException

extendLeading

protected void extendLeading(com.lowagie.text.Phrase phrase,
                             float leading)
Extends the leading of the given phrase.

Parameters:
phrase - The phrase to alter.
leading - The size up to which to extend the leading.

extendLeading

protected void extendLeading(com.lowagie.text.Phrase phrase,
                             com.lowagie.text.Font font,
                             float fixedLeading,
                             float lineSpacing)
Extends the leading of the given phrase.

Parameters:
phrase - The phrase to alter.
font - The font that wants to extend the leading of the given phrase.
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.

extendLeading

protected void extendLeading(com.lowagie.text.Phrase phrase,
                             com.lowagie.text.Chunk extender,
                             float fixedLeading,
                             float lineSpacing)
Extends the leading of the given phrase.

Parameters:
phrase - The phrase to alter.
extender - The chunk that wants to extend the leading of the given phrase.
fixedLeading - The fixed vertical leading distance.
lineSpacing - The line spacing factor.

extendLeading

protected void extendLeading(com.lowagie.text.Phrase phrase,
                             com.lowagie.text.Phrase extender)
Extends the leading of the given phrase.

Parameters:
phrase - The phrase to alter.
extender - The phrase that wants to extend the leading of the given phrase.

createChunk

protected com.lowagie.text.Chunk createChunk(String text,
                                             DocumentFont font)
Creates a new chunk.

Parameters:
text - The text for the chunk to be created.
font - The font to use.
Returns:
The created chunk.

colorFromString

protected Color colorFromString(String attrName,
                                Object color,
                                boolean evaluate)
                         throws TagAttributeException
Gets the color from the given String.

Parameters:
attrName - The attribute name.
color - The color given as String.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined color.
Throws:
TagAttributeException - In case the given string doesn't resolve to a color in the color map and is a invalid color code.

getFont

public DocumentFont getFont()
Gets the font from the surrounding FontHolder tag.

Returns:
The external font.

getLocalFont

public DocumentFont getLocalFont()
Gets the locally defined font.

Returns:
The locally defined font.

setLocalFont

protected void setLocalFont(DocumentFont localFont)
Sets the local font.

Parameters:
localFont - The local font to set.

setLocalFont

protected void setLocalFont(String fontDef)
                     throws TagAttributeException
Sets the local font.

Parameters:
fontDef - The name of the attribute that font definition to use.
Throws:
TagAttributeException - In case the given font does not exist.

getBackgroundColor

public Color getBackgroundColor()
Getter method for the the property backgroundColor.

Returns:
The current value of property backgroundColor.

setBackgroundColor

protected void setBackgroundColor(Color backgroundColor)
Setter method for the the property backgroundColor.

Parameters:
backgroundColor - The value to set for the property backgroundColor.

getStyleClass

public String getStyleClass()
Gets the style class.

Returns:
The current value of property styleClass.

getStyle

public String getStyle()
Gets the inline style attributes.

Returns:
The current value of property style.

addToLatestElementContainer

protected void addToLatestElementContainer(com.lowagie.text.Element element)
                                    throws DocumentHandlerException
Adds the element at the latest parent item.

Parameters:
element - The element to add at the parent.
Throws:
DocumentHandlerException - In case the inserting of the given element has failed.

addToLatestCellContainer

protected void addToLatestCellContainer(com.lowagie.text.Cell cell)
                                 throws DocumentHandlerException
Adds the cell at the latest parent item.

Parameters:
cell - The cell to add at the parent.
Throws:
DocumentHandlerException - In case the inserting of the given cell has failed.

addToLatestPdfCellContainer

protected void addToLatestPdfCellContainer(com.lowagie.text.pdf.PdfPCell cell)
                                    throws DocumentHandlerException
Adds the cell at the latest parent item.

Parameters:
cell - The cell to add at the parent.
Throws:
DocumentHandlerException - In case the inserting of the given cell has failed.

isEmptyContent

protected boolean isEmptyContent()
Checks if the content contains no or no real data.

Returns:
true if the content is null, has zero length or consists of whitespaces only.

isEmptyString

protected boolean isEmptyString(String text)
Checks if the given string contains no or no real data.

Parameters:
text - The string to check.
Returns:
true if the string's content is null, has zero length or consists of whitespaces only.

isValid

protected boolean isValid()
                   throws DocumentHandlerException
Checks whether the condition is valid or not.

Returns:
true if the condition is not defined or evaluates to true, else false.
Throws:
DocumentHandlerException - In case a document handling problem occurred.

isRendered

protected boolean isRendered()
Tells whether or not this tag is rendered.

Returns:
true if the tag is rendered, else false.

createFont

protected DocumentFont createFont(String family,
                                  String encoding,
                                  float size,
                                  int style,
                                  float textRise,
                                  Color color)
                           throws DocumentHandlerException
Creates the item's font according to the item's attributes.

Parameters:
family - The font family.
encoding - The font encoding.
size - The font size.
style - The font style.
textRise - The text displacement relative to the baseline. Positive values rise the text, negative values lower the text.
color - The font color.
Returns:
The created font.
Throws:
DocumentHandlerException - In case the font could not be created.

getPhraseWidth

protected float getPhraseWidth(com.lowagie.text.Phrase item)
Gets the width of the given phrase.

Parameters:
item - The phrase to determine the width for.
Returns:
The calculated width.

getPhraseHeight

protected float getPhraseHeight(com.lowagie.text.Phrase item)
Gets the height of the given phrase.

Parameters:
item - The phrase to determine the width for.
Returns:
The calculated width.

getPhraseContent

protected String getPhraseContent(com.lowagie.text.Phrase item)
Gets the content of the given phrase.

Parameters:
item - The phrase to get the content for.
Returns:
The content of the given phrase.

rotatePhrase

protected com.lowagie.text.Phrase rotatePhrase(com.lowagie.text.Phrase phrase,
                                               float rotate)
                                        throws DocumentHandlerException
Rotates the given phrase.

Parameters:
phrase - The phrase to rotate.
rotate - The rotation angle.
Returns:
The rotated phrase.
Throws:
DocumentHandlerException - Thrown in case something went wrong while rotating the phrase.

printPhrase

protected void printPhrase(com.lowagie.text.pdf.PdfTemplate template,
                           com.lowagie.text.Phrase phrase,
                           float xPos,
                           float yPos)
                    throws DocumentHandlerException
Prints a phrase into the given template.

Parameters:
template - The template to output the phrase to.
phrase - The phrase to output.
xPos - The horizontal position releative to the template.
yPos - The vertical position releative to the template.
Throws:
DocumentHandlerException - Thrown in case something went wrong while rotating the phrase.

typeCastValue

protected Object typeCastValue(String text,
                               String type)
                        throws DocumentHandlerException
Gets a well typed value for the given one.

Parameters:
text - The text to parse the value from.
type - The type name to cast to.
Returns:
The correctly typed value.
Throws:
DocumentHandlerException - In case the type conversion failed.

ensureNumberOfPagesTemplate

protected com.lowagie.text.pdf.PdfTemplate ensureNumberOfPagesTemplate(DocumentFont font,
                                                                       com.lowagie.text.pdf.PdfContentByte cb)
Ensures the 'number of pages' template for the given font.

Parameters:
font - The font to use for the number of pages output.
cb - The PDF content byte.
Returns:
The according template.

isPhraseEmpty

protected boolean isPhraseEmpty(com.lowagie.text.Phrase phrase)
Tells whether the given phrase is empty or not.

Parameters:
phrase - The phrase to check.
Returns:
true if the phrase contains only chunks with zero length, is null or contains no chunks at all, else false.

getCommonAttributesHolder

public CommonAttributesHolder getCommonAttributesHolder()
Gets the element container. In case no element container has been set so far, it obtains the root element container from the DocumentHandler.

Returns:
The current element container.


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