org.ujac.print
Class DocumentHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.ujac.print.DocumentHandler
All Implemented Interfaces:
ColorRegistry, ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class DocumentHandler
extends DefaultHandler
implements ColorRegistry

Name: DocumentHandler
Description: XML content handler, managing core tasks of the XML to iText processing framework.

Author:
lauerc

Field Summary
protected  com.lowagie.text.pdf.PdfPageLabels pdfLabels
          The Pdf Page Labels can be seen on the pages tab in acrobat.
 
Constructor Summary
DocumentHandler(OutputStream outputStream, TemplateContext templateContext, DocumentTagFactory tagFactory)
          Constructs a DocumentHandler instance with specific arguments.
DocumentHandler(OutputStream outputStream, TemplateInterpreter templateInterpreter, TemplateContext templateContext, DocumentTagFactory tagFactory)
          Constructs a DocumentHandler instance with specific arguments.
 
Method Summary
 void addOutline(OutlineItem outlineItem)
          Adds an outline item.
 void addTocItem(TocItem tocItem)
          Adds a TOC item.
 void applyCurrentLogicalPageNumberStyle()
          Applies the logical page Numbering style for the generated PDF.
 void cacheImage(Object source, com.lowagie.text.Image img)
          Putting image into cache.
 void characters(char[] ch, int start, int length)
           
 void clearPageEventHandlers()
          Removes all current page event handlers.
 void clearReferences()
          Clears all references.
 DocumentFont createFont(String fontName, String encoding, float size, int style, float textRise, Color color)
          Creates a font according to the given attributes.
 com.lowagie.text.pdf.PdfPageEvent createPageEventHandler()
          Creates a new page event handler.
 void disableTemplateCopyWriter()
          Disables the template copy writer to avoid the copy of internally processed XML stuff.
 void enableTemplateCopyWriter()
          Enables the template copy writer again.
 void endDocument()
           
 void endElement(String uri, String localName, String qName)
           
 boolean evalBoolean(String expression)
          Evaluates a text, which is likely to contain expressions as a boolean.
 Date evalDate(String expression)
          Evaluates a text, which is likely to contain expressions as a Date.
 double evalDouble(String expression)
          Evaluates a text, which is likely to contain expressions as a double.
 float evalFloat(String expression)
          Evaluates a text, which is likely to contain expressions as a float.
 int evalInt(String expression)
          Evaluates a text, which is likely to contain expressions as an int.
 long evalLong(String expression)
          Evaluates a text, which is likely to contain expressions as an long.
 Object evalObject(String expression)
          Evaluates a text, which is likely to contain expressions as am Object.
 String evalString(String expression)
          Evaluates a text, which is likely to contain expressions as a String.
 Time evalTime(String expression)
          Evaluates a text, which is likely to contain expressions as a Time.
 Timestamp evalTimestamp(String expression)
          Evaluates a text, which is likely to contain expressions as a Timestamp.
 String executeTemplate(String templateSource)
          Executes the given template source.
protected  TocItem flushTocChapter(com.lowagie.text.pdf.PdfWriter writer, float verticalPosition)
          Processes the next unnumbered TOC chapter.
protected  void flushTocItems(com.lowagie.text.pdf.PdfWriter writer)
          Processes all currently unnumbered TOC items.
