aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-10-06 16:38:48 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-10-06 16:38:48 +0000
commitcdd59c2b332948f9289c92a63df525a7d85402c2 (patch)
tree138aa3c8b083f3e5d401cc03e05e6e117a5afb24 /src/java/org/apache
parentacc70edc80cb823fa643a54171500a7f2685cc0f (diff)
downloadxmlgraphics-fop-cdd59c2b332948f9289c92a63df525a7d85402c2.tar.gz
xmlgraphics-fop-cdd59c2b332948f9289c92a63df525a7d85402c2.zip
1. add an AreaTreeControl interface
2. make apps/Document implement it 3. tie the AreaTree to an AreaTreeControl object 4. clean up AreaTree to use its parent AreaTreeControl object git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196944 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/apps/Document.java4
-rw-r--r--src/java/org/apache/fop/apps/Driver.java2
-rw-r--r--src/java/org/apache/fop/area/AreaTree.java20
-rw-r--r--src/java/org/apache/fop/area/AreaTreeControl.java79
-rw-r--r--src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java2
-rw-r--r--src/java/org/apache/fop/tools/AreaTreeBuilder.java2
6 files changed, 100 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/apps/Document.java b/src/java/org/apache/fop/apps/Document.java
index b5efd34eb..b284c5dfb 100644
--- a/src/java/org/apache/fop/apps/Document.java
+++ b/src/java/org/apache/fop/apps/Document.java
@@ -61,6 +61,7 @@ import java.util.HashSet;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.AreaTree;
+import org.apache.fop.area.AreaTreeControl;
import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.fo.extensions.Bookmarks;
@@ -83,7 +84,8 @@ import org.apache.avalon.framework.logger.Logger;
* Class storing information for the FOP Document being processed, and managing
* the processing of it.
*/
-public class Document implements FOTreeControl, FOTreeListener {
+public class Document implements FOTreeControl, FOTreeListener,
+ AreaTreeControl {
/** The parent Driver object */
private Driver driver;
diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java
index add324ed5..3ed6d47fb 100644
--- a/src/java/org/apache/fop/apps/Driver.java
+++ b/src/java/org/apache/fop/apps/Driver.java
@@ -590,7 +590,7 @@ public class Driver implements LogEnabled {
if (foInputHandler instanceof FOTreeHandler) {
FOTreeHandler foTreeHandler = (FOTreeHandler)foInputHandler;
foTreeHandler.addFOTreeListener(currentDocument);
- currentDocument.areaTree = new AreaTree();
+ currentDocument.areaTree = new AreaTree(currentDocument);
currentDocument.atModel = new RenderPagesModel(renderer);
//this.atModel = new CachedRenderPagesModel(renderer);
currentDocument.areaTree.setTreeModel(currentDocument.atModel);
diff --git a/src/java/org/apache/fop/area/AreaTree.java b/src/java/org/apache/fop/area/AreaTree.java
index 2191be916..0076ef16b 100644
--- a/src/java/org/apache/fop/area/AreaTree.java
+++ b/src/java/org/apache/fop/area/AreaTree.java
@@ -83,6 +83,7 @@ public class AreaTree {
// allows for different models to deal with adding/rendering
// in different situations
private AreaTreeModel model;
+ private AreaTreeControl atControl;
// hashmap of arraylists containing pages with id area
private Map idLocations = new HashMap();
@@ -91,6 +92,15 @@ public class AreaTree {
private List treeExtensions = new ArrayList();
/**
+ * Constructor.
+ * @param atControl the AreaTreeControl object controlling this AreaTree
+ */
+ public AreaTree (AreaTreeControl atControl) {
+ this.atControl = atControl;
+ }
+
+
+ /**
* Create a new store pages model.
* @return StorePagesModel the new model
*/
@@ -241,14 +251,14 @@ public class AreaTree {
/**
* Create the bookmark data in the area tree.
*/
- public void addBookmarksToAreaTree(Document document) {
- if (document.getBookmarks() == null) {
+ public void addBookmarksToAreaTree() {
+ if (atControl.getBookmarks() == null) {
return;
}
- document.getDriver().getLogger().debug("adding bookmarks to area tree");
+ atControl.getLogger().debug("adding bookmarks to area tree");
BookmarkData data = new BookmarkData();
- for (int count = 0; count < document.getBookmarks().getOutlines().size(); count++) {
- Outline out = (Outline)(document.getBookmarks().getOutlines()).get(count);
+ for (int count = 0; count < atControl.getBookmarks().getOutlines().size(); count++) {
+ Outline out = (Outline)(atControl.getBookmarks().getOutlines()).get(count);
data.addSubData(createBookmarkData(out));
}
addTreeExtension(data);
diff --git a/src/java/org/apache/fop/area/AreaTreeControl.java b/src/java/org/apache/fop/area/AreaTreeControl.java
new file mode 100644
index 000000000..1db93735c
--- /dev/null
+++ b/src/java/org/apache/fop/area/AreaTreeControl.java
@@ -0,0 +1,79 @@
+/*
+ * $Id$
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
+
+package org.apache.fop.area;
+
+// FOP
+import org.apache.fop.fo.extensions.Bookmarks;
+
+// Avalon
+import org.apache.avalon.framework.logger.Logger;
+
+/**
+ * An interface for classes that are conceptually the parent class of the
+ * area.AreaTree object. The purpose of the interface is to keep the AreaTree
+ * isolated from apps, but to acknowledge that a higher-level object is needed
+ * to control the Area Tree, to provide it with information about the
+ * environment, and to keep track of meta information.
+ */
+public interface AreaTreeControl {
+
+ /**
+ * @return the Bookmark object encapsulating the bookmarks for the FO Tree.
+ */
+ Bookmarks getBookmarks();
+
+ /**
+ * @return the Logger being used with this FO Tree
+ */
+ Logger getLogger();
+
+}
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java
index bcf8692aa..c63281b5f 100644
--- a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java
+++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java
@@ -94,7 +94,7 @@ public class LayoutManagerLS extends LayoutStrategy {
return;
}
- areaTree.addBookmarksToAreaTree(this.document);
+ areaTree.addBookmarksToAreaTree();
// Initialize if already used?
// this.layoutMasterSet.resetPageMasters();
diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java
index 2f4eafc39..244093990 100644
--- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java
+++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java
@@ -273,7 +273,7 @@ class TreeLoader extends AbstractLogEnabled {
Element root = null;
root = doc.getDocumentElement();
- areaTree = new AreaTree();
+ areaTree = new AreaTree(fontInfo);
areaTree.setTreeModel(model);
readAreaTree(root);