vmote 2003/10/06 09:38:48 Modified: src/java/org/apache/fop/apps Document.java Driver.java src/java/org/apache/fop/area AreaTree.java src/java/org/apache/fop/layoutmgr LayoutManagerLS.java src/java/org/apache/fop/tools AreaTreeBuilder.java Added: src/java/org/apache/fop/area AreaTreeControl.java Log: 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 Revision Changes Path 1.9 +4 -2 xml-fop/src/java/org/apache/fop/apps/Document.java Index: Document.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Document.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Document.java 2 Sep 2003 13:56:40 -0000 1.8 +++ Document.java 6 Oct 2003 16:38:48 -0000 1.9 @@ -61,6 +61,7 @@ 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 @@ * 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; 1.42 +1 -1 xml-fop/src/java/org/apache/fop/apps/Driver.java Index: Driver.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/Driver.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Driver.java 17 Sep 2003 16:48:02 -0000 1.41 +++ Driver.java 6 Oct 2003 16:38:48 -0000 1.42 @@ -590,7 +590,7 @@ 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); 1.5 +15 -5 xml-fop/src/java/org/apache/fop/area/AreaTree.java Index: AreaTree.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTree.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AreaTree.java 6 Oct 2003 16:06:11 -0000 1.4 +++ AreaTree.java 6 Oct 2003 16:38:48 -0000 1.5 @@ -83,6 +83,7 @@ // 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 @@ 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 @@ /** * 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); 1.1 xml-fop/src/java/org/apache/fop/area/AreaTreeControl.java Index: AreaTreeControl.java =================================================================== /* * $Id: AreaTreeControl.java,v 1.1 2003/10/06 16:38:48 vmote Exp $ * ============================================================================ * 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 * [EMAIL PROTECTED] * * 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 <[EMAIL PROTECTED]>. 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(); } 1.17 +2 -2 xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java Index: LayoutManagerLS.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- LayoutManagerLS.java 6 Oct 2003 15:52:46 -0000 1.16 +++ LayoutManagerLS.java 6 Oct 2003 16:38:48 -0000 1.17 @@ -94,7 +94,7 @@ return; } - areaTree.addBookmarksToAreaTree(this.document); + areaTree.addBookmarksToAreaTree(); // Initialize if already used? // this.layoutMasterSet.resetPageMasters(); 1.9 +1 -1 xml-fop/src/java/org/apache/fop/tools/AreaTreeBuilder.java Index: AreaTreeBuilder.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/tools/AreaTreeBuilder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- AreaTreeBuilder.java 27 Aug 2003 18:14:46 -0000 1.8 +++ AreaTreeBuilder.java 6 Oct 2003 16:38:48 -0000 1.9 @@ -273,7 +273,7 @@ Element root = null; root = doc.getDocumentElement(); - areaTree = new AreaTree(); + areaTree = new AreaTree(fontInfo); areaTree.setTreeModel(model); readAreaTree(root);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]