protected  TocItem flushTocSection(com.lowagie.text.pdf.PdfWriter writer, float verticalPosition)
          Processes the next unnumbered TOC section.
 AttributeHandler getAttributeHandler()
          Getter method for the the property attributeHandler.
 Font getAwtFont(DocumentFont font)
          Gets the BaseFont for the given font name and style.
 com.lowagie.text.pdf.BaseFont getBaseFont(String fontName, int style)
          Gets the BaseFont for the given font name and style.
 com.lowagie.text.Image getCachedImage(Object source)
          Getting image from cache.
 Color getColor(String colorName)
          Gets a color from the color registry.
 ContentFilter getContentFilter()
          Getter method for the the property contentFilter.
 DocumentDataAccessor getDataAccessor()
          Getter method for the the property dataAccessor.
 com.lowagie.text.Document getDocument()
          Gets the document.
 com.lowagie.text.Document getDocument(boolean openDocumentRequired)
          Gets the document.
 com.lowagie.text.DocWriter getDocumentWriter()
          Gets the document writer.
 com.lowagie.text.DocWriter getDocumentWriter(boolean openDocumentRequired)
          Gets the document writer.
 DynamicContentContainer getDynamicContentContainer()
          Getter method for the the property dynamicContentContainer.
 int getExpectedNumberOfPages()
          Getter method for the the property expectedNumberOfPages.
 DocumentFont getFont(String name)
          Gets the font with the given name.
 com.lowagie.text.pdf.FontMapper getFontMapper()
          Gets the font mapper, required for PDF rendering using the Graphics2D interface.
 FormatHelper getFormatHelper()
          Gets the format helper.
 org.apache.commons.logging.Log getLog()
          Getter method for the the property log.
 DocumentMetaData getMetaData()
          Gets the meta data.
 List getOutlines()
          Gets the list of outline items.
 com.lowagie.text.pdf.PdfPageEvent getPageEventHandler()
          Gets the current page event handler.
 int getPageNumber(com.lowagie.text.pdf.PdfWriter writer)
          Gets the current page number.
 int getPageNumberOffset()
          Getter method for the the property pageNumberOffset.
 TrueTypeFontHolder getRegisteredFont(String name)
          Gets a specific registered font.
 TrueTypeFontHolder[] getRegisteredFonts()
          Gets an array holding all registerd fonts.
 Object getResource(Object key)
          Gets a document resource from the registry.
 Map getResourceRegistry()
          Gets a the resource registry.
 Map getStyle(BaseDocumentTag tag, String clazz)
          Gets the style attributes for the given style class name.
 Map getStyle(String styleName)
          Gets the style attributes for the given style name.
 StyleParser getStyleParser()
          Getter method for the the property styleParser.
 AttributeDefinitionMap getSupportedAttributes(BaseDocumentTag tag)
          Gets the supported attribute definition map for the given tag instance.
 ChildDefinitionMap getSupportedChilds(BaseDocumentTag tag)
          Gets the supported style attribute definition map for the given tag instance.
 AttributeDefinitionMap getSupportedStyleAttributes(BaseDocumentTag tag)
          Gets the supported style attribute definition map for the given tag instance.
 DocumentTagFactory getTagFactory()
          Gets the tag factory.
 DocumentTagInterceptor getTagInterceptor()
          Getter method for the the property tagInterceptor.
 TemplateContext getTemplateContext()
          Gets the template context.
 PrintWriter getTemplateCopyWriter()
          Getter method for the the property templateCopyWriter.
 List getTocItems()
          Gets the list of TOC items.
 float getVerticalPosition()
          Gets the vertical position on the current page.
 String getXmlReaderClass()
          Getter method for the the property xmlReaderClass.
 boolean isCacheImages()
          Getter method for the the property cacheImages.
 boolean isDestinationsSupported()
          Getter method for the the property destinationsSupported.
 boolean isEvaluateExpressions()
          Getter method for the the property evaluateExpressions.
 boolean isIncludeHeadSection()
          Getter method for the the property includeHeadSection.
 boolean isParseDynamicContent()
          Getter method for the the property parseDynamicContent.
 boolean isStrictlyCheckDocumentStructure()
          Getter method for the the property strictlyCheckDocumentStructure.
 boolean isTocFreezed()
          Getter method for the the property tocFreezed.
 boolean isTranslateEscapeSequences()
          Getter method for the the property translateEscapeSequences.
 CellContainer latestCellContainer()
          Gets the first item from the top of the stack that implements the CellContainer interface.
 CommonAttributesHolder latestCommonAttributesHolder()
          Gets the first item from the top of the stack that implements the CommonAttributesHolder interface.
 Condition latestCondition()
          Gets the first item from the top of the stack that implements the Condition interface.
 ElementContainer latestElementContainer()
          Gets the first item from the top of the stack that implements the ElementContainer interface.
 FontHolder latestFontHolder()
          Gets the first item from the top of the stack that implements the FontHolder interface.
 BaseDocumentTag latestOfType(Class type)
          Gets the first item from the top of the stack that matches the given type name.
 BaseDocumentTag latestOfType(String type)
          Gets the first item from the top of the stack that matches the given type name.
 PdfCellContainer latestPdfCellContainer()
          Gets the first item from the top of the stack that implements the PdfCellContainer interface.
 PhraseHolder latestPhraseHolder()
          Gets the first item from the top of the stack that implements the PhraseHolder interface.
 BaseDocumentTag latestRealTag()
          Gets the first item from the top of the stack that is no virtual container.
 byte[] loadResource(String location)
          Loads the resource from the given loacation.
 Locator locator()
          Gets the document locator.
 Format lookupFormat(String formatString)
          Looks up the macro definition for the given macro name.
 MacroDefTag lookupMacroDefinition(String macroName)
          Looks up the macro definition for the given macro name.
 int numItems()
          Gets number of items, currently on the document stack.
 DocumentEventRecorder popEventRecorder()
          Pops the top item from the event recorder stack.
 BaseDocumentTag popItem()
          Pops the top item from the document stack.
 void pushEventRecorder(DocumentEventRecorder recorder)
          Pushes an item on the event recorder stack.
 void pushItem(BaseDocumentTag item)
          Pushes an item on the document stack.
 void registerColor(String colorName, Color color)
          Registers the given color for the also given name.
 void registerFont(String fontName, byte[] fontBytes, int style, boolean embed, boolean cached)
          Registers the given true type font for the also given font name and style.
 void registerFont(String name, DocumentFont font)
          Registers the font with the given name.
 void registerFormat(String formatString, Format formatInstance)
          Registers the given format instance for the also given format string.
 void registerMacroDefinition(String macroName, MacroDefTag macroDefinition)
          Registers the given macro definition instance for the also given macro name.
 void registerResource(Object key, Object resource)
          Registers a document resource from the registry.
 void registerStyle(String styleName, Map attributes)
          Registers the specified style attributes for the given name.
 void removePageEventHandler(Object key)
          Removes the handler with the given name from the event handler map.
 Object removeResource(Object key)
          Removes a document resource from the registry.
