org.foray.fotree
Class FOTreeBuilder

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.foray.fotree.FOTreeBuilder
All Implemented Interfaces:
org.axsl.fo.FoTree, ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class FOTreeBuilder
extends org.xml.sax.helpers.DefaultHandler
implements org.axsl.fo.FoTree

SAX Handler that builds the formatting object tree.


Constructor Summary
FOTreeBuilder(FoTreeServer4a server, org.apache.commons.logging.Log logger)
          Constructor.
 
Method Summary
 void activateForeignXML(ForeignXML foreign)
          Set a flag indicating that we are currently processing foreign XML.
 void characters(char[] data, int start, int length)
           
 void disactivateForeignXML()
          Unset the flag indicating that we are currently processing foreign XML.
 void endDocument()
           
 void endElement(String uri, String localName, String rawName)
           
 NamespaceAxsl getAxslNamespace()
          Returns the aXSL namespace instance.
 boolean getCachingGraphics()
          Indicates whether graphics should be cached.
 NamespaceFO getFONamespace()
          Return the FO namespace instance.
 org.axsl.font.FontConsumer getFontConsumer()
           
 NamespaceForay getForayNamespace()
          Return the Extension namespace instance.
 URL[] getGraphicSearchPath()
          Return the graphic search path.
 org.axsl.graphic.GraphicServer getGraphicServer()
           
 org.axsl.hyphen.HyphenationConsumer getHyphenationConsumer()
           
 org.apache.commons.logging.Log getLogger()
          Returns the logger.
 MathNamespace getMathNamespace()
          Return the MathML namespace instance.
 int getNextSequentialIndex()
          Returns the next sequential index.
 String getPropertyName(PropertyType propertyType)
          Returns the name of a given property type.
 Root getRootFo()
           
 org.axsl.speech.SpeechServer getSpeechServer()
           
 NamespaceSVG getSVGNamespace()
          Return the SVG namespace instance.
 org.axsl.text.TextServer getTextServer()
           
 FoTreeServer4a getTreeServer()
          Return the "parent" FO Tree server.
 NamespaceXML getXMLNamespace()
          Return the XML namespace instance.
 boolean hasData()
           
 boolean preserveRawContent()
          Indicates whether we wish to preserve the raw FO Tree content so that it can be round-tripped.
 void registerListener(org.axsl.fo.FoTreeListener listener)
          Add an object to the collection of objects that should be notified about FOTreeEvent firings.
 void removeFOTreeListener(org.axsl.fo.FoTreeListener listener)
          Remove an object from the collection of objects that should be notified about FOTreeEvent firings.
 void reset()
          Reset this parser for reuse.
 void setCachingGraphics(boolean cachingGraphics)
           
 void setDocumentLocator(Locator locator)
           
 void setFontConsumer(org.axsl.font.FontConsumer consumer)
           
 void setGraphicSearchPath(URL[] graphicSearchPath)
           
 void setGraphicServer(org.axsl.graphic.GraphicServer graphicServer)
           
 void setHyphenationConsumer(org.axsl.hyphen.HyphenationConsumer hyphenationConsumer)
           
 void setSpeechServer(org.axsl.speech.SpeechServer server)
           
 void setTextServer(org.axsl.text.TextServer textServer)
           
 void startDocument()
           
 void startElement(String namespaceURI, String localName, String rawName, Attributes attlist)
           
 
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
 
Methods inherited from interface org.xml.sax.ContentHandler
endPrefixMapping, ignorableWhitespace, processingInstruction, skippedEntity, startPrefixMapping
 

Constructor Detail

FOTreeBuilder

public FOTreeBuilder(FoTreeServer4a server,
                     org.apache.commons.logging.Log logger)
Constructor.

Parameters:
server - The parent server.
logger - The logger.
Method Detail

characters

public void characters(char[] data,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String rawName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String rawName,
                         Attributes attlist)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

reset

public void reset()
Reset this parser for reuse.


hasData

public boolean hasData()
Specified by:
hasData in interface org.axsl.fo.FoTree

getLogger

public org.apache.commons.logging.Log getLogger()
Returns the logger.

Returns:
The logger.

registerListener

public void registerListener(org.axsl.fo.FoTreeListener listener)
Add an object to the collection of objects that should be notified about FOTreeEvent firings.

Specified by:
registerListener in interface org.axsl.fo.FoTree
Parameters:
listener - the Object which should be notified

removeFOTreeListener

public void removeFOTreeListener(org.axsl.fo.FoTreeListener listener)
Remove an object from the collection of objects that should be notified about FOTreeEvent firings.

