/** The registry for ElementMapping instances */
protected ElementMappingRegistry elementMappingRegistry;
- /**
- * The root of the formatting object tree
- */
+ /** The root of the formatting object tree */
protected Root rootFObj = null;
/** Main DefaultHandler that handles the FO namespace. */
/** Current delegate ContentHandler to receive the SAX events */
protected ContentHandler delegate;
- /**
- * The class that handles formatting and rendering to a stream
- * (mark-fop@inomial.com)
- */
+ /** The object that handles formatting and rendering to a stream */
private FOEventHandler foEventHandler;
/** The SAX locator object managing the line and column counters */
private int depth;
/**
- * FOTreeBuilder constructor
+ * <code>FOTreeBuilder</code> constructor
+ *
* @param outputFormat the MIME type of the output format to use (ex. "application/pdf").
- * @param foUserAgent in effect for this process
- * @param stream OutputStream to direct results
- * @throws FOPException if the FOTreeBuilder cannot be properly created
+ * @param foUserAgent the {@link FOUserAgent} in effect for this process
+ * @param stream the <code>OutputStream</code> to direct the results to
+ * @throws FOPException if the <code>FOTreeBuilder</code> cannot be properly created
*/
- public FOTreeBuilder(String outputFormat, FOUserAgent foUserAgent,
- OutputStream stream) throws FOPException {
+ public FOTreeBuilder(
+ String outputFormat,
+ FOUserAgent foUserAgent,
+ OutputStream stream)
+ throws FOPException {
this.userAgent = foUserAgent;
this.elementMappingRegistry = userAgent.getFactory().getElementMappingRegistry();
});
}
- /**
- * This method enables to reduce memory consumption of the FO tree slightly. When it returns
- * true no Locator is passed to the FO tree nodes which would copy the information into
- * a SAX LocatorImpl instance.
- * @return true if no context information should be stored on each node in the FO tree.
- * @deprecated Use FOUserAgent.isLocatorEnabled() instead.
- */
- protected boolean isLocatorDisabled() {
- return !userAgent.isLocatorEnabled();
- }
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void setDocumentLocator(Locator locator) {
this.locator = locator;
}
- /** @return a Locator instance if it is available and not disabled */
+ /**
+ * @return a {@link Locator} instance if it is available and not disabled
+ */
protected Locator getEffectiveLocator() {
return (userAgent.isLocatorEnabled() ? this.locator : null);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void characters(char[] data, int start, int length)
throws SAXException {
delegate.characters(data, start, length);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void startDocument() throws SAXException {
if (used) {
throw new IllegalStateException("FOTreeBuilder (and the Fop class) cannot be reused."
this.delegate = this.mainFOHandler;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void endDocument() throws SAXException {
this.delegate.endDocument();
if (this.rootFObj == null && empty) {
imageFactory.removeContext(this.userAgent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void startElement(String namespaceURI, String localName, String rawName,
Attributes attlist) throws SAXException {
this.depth++;
delegate.startElement(namespaceURI, localName, rawName, attlist);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void endElement(String uri, String localName, String rawName)
throws SAXException {
this.delegate.endElement(uri, localName, rawName);
}
/**
- * Finds the Maker used to create node objects of a particular type
+ * Finds the {@link Maker} used to create {@link FONode} objects of a particular type
+ *
* @param namespaceURI URI for the namespace of the element
* @param localName name of the Element
* @return the ElementMapping.Maker that can create an FO object for this element
/** {@inheritDoc} */
public void warning(SAXParseException e) {
- log.warn(e.toString());
+ log.warn(e.getLocalizedMessage());
}
/** {@inheritDoc} */
}
/**
- * Provides access to the underlying FOEventHandler object.
+ * Provides access to the underlying {@link FOEventHandler} object.
+ *
* @return the FOEventHandler object
*/
public FOEventHandler getEventHandler() {
* Returns the results of the rendering process. Information includes
* the total number of pages generated and the number of pages per
* page-sequence.
+ *
* @return the results of the rendering process.
*/
public FormattingResults getResults() {
}
/**
- * Main DefaultHandler implementation which builds the FO tree.
+ * Main <code>DefaultHandler</code> implementation which builds the FO tree.
*/
private class MainFOHandler extends DefaultHandler {
- /**
- * Current formatting object being handled
- */
+ /** Current formatting object being handled */
protected FONode currentFObj = null;
- /**
- * Current propertyList for the node being handled.
- */
+ /** Current propertyList for the node being handled */
protected PropertyList currentPropertyList;
- /**
- * Current marker nesting-depth
- */
+ /** Current marker nesting-depth */
private int nestedMarkerDepth = 0;
/** {@inheritDoc} */
} else { // check that incoming node is valid for currentFObj
if (namespaceURI.equals(FOElementMapping.URI)
|| namespaceURI.equals(ExtensionElementMapping.URI)) {
- try {
- currentFObj.validateChildNode(locator, namespaceURI, localName);
- } catch (ValidationException e) {
- throw e;
- }
+ currentFObj.validateChildNode(locator, namespaceURI, localName);
}
}
if (currentFObj.getParent() == null) {
log.debug("endElement for top-level " + currentFObj.getName());
}
+
currentFObj = currentFObj.getParent();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void characters(char[] data, int start, int length)
throws FOPException {
if (currentFObj != null) {
}
}
+ /** {@inheritDoc} */
public void endDocument() throws SAXException {
currentFObj = null;
}