protected  void reset(OutputStream outputStream)
          Resets the document handler.
 void resetReferences()
          Resets all references.
 void setAttributeHandler(AttributeHandler attributeHandler)
          Setter method for the the property attributeHandler.
 void setCacheImages(boolean cacheImages)
          Setter method for the the property cacheImages.
 void setContentFilter(ContentFilter contentFilter)
          Setter method for the the property contentFilter.
protected  void setDataAccessor(DocumentDataAccessor dataAccessor)
          Setter method for the the property dataAccessor.
 void setDestinationsSupported(boolean destinationsSupported)
          Setter method for the the property destinationsSupported.
 com.lowagie.text.DocWriter setDocument(com.lowagie.text.Document document)
          Sets the document and initializes the document writer.
 com.lowagie.text.DocWriter setDocumentAndWriter(com.lowagie.text.Document document, com.lowagie.text.DocWriter writer)
          Sets the document and the document writer.
 com.lowagie.text.DocWriter setDocumentAndWriter(com.lowagie.text.Document document, com.lowagie.text.DocWriter writer, Map resourceRegistry, com.lowagie.text.pdf.PdfPageEvent eventHandler)
          Sets the document and the document writer.
 void setDocumentLocator(Locator locator)
          Sets the document locator.
 void setDynamicContentContainer(DynamicContentContainer dynamicContentContainer)
          Setter method for the the property dynamicContentContainer.
 void setEvaluateExpressions(boolean evaluateExpressions)
          Setter method for the the property evaluateExpressions.
 void setExpectedNumberOfPages(int expectedNumberOfPages)
          Setter method for the the property expectedNumberOfPages.
protected  void setIncludeHeadSection(boolean includeHeadSection)
          Setter method for the the property includeHeadSection.
 void setLog(org.apache.commons.logging.Log log)
          Setter method for the the property log.
 void setLogicalPageNumberStyle(int logicalPageNumberStyle)
          Sets the current logical page numbering style.
 void setLogicalPageNumberText(String logicalPageNumberText)
          Sets the current logical page numbering text.
 void setMetaData(DocumentMetaData metaData)
          Sets the meta data.
 void setPageEventHandler(Object key, com.lowagie.text.pdf.PdfPageEvent handler)
          Sets the given handler to the event handler map.
 void setPageNumberOffset(int pageNumberOffset)
          Setter method for the the property pageNumberOffset.
 void setParseDynamicContent(boolean parseDynamicContent)
          Setter method for the the property parseDynamicContent.
 void setResourceLoader(ResourceLoader resourceLoader)
          Adds a resource loader.
 void setStrictlyCheckDocumentStructure(boolean strictlyCheckDocumentStructure)
          Setter method for the the property strictlyCheckDocumentStructure.
 void setStyleParser(StyleParser styleParser)
          Setter method for the the property styleParser.
 void setTagInterceptor(DocumentTagInterceptor tagInterceptor)
          Setter method for the the property tagInterceptor.
 void setTemplateContext(TemplateContext templateContext)
          Sets the template context.
protected  void setTemplateCopyWriter(PrintWriter templateCopyWriter)
          Setter method for the the property templateCopyWriter.
 void setTocFreezed(boolean tocFreezed)
          Setter method for the the property tocFreezed.
 void setTranslateEscapeSequences(boolean translateEscapeSequences)
          Setter method for the the property translateEscapeSequences.
 void setXmlReaderClass(String xmlReaderClass)
          Setter method for the the property xmlReaderClass.
 void startDocument()
           
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 DocumentEventRecorder topEventRecorder()
          Gets the top item from the event recorder stack.
 BaseDocumentTag topItem()
          Gets the top item from the document stack.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pdfLabels

protected com.lowagie.text.pdf.PdfPageLabels pdfLabels
The Pdf Page Labels can be seen on the pages tab in acrobat.

Constructor Detail

DocumentHandler

public DocumentHandler(OutputStream outputStream,
                       TemplateContext templateContext,
                       DocumentTagFactory tagFactory)
Constructs a DocumentHandler instance with specific arguments.

Parameters:
outputStream - The stream where to write the document to.
templateContext - The template context to use.
tagFactory - The special tag factory to use.

DocumentHandler

public DocumentHandler(OutputStream outputStream,
                       TemplateInterpreter templateInterpreter,
                       TemplateContext templateContext,
                       DocumentTagFactory tagFactory)
Constructs a DocumentHandler instance with specific arguments.

Parameters:
outputStream - The stream where to write the document to.
templateInterpreter - The template interpreter to use.
templateContext - The template context to use.
tagFactory - The special tag factory to use.
Method Detail

setLogicalPageNumberStyle

public void setLogicalPageNumberStyle(int logicalPageNumberStyle)
Sets the current logical page numbering style.

