aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-09-06 18:28:17 +0000
committerGlen Mazza <gmazza@apache.org>2004-09-06 18:28:17 +0000
commit42dc46911b6f085878be224ab0787e69a524fcb0 (patch)
tree9da5f232c0c65cecbab23f10d557da8e094d31ef /src/java/org/apache/fop
parent04e3d089d6faef74065f9de7fdbec0862f97669b (diff)
downloadxmlgraphics-fop-42dc46911b6f085878be224ab0787e69a524fcb0.tar.gz
xmlgraphics-fop-42dc46911b6f085878be224ab0787e69a524fcb0.zip
PR:
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
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/fo/FONode.java16
-rw-r--r--src/java/org/apache/fop/fo/FOTreeBuilder.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/Root.java25
3 files changed, 16 insertions, 27 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index 193b92e57..c42577f7c 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -41,6 +41,12 @@ public abstract class FONode {
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 @@ public abstract class FONode {
}
/**
+ * 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;
}
/**
diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java
index da0f6f6c9..a5b94d978 100644
--- a/src/java/org/apache/fop/fo/FOTreeBuilder.java
+++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java
@@ -217,6 +217,7 @@ public class FOTreeBuilder extends DefaultHandler {
*/
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 @@ public class FOTreeBuilder extends DefaultHandler {
if (rootFObj == null) {
rootFObj = (Root) foNode;
- rootFObj.setFOInputHandler(foInputHandler);
} else {
currentFObj.addChildNode(foNode);
}
diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java
index a879f9469..71e0c5ffe 100644
--- a/src/java/org/apache/fop/fo/pagination/Root.java
+++ b/src/java/org/apache/fop/fo/pagination/Root.java
@@ -49,11 +49,6 @@ public class Root extends FObj {
*/
private int runningPageNumberCounter = 0;
- /**
- * Controlling FOTreeHandler object for this FO Tree
- */
- private FOInputHandler foInputHandler = null;
-
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
@@ -203,26 +198,6 @@ public class Root extends FObj {
}
/**
- * 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()
*/
public String getName() {