gmazza 2004/09/06 11:28:17
Modified: src/java/org/apache/fop/fo FONode.java FOTreeBuilder.java
src/java/org/apache/fop/fo/pagination Root.java
Log:
Switched to a static FOInputHandler object for the FOTree instead of relying on
recursion to get to the FOInputHandler object stored at pagination.Root.
Revision Changes Path
1.43 +15 -1 xml-fop/src/java/org/apache/fop/fo/FONode.java
Index: FONode.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- FONode.java 5 Sep 2004 04:00:51 -0000 1.42
+++ FONode.java 6 Sep 2004 18:28:17 -0000 1.43
@@ -41,6 +41,12 @@
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;
@@ -73,12 +79,20 @@
}
/**
+ * 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;
}
/**
1.47 +1 -1 xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java
Index: FOTreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- FOTreeBuilder.java 5 Sep 2004 04:00:51 -0000 1.46
+++ FOTreeBuilder.java 6 Sep 2004 18:28:17 -0000 1.47
@@ -217,6 +217,7 @@
*/
public void startDocument() throws SAXException {
rootFObj = null; // allows FOTreeBuilder to be reused
+ FONode.setFOInputHandler(foInputHandler);
if (log.isDebugEnabled()) {
log.debug("Building formatting object tree");
}
@@ -273,7 +274,6 @@
if (rootFObj == null) {
rootFObj = (Root) foNode;
- rootFObj.setFOInputHandler(foInputHandler);
} else {
currentFObj.addChildNode(foNode);
}
1.25 +0 -25 xml-fop/src/java/org/apache/fop/fo/pagination/Root.java
Index: Root.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Root.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- Root.java 4 Sep 2004 19:53:07 -0000 1.24
+++ Root.java 6 Sep 2004 18:28:17 -0000 1.25
@@ -49,11 +49,6 @@
*/
private int runningPageNumberCounter = 0;
- /**
- * Controlling FOTreeHandler object for this FO Tree
- */
- private FOInputHandler foInputHandler = null;
-
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
@@ -200,26 +195,6 @@
*/
public Bookmarks getBookmarks() {
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;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]