Parameters:
logicalPageNumberStyle - The style value for the logical page numbering. this value can be DECIMAL_ARABIC_NUMERALS = 0 which is the default UPPERCASE_ROMAN_NUMERALS = 1 (I, II, III, IV etc) LOWERCASE_ROMAN_NUMERALS = 2 (i, ii, iii, iv etc) UPPERCASE_LETTERS = 3 (A,B,C,D etc) LOWERCASE_LETTERS = 4 (a,b,c,d etc) EMPTY = 5 (No logical page numbers are generated but fixed text may still exist)

setLogicalPageNumberText

public void setLogicalPageNumberText(String logicalPageNumberText)
Sets the current logical page numbering text.

Parameters:
logicalPageNumberText - The text that is prepended to the logical page numbering style.

applyCurrentLogicalPageNumberStyle

public void applyCurrentLogicalPageNumberStyle()
Applies the logical page Numbering style for the generated PDF.

See Also:
#setLogicalPageNumberStyle(int, String), logicalPageNumberStyle, logicalPageNumberText

getPageNumber

public int getPageNumber(com.lowagie.text.pdf.PdfWriter writer)
Gets the current page number.

Parameters:
writer - The document writer.
Returns:
The current page number.

reset

protected void reset(OutputStream outputStream)
Resets the document handler.

Parameters:
outputStream - The stream where to write the document to.

getLog

public org.apache.commons.logging.Log getLog()
Getter method for the the property log.

Returns:
The current value of property log.

setLog

public void setLog(org.apache.commons.logging.Log log)
Setter method for the the property log.

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

getXmlReaderClass

public String getXmlReaderClass()
Getter method for the the property xmlReaderClass.

Returns:
The current value of property xmlReaderClass.

setXmlReaderClass

public void setXmlReaderClass(String xmlReaderClass)
Setter method for the the property xmlReaderClass.

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

getFormatHelper

public FormatHelper getFormatHelper()
Gets the format helper.

Returns:
The format helper.

setResourceLoader

public void setResourceLoader(ResourceLoader resourceLoader)
Adds a resource loader.

Parameters:
resourceLoader - The resource loader to add.

loadResource

public byte[] loadResource(String location)
                    throws IOException
Loads the resource from the given loacation.

Parameters:
location - The location from which to load the resource.
Returns:
The loaded resource as a byte array.
Throws:
IOException - In case the loading of the resource failed.

registerStyle

public void registerStyle(String styleName,
                          Map attributes)
Registers the specified style attributes for the given name.

Parameters:
styleName - The style name.
attributes - The attributes to register.

getStyle

public Map getStyle(String styleName)
Gets the style attributes for the given style name.

Parameters:
styleName - The style name.
Returns:
The attributes from the style registry or null.

getStyle

public Map getStyle(BaseDocumentTag tag,
                    String clazz)
Gets the style attributes for the given style class name.

Parameters:
tag - The tag to retrive the style for.
clazz - The style class names, separated by blank.
Returns:
The attributes from the style registry or null.

registerColor

public void registerColor(String colorName,
                          Color color)
Registers the given color for the also given name.

Specified by:
registerColor in interface ColorRegistry
Parameters:
colorName - The color name.
color - The color to register.

getColor

public Color getColor(String colorName)
Gets a color from the color registry.

Specified by:
getColor in interface ColorRegistry
Parameters:
colorName - The color name.
Returns:
The color from the color registry or null.

registerFont

public void registerFont(String fontName,
                         byte[] fontBytes,
                         int style,
                         boolean embed,
                         boolean cached)
                  throws IOException,
                         com.lowagie.text.DocumentException
Registers the given true type font for the also given font name and style.

Parameters:
fontName - The font name.
fontBytes - The TTF font data.
style - The base font style (NORMAL,BOLD,ITALIC,BOLD|ITALIC).
embed - Tells whether or not to embed the font into the PDF (Added by Kiran).
cached - Tells whether or not to cache the font (Added by Kiran).
Throws:
IOException - In case the base font creation failed.
com.lowagie.text.DocumentException - In case the base font creation failed.

createFont

public DocumentFont createFont(String fontName,
                               String encoding,
                               float size,
                               int style,
                               float textRise,
                               Color color)
                        throws DocumentHandlerException
Creates a font according to the given attributes. First it checks the local font registry. If no matching font has been found, it asks the iText FontFactory.

Parameters:
fontName - The font name. This may be a comma separated list of font names.
encoding - The font encoding.
size - The desired font size.
style - The font style (NORMAL, BOLD, ITALIC ...).
color - The font color.
textRise - The text displacement relative to the baseline. Positive values rise the text, negative values lower the text.
Returns:
The created document font.
Throws:
DocumentHandlerException - In case the font could not be created.

getBaseFont

public com.lowagie.text.pdf.BaseFont getBaseFont(String fontName,
                                                 int style)
Gets the BaseFont for the given font name and style.

Parameters:
fontName - The font name.
style - The font style (NORMAL, BOLD, ITALIC ...).
Returns:
The according BaseFont.

getAwtFont

public Font getAwtFont(DocumentFont font)
Gets the BaseFont for the given font name and style.

Parameters:
font - The document font for which to create the AWT font.
Returns:
The according AWT font.

getRegisteredFonts

public TrueTypeFontHolder[] getRegisteredFonts()
Gets an array holding all registerd fonts.

Returns:
An array of TrueTypeFontHolder instances holding the registered BaseFont variations for the specific font names.

getRegisteredFont

public TrueTypeFontHolder getRegisteredFont(String name)
Gets a specific registered font.

Parameters:
name - The name of the desired font.
Returns:
The according TrueTypeFontHolder instances.

getFontMapper

public com.lowagie.text.pdf.FontMapper getFontMapper()
Gets the font mapper, required for PDF rendering using the Graphics2D interface.

Returns:
The font mapper.

getCachedImage

public com.lowagie.text.Image getCachedImage(Object source)
Getting image from cache.

Parameters:
source - The image source.
Returns:
The cached image or null, if not found.

cacheImage

public void cacheImage(Object source,
                       com.lowagie.text.Image img)
Putting image into cache.

Parameters:
source - The image source.
img - The image to put into cache.

getSupportedAttributes

public AttributeDefinitionMap getSupportedAttributes(BaseDocumentTag tag)
Gets the supported attribute definition map for the given tag instance. In case the attribute definitions are already defined, the value from the registry is returned, else the tags buildSupportedAttributes() is called and the created map is registerd and returned.

Parameters:
tag - The tag to get the supported attributes for.
Returns:
The determined supported attribute definitios.

getSupportedStyleAttributes

public AttributeDefinitionMap getSupportedStyleAttributes(BaseDocumentTag tag)
Gets the supported style attribute definition map for the given tag instance. In case the attribute definitions are already defined, the value from the registry is returned, else the tags buildSupportedStyleAttributes() is called and the created map is registerd and returned.

Parameters:
tag - The tag to get the supported attributes for.
Returns:
The determined supported attribute definitios.

getSupportedChilds

public ChildDefinitionMap getSupportedChilds(BaseDocumentTag tag)
Gets the supported style attribute definition map for the given tag instance. In case the attribute definitions are already defined, the value from the registry is returned, else the tags buildSupportedStyleAttributes() is called and the created map is registerd and returned.

Parameters:
tag - The tag to get the supported attributes for.
Returns:
The determined supported attribute definitios.

getPageEventHandler

public com.lowagie.text.pdf.PdfPageEvent getPageEventHandler()
Gets the current page event handler.

Returns:
The current page event handler.

createPageEventHandler

public com.lowagie.text.pdf.PdfPageEvent createPageEventHandler()
Creates a new page event handler.

Returns:
The created page event handler.

setPageEventHandler

public void setPageEventHandler(Object key,
                                com.lowagie.text.pdf.PdfPageEvent handler)
Sets the given handler to the event handler map. In case true is passed for the attribute queue and a handler for the given key is currently assigned, it puts the handler to the queue map.

Parameters:
key - The event handler key.
handler - The event handler.

removePageEventHandler

public void removePageEventHandler(Object key)
Removes the handler with the given name from the event handler map.

Parameters:
key - The event handler key.

clearPageEventHandlers

public void clearPageEventHandlers()
Removes all current page event handlers.


getTemplateContext

public TemplateContext getTemplateContext()
Gets the template context.

Returns:
The current template context.

setTemplateContext

public void setTemplateContext(TemplateContext templateContext)
Sets the template context.

Parameters:
templateContext - The template context to set.

getTagFactory

public DocumentTagFactory getTagFactory()
Gets the tag factory.

Returns:
The tag factory.

isTranslateEscapeSequences

public boolean isTranslateEscapeSequences()
Getter method for the the property translateEscapeSequences.

Returns:
The current value of property translateEscapeSequences.

setTranslateEscapeSequences

public void setTranslateEscapeSequences(boolean translateEscapeSequences)
Setter method for the the property translateEscapeSequences.

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

isParseDynamicContent

public boolean isParseDynamicContent()
Getter method for the the property parseDynamicContent.

Returns:
The current value of property parseDynamicContent.

setParseDynamicContent

public void setParseDynamicContent(boolean parseDynamicContent)
Setter method for the the property parseDynamicContent.

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

isEvaluateExpressions

public boolean isEvaluateExpressions()
Getter method for the the property evaluateExpressions.

Returns:
The current value of property evaluateExpressions.

setEvaluateExpressions

public void setEvaluateExpressions(boolean evaluateExpressions)
Setter method for the the property evaluateExpressions.

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

isCacheImages

public boolean isCacheImages()
Getter method for the the property cacheImages.

Returns:
The current value of property cacheImages.

setCacheImages

public void setCacheImages(boolean cacheImages)
Setter method for the the property cacheImages.

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

isStrictlyCheckDocumentStructure

public boolean isStrictlyCheckDocumentStructure()
Getter method for the the property strictlyCheckDocumentStructure.

Returns:
The current value of property strictlyCheckDocumentStructure.

setStrictlyCheckDocumentStructure

public void setStrictlyCheckDocumentStructure(boolean strictlyCheckDocumentStructure)
Setter method for the the property strictlyCheckDocumentStructure.

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

getExpectedNumberOfPages

public int getExpectedNumberOfPages()
Getter method for the the property expectedNumberOfPages.

Returns:
The current value of property expectedNumberOfPages.

setExpectedNumberOfPages

public void setExpectedNumberOfPages(int expectedNumberOfPages)
Setter method for the the property expectedNumberOfPages.

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

isIncludeHeadSection

public boolean isIncludeHeadSection()
Getter method for the the property includeHeadSection.

Returns:
The current value of property includeHeadSection.

setIncludeHeadSection

protected void setIncludeHeadSection(boolean includeHeadSection)
Setter method for the the property includeHeadSection.

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

executeTemplate

public String executeTemplate(String templateSource)
                       throws TemplateException
Executes the given template source.

Parameters:
templateSource - The template source to execute.
Returns:
The template execution result.
Throws:
TemplateException - If the expression could not be successfuly resolved

evalBoolean

public boolean evalBoolean(String expression)
                    throws ExpressionException
Evaluates a text, which is likely to contain expressions as a boolean.

Parameters:
expression - The expression to evaluate.
Returns:
The computed boolean value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalInt

public int evalInt(String expression)
            throws ExpressionException
Evaluates a text, which is likely to contain expressions as an int.

Parameters:
expression - The expression to evaluate.
Returns:
The computed int value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalLong

public long evalLong(String expression)
              throws ExpressionException
Evaluates a text, which is likely to contain expressions as an long.

Parameters:
expression - The expression to evaluate.
Returns:
The computed long value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalFloat

public float evalFloat(String expression)
                throws ExpressionException
Evaluates a text, which is likely to contain expressions as a float.

Parameters:
expression - The expression to evaluate.
Returns:
The computed float value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalDouble

public double evalDouble(String expression)
                  throws ExpressionException
Evaluates a text, which is likely to contain expressions as a double.

Parameters:
expression - The expression to evaluate.
Returns:
The computed boolean value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalDate

public Date evalDate(String expression)
              throws ExpressionException
Evaluates a text, which is likely to contain expressions as a Date.

Parameters:
expression - The expression to evaluate.
Returns:
The computed Date value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalTime

public Time evalTime(String expression)
              throws ExpressionException
Evaluates a text, which is likely to contain expressions as a Time.

Parameters:
expression - The expression to evaluate.
Returns:
The computed Time value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalTimestamp

public Timestamp evalTimestamp(String expression)
                        throws ExpressionException
Evaluates a text, which is likely to contain expressions as a Timestamp.

Parameters:
expression - The expression to evaluate.
Returns:
The computed Timestamp value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalString

public String evalString(String expression)
                  throws ExpressionException
Evaluates a text, which is likely to contain expressions as a String.

Parameters:
expression - The expression to evaluate.
Returns:
The computed String value.
Throws:
ExpressionException - If the expression could not be successfuly resolved

evalObject

public Object evalObject(String expression)
                  throws ExpressionException
Evaluates a text, which is likely to contain expressions as am Object.

Parameters:
expression - The expression to evaluate.
Returns:
The computed Object.
Throws:
ExpressionException - If the expression could not be successfuly resolved

registerFormat

public void registerFormat(String formatString,
                           Format formatInstance)
Registers the given format instance for the also given format string.

Parameters:
formatString - The format string.
formatInstance - The format instance.

lookupFormat

public Format lookupFormat(String formatString)
Looks up the macro definition for the given macro name.

Parameters:
formatString - The format string.
Returns:
The according format instance or null.

registerMacroDefinition

public void registerMacroDefinition(String macroName,
                                    MacroDefTag macroDefinition)
Registers the given macro definition instance for the also given macro name.

Parameters:
macroName - The macro name.
macroDefinition - The macro definition instance.

lookupMacroDefinition

public MacroDefTag lookupMacroDefinition(String macroName)
Looks up the macro definition for the given macro name.

Parameters:
macroName - The macro name.
Returns:
The according macro instance or null.

pushItem

public void pushItem(BaseDocumentTag item)
Pushes an item on the document stack.

Parameters:
item - The new item on top of the stack.

popItem

public BaseDocumentTag popItem()
Pops the top item from the document stack.

Returns:
The old top item on top of the stack.

topItem

public BaseDocumentTag topItem()
Gets the top item from the document stack.

Returns:
The top item on top of the stack.

pushEventRecorder

public void pushEventRecorder(DocumentEventRecorder recorder)
Pushes an item on the event recorder stack.

Parameters:
recorder - The new item on top of the stack.

popEventRecorder

public DocumentEventRecorder popEventRecorder()
Pops the top item from the event recorder stack.

Returns:
The old top item on top of the stack.

topEventRecorder

public DocumentEventRecorder topEventRecorder()
Gets the top item from the event recorder stack.

Returns:
The top item on top of the stack.

latestOfType

public BaseDocumentTag latestOfType(String type)
Gets the first item from the top of the stack that matches the given type name.

Parameters:
type - The name of the tag to look for.
Returns:
The detected item or null.

latestRealTag

public BaseDocumentTag latestRealTag()
Gets the first item from the top of the stack that is no virtual container.

Returns:
The detected item or null.

latestOfType

public BaseDocumentTag latestOfType(Class type)
Gets the first item from the top of the stack that matches the given type name.

Parameters:
type - The class of the tag to look for.
Returns:
The detected item or null.

latestElementContainer

public ElementContainer latestElementContainer()
Gets the first item from the top of the stack that implements the ElementContainer interface.

Returns:
The detected item or null.

latestCellContainer

public CellContainer latestCellContainer()
Gets the first item from the top of the stack that implements the CellContainer interface.

Returns:
The detected item or null.

latestPdfCellContainer

public PdfCellContainer latestPdfCellContainer()
Gets the first item from the top of the stack that implements the PdfCellContainer interface.

Returns:
The detected item or null.

latestCondition

public Condition latestCondition()
Gets the first item from the top of the stack that implements the Condition interface.

Returns:
The detected item or null.

latestFontHolder

public FontHolder latestFontHolder()
Gets the first item from the top of the stack that implements the FontHolder interface.

Returns:
The detected item or null.

latestPhraseHolder

public PhraseHolder latestPhraseHolder()
Gets the first item from the top of the stack that implements the PhraseHolder interface.

Returns:
The detected item or null.

latestCommonAttributesHolder

public CommonAttributesHolder latestCommonAttributesHolder()
Gets the first item from the top of the stack that implements the CommonAttributesHolder interface.

Returns:
The detected item or null.

numItems

public int numItems()
Gets number of items, currently on the document stack.

Returns:
The number of items on the the stack.

getDocument

public com.lowagie.text.Document getDocument()
Gets the document.

Returns:
The iText document.

getDocument

public com.lowagie.text.Document getDocument(boolean openDocumentRequired)
                                      throws DocumentHandlerException
Gets the document. In case the openDocumentRequired is true, it opens the document before returning it.

Parameters:
openDocumentRequired - True, if an open document is required, else false.
Returns:
The iText document.
Throws:
DocumentHandlerException - In case no document has been set so far.

setDocument

public com.lowagie.text.DocWriter setDocument(com.lowagie.text.Document document)
                                       throws DocumentHandlerException
Sets the document and initializes the document writer.

Parameters:
document - The document.
Returns:
The document writer.
Throws:
DocumentHandlerException - In case the document writer could not be initialized.

setDocumentAndWriter

public com.lowagie.text.DocWriter setDocumentAndWriter(com.lowagie.text.Document document,
                                                       com.lowagie.text.DocWriter writer)
Sets the document and the document writer.

Parameters:
document - The document.
writer - The document writer.
Returns:
The old document writer.

setDocumentAndWriter

public com.lowagie.text.DocWriter setDocumentAndWriter(com.lowagie.text.Document document,
                                                       com.lowagie.text.DocWriter writer,
                                                       Map resourceRegistry,
                                                       com.lowagie.text.pdf.PdfPageEvent eventHandler)
Sets the document and the document writer.

Parameters:
document - The document.
writer - The document writer.
resourceRegistry - The resource registry to set.
eventHandler - The page event handler to set.
Returns:
The old document writer.

getDocumentWriter

public com.lowagie.text.DocWriter getDocumentWriter()
Gets the document writer. In case the document is not open yet, it opens the document before returning the writer.

Returns:
The document writer.

getDocumentWriter

public com.lowagie.text.DocWriter getDocumentWriter(boolean openDocumentRequired)
Gets the document writer. In case the openDocumentRequired is true, it opens the document before returning the writer.

Parameters:
openDocumentRequired - True, if an open document is required, else false.
Returns:
The document writer.

locator

public Locator locator()
Gets the document locator.

Returns:
The document locator.

setDocumentLocator

public void setDocumentLocator(Locator locator)
Sets the document locator.

Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler
Parameters:
locator - The document locator.

registerFont

public void registerFont(String name,
                         DocumentFont font)
Registers the font with the given name.

Parameters:
name - The font name.
font - The font to be registered.

getFont

public DocumentFont getFont(String name)
                     throws TagAttributeException
Gets the font with the given name.

Parameters:
name - The font name.
Returns:
The detected font.
Throws:
TagAttributeException - If the desired font was not defined.

getTocItems

public List getTocItems()
Gets the list of TOC items. Note: It makes only sense to call this method after the document has been processed. In case no TOC item has been added the result will be null.

Returns:
The list of TOC items that has been filled during the document processing.

addTocItem

public void addTocItem(TocItem tocItem)
Adds a TOC item.

Parameters:
tocItem - The TOC item to add.

getOutlines

public List getOutlines()
Gets the list of outline items. Note: It makes only sense to call this method after the document has been processed. In case no TOC item has been added the result will be null.

Returns:
The list of TOC items that has been filled during the document processing.

addOutline

public void addOutline(OutlineItem outlineItem)
Adds an outline item.

Parameters:
outlineItem - The outline item to add.

