Obtained from:
Submitted by:
Reviewed by:
Switched to a static FOInputHandler object for the FOTree instead of relying on recursion to get to the FOInputHandler object stored at pagination.Root.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197910
13f79535-47bb-0310-9956-
ffa450edef68
protected static String FO_URI = FOElementMapping.URI;
+ /**
+ * FOInputHandler that handles FO events occurring
+ * during FO Tree processing.
+ */
+ protected static FOInputHandler foInputHandler = null;
+
/** Parent FO node */
protected FONode parent;
}
}
+ /**
+ * Sets the FOInputHandler that the FOTree processing fires events to
+ * @param inputHandler the FOInputHandler subclass to send FO events to
+ */
+ public static void setFOInputHandler(FOInputHandler inputHandler) {
+ FONode.foInputHandler = inputHandler;
+ }
+
/**
* Recursively goes up the FOTree hierarchy until the fo:root is found,
* which returns the parent FOInputHandler.
* @return the FOInputHandler object that is the parent of the FO Tree
*/
public FOInputHandler getFOInputHandler() {
- return parent.getFOInputHandler();
+ return FONode.foInputHandler;
}
/**
*/
public void startDocument() throws SAXException {
rootFObj = null; // allows FOTreeBuilder to be reused
+ FONode.setFOInputHandler(foInputHandler);
if (log.isDebugEnabled()) {
log.debug("Building formatting object tree");
}
if (rootFObj == null) {
rootFObj = (Root) foNode;
- rootFObj.setFOInputHandler(foInputHandler);
} else {
currentFObj.addChildNode(foNode);
}
*/
private int runningPageNumberCounter = 0;
- /**
- * Controlling FOTreeHandler object for this FO Tree
- */
- private FOInputHandler foInputHandler = null;
-
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
return bookmarks;
}
- /**
- * Sets the Document that this Root is attached to
- * @param document the apps.Document implementation to which this Root
- * is attached
- */
- public void setFOInputHandler(FOInputHandler foInputHandler) {
- this.foInputHandler = foInputHandler;
- }
-
- /**
- * This method overrides the FONode version. The FONode version calls the
- * method by the same name for the parent object. Since Root is at the top
- * of the tree, it returns the actual FOInputHandler object. Thus, any FONode
- * can use this chain to find which FOInputHandler it is being built for.
- * @return the FOInputHandler implementation that this Root is attached to
- */
- public FOInputHandler getFOInputHandler() {
- return foInputHandler;
- }
-
/**
* @see org.apache.fop.fo.FObj#getName()
*/