Parameters:
listener - the Object which should no longer be notified

getFONamespace

public NamespaceFO getFONamespace()
Return the FO namespace instance.

Returns:
The FO namespace instance.

getForayNamespace

public NamespaceForay getForayNamespace()
Return the Extension namespace instance.

Returns:
The Extension namespace instance.

getSVGNamespace

public NamespaceSVG getSVGNamespace()
Return the SVG namespace instance.

Returns:
The SVG namespace instance.

getMathNamespace

public MathNamespace getMathNamespace()
Return the MathML namespace instance.

Returns:
The MathML namespace instance.

getXMLNamespace

public NamespaceXML getXMLNamespace()
Return the XML namespace instance.

Returns:
The XML namespace instance.

getAxslNamespace

public NamespaceAxsl getAxslNamespace()
Returns the aXSL namespace instance.

Returns:
The aXSL namespace instance.

getPropertyName

public String getPropertyName(PropertyType propertyType)
Returns the name of a given property type.

Parameters:
propertyType - The property type whose name is needed.
Returns:
The name of the property.

getRootFo

public Root getRootFo()
Specified by:
getRootFo in interface org.axsl.fo.FoTree

activateForeignXML

public void activateForeignXML(ForeignXML foreign)
Set a flag indicating that we are currently processing foreign XML.

Parameters:
foreign - The foreign XML item that we are currently processing.

disactivateForeignXML

public void disactivateForeignXML()
Unset the flag indicating that we are currently processing foreign XML.


getTreeServer

public FoTreeServer4a getTreeServer()
Return the "parent" FO Tree server.

Returns:
The FO Tree server.

setGraphicServer

public void setGraphicServer(org.axsl.graphic.GraphicServer graphicServer)
Specified by:
setGraphicServer in interface org.axsl.fo.FoTree

getGraphicServer

public org.axsl.graphic.GraphicServer getGraphicServer()
Specified by:
getGraphicServer in interface org.axsl.fo.FoTree

setTextServer

public void setTextServer(org.axsl.text.TextServer textServer)
Specified by:
setTextServer in interface org.axsl.fo.FoTree

getTextServer

public org.axsl.text.TextServer getTextServer()
Specified by:
getTextServer in interface org.axsl.fo.FoTree

setFontConsumer

public void setFontConsumer(org.axsl.font.FontConsumer consumer)
Specified by:
setFontConsumer in interface org.axsl.fo.FoTree

setSpeechServer

public void setSpeechServer(org.axsl.speech.SpeechServer server)
Specified by:
setSpeechServer in interface org.axsl.fo.FoTree

getFontConsumer

public org.axsl.font.FontConsumer getFontConsumer()
Specified by:
getFontConsumer in interface org.axsl.fo.FoTree

getSpeechServer

public org.axsl.speech.SpeechServer getSpeechServer()
Specified by:
getSpeechServer in interface org.axsl.fo.FoTree

setHyphenationConsumer

public void setHyphenationConsumer(org.axsl.hyphen.HyphenationConsumer hyphenationConsumer)
Specified by:
setHyphenationConsumer in interface org.axsl.fo.FoTree

getHyphenationConsumer

public org.axsl.hyphen.HyphenationConsumer getHyphenationConsumer()
Specified by:
getHyphenationConsumer in interface org.axsl.fo.FoTree

setGraphicSearchPath

public void setGraphicSearchPath(URL[] graphicSearchPath)
Specified by:
setGraphicSearchPath in interface org.axsl.fo.FoTree

getGraphicSearchPath

public URL[] getGraphicSearchPath()
Return the graphic search path.

Returns:
The graphic search path.

setCachingGraphics

public void setCachingGraphics(boolean cachingGraphics)
Specified by:
setCachingGraphics in interface org.axsl.fo.FoTree

getCachingGraphics

public boolean getCachingGraphics()
Indicates whether graphics should be cached.

Returns:
True iff graphics should be cached.

preserveRawContent

public boolean preserveRawContent()
Indicates whether we wish to preserve the raw FO Tree content so that it can be round-tripped. Setting this value to true will generally increase the amount of memory consumed, the amount of processing time consumed, or both. Setting it to false allows the system to use less memory or processing cycles, but at the cost of modifying the underlying data.

Returns:
True if the raw document content should be preserved intact.

getNextSequentialIndex

public int getNextSequentialIndex()
Returns the next sequential index.

Returns:
The next sequential index.


Copyright © 2017. All rights reserved.