flushTocChapter

protected TocItem flushTocChapter(com.lowagie.text.pdf.PdfWriter writer,
                                  float verticalPosition)
Processes the next unnumbered TOC chapter.

Parameters:
writer - The PDF writer to use.
verticalPosition - The vertical position of the chapter title.
Returns:
The processed TOC item.

flushTocSection

protected TocItem flushTocSection(com.lowagie.text.pdf.PdfWriter writer,
                                  float verticalPosition)
Processes the next unnumbered TOC section.

Parameters:
writer - The PDF writer to use.
verticalPosition - The vertical position of the chapter title.
Returns:
The processed TOC item.

flushTocItems

protected void flushTocItems(com.lowagie.text.pdf.PdfWriter writer)
Processes all currently unnumbered TOC items.

Parameters:
writer - The PDF writer to use.

getDataAccessor

public DocumentDataAccessor getDataAccessor()
Getter method for the the property dataAccessor.

Returns:
The current value of property dataAccessor.

setDataAccessor

protected void setDataAccessor(DocumentDataAccessor dataAccessor)
Setter method for the the property dataAccessor.

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

getTagInterceptor

public DocumentTagInterceptor getTagInterceptor()
Getter method for the the property tagInterceptor.

Returns:
The current value of property tagInterceptor.

setTagInterceptor

public void setTagInterceptor(DocumentTagInterceptor tagInterceptor)
Setter method for the the property tagInterceptor.

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

getContentFilter

public ContentFilter getContentFilter()
Getter method for the the property contentFilter.

Returns:
The current value of property contentFilter.

setContentFilter

public void setContentFilter(ContentFilter contentFilter)
Setter method for the the property contentFilter.

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

getResourceRegistry

public Map getResourceRegistry()
Gets a the resource registry.

Returns:
The current resource registry.

getResource

public Object getResource(Object key)
Gets a document resource from the registry.

Parameters:
key - The key of the document resource to get.
Returns:
The desired resource or null.

registerResource

public void registerResource(Object key,
                             Object resource)
Registers a document resource from the registry.

Parameters:
key - The key of the document resource to register.
resource - The resource to register.

removeResource

public Object removeResource(Object key)
Removes a document resource from the registry.

Parameters:
key - The key of the document resource to remove.
Returns:
The desired resource or null.

getDynamicContentContainer

public DynamicContentContainer getDynamicContentContainer()
Getter method for the the property dynamicContentContainer.

Returns:
The current value of property dynamicContentContainer.

setDynamicContentContainer

public void setDynamicContentContainer(DynamicContentContainer dynamicContentContainer)
Setter method for the the property dynamicContentContainer.

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

getVerticalPosition

public float getVerticalPosition()
Gets the vertical position on the current page.

Returns:
The vertical position on the current page.

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.startDocument()

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.characters(char[], int, int)

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.endDocument()

getTemplateCopyWriter

public PrintWriter getTemplateCopyWriter()
Getter method for the the property templateCopyWriter.

Returns:
The current value of property templateCopyWriter.

setTemplateCopyWriter

protected void setTemplateCopyWriter(PrintWriter templateCopyWriter)
Setter method for the the property templateCopyWriter.

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

disableTemplateCopyWriter

public void disableTemplateCopyWriter()
Disables the template copy writer to avoid the copy of internally processed XML stuff.


enableTemplateCopyWriter

public void enableTemplateCopyWriter()
Enables the template copy writer again.


getAttributeHandler

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

Returns:
The current value of property attributeHandler.

setAttributeHandler

public void setAttributeHandler(AttributeHandler attributeHandler)
Setter method for the the property attributeHandler.

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

getStyleParser

public StyleParser getStyleParser()
Getter method for the the property styleParser.

Returns:
The current value of property styleParser.

setStyleParser

public void setStyleParser(StyleParser styleParser)
Setter method for the the property styleParser.

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

getPageNumberOffset

public int getPageNumberOffset()
Getter method for the the property pageNumberOffset.

Returns:
The current value of property pageNumberOffset.

setPageNumberOffset

public void setPageNumberOffset(int pageNumberOffset)
Setter method for the the property pageNumberOffset.

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

clearReferences

public void clearReferences()
Clears all references.


resetReferences

public void resetReferences()
Resets all references.


isTocFreezed

public boolean isTocFreezed()
Getter method for the the property tocFreezed.

Returns:
The current value of property tocFreezed.

setTocFreezed

public void setTocFreezed(boolean tocFreezed)
Setter method for the the property tocFreezed.

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

isDestinationsSupported

public boolean isDestinationsSupported()
Getter method for the the property destinationsSupported.

Returns:
The current value of property destinationsSupported.

setDestinationsSupported

public void setDestinationsSupported(boolean destinationsSupported)
Setter method for the the property destinationsSupported.

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

getMetaData

public DocumentMetaData getMetaData()
Gets the meta data.

Returns:
The meta data.

setMetaData

public void setMetaData(DocumentMetaData metaData)
Sets the meta data.

Parameters:
metaData - The meta data to set.


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