From 3d3636f66834679a1a71dd3a1db96bfcc51e8af7 Mon Sep 17 00:00:00 2001 From: William Victor Mote Date: Fri, 22 Aug 2003 17:21:48 +0000 Subject: [PATCH] 1. move renderer initialization work from FOTreeHandler to Driver 2. clean up related FOTreeHandler constructor git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196826 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/Driver.java | 13 ++++++- src/java/org/apache/fop/fo/FOTreeHandler.java | 35 +------------------ 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 560956a50..39bff6799 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -534,7 +534,7 @@ public class Driver implements LogEnabled { throw new IllegalStateException( "Renderer not set when using standard foInputHandler"); } - foInputHandler = new FOTreeHandler(currentDocument, stream, renderer, true); + foInputHandler = new FOTreeHandler(currentDocument, true); } foInputHandler.enableLogging(getLogger()); @@ -590,6 +590,17 @@ public class Driver implements LogEnabled { currentDocument.atModel = AreaTree.createRenderPagesModel(renderer); //this.atModel = new CachedRenderPagesModel(renderer); currentDocument.areaTree.setTreeModel(currentDocument.atModel); + try { + renderer.setupFontInfo(currentDocument); + // check that the "any,normal,400" font exists + if (!currentDocument.isSetupValid()) { + throw new SAXException(new FOPException( + "No default font defined by OutputConverter")); + } + renderer.startRenderer(stream); + } catch (IOException e) { + throw new SAXException(e); + } } /** The following statement triggers virtually all of the processing diff --git a/src/java/org/apache/fop/fo/FOTreeHandler.java b/src/java/org/apache/fop/fo/FOTreeHandler.java index 6556d4bbb..90fc2278d 100644 --- a/src/java/org/apache/fop/fo/FOTreeHandler.java +++ b/src/java/org/apache/fop/fo/FOTreeHandler.java @@ -51,8 +51,6 @@ package org.apache.fop.fo; // Java -import java.io.IOException; -import java.io.OutputStream; import java.util.HashSet; import java.util.Iterator; @@ -73,7 +71,6 @@ import org.apache.fop.fo.flow.TableCell; import org.apache.fop.fo.flow.TableRow; import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; -import org.apache.fop.render.Renderer; /** * Defines how SAX events specific to XSL-FO input should be handled when @@ -109,19 +106,6 @@ public class FOTreeHandler extends FOInputHandler { */ private long startTime; - /** - * The stream to which this rendering is to be - * written to. Note that some renderers - * do not render to a stream, and that this - * member can therefore be null. - */ - private OutputStream outputStream; - - /** - * The renderer being used. - */ - private Renderer renderer; - /** * Collection of objects that have registered to be notified about * FOTreeEvent firings. @@ -132,20 +116,14 @@ public class FOTreeHandler extends FOInputHandler { * Main constructor * @param foTreeControl the FOTreeControl implementation that governs this * FO Tree - * @param outputStream the stream that the result is rendered to - * @param renderer the renderer to call * @param store if true then use the store pages model and keep the * area tree in memory */ - public FOTreeHandler(FOTreeControl foTreeControl, OutputStream outputStream, - Renderer renderer, boolean store) { + public FOTreeHandler(FOTreeControl foTreeControl, boolean store) { super(foTreeControl); if (collectStatistics) { runtime = Runtime.getRuntime(); } - this.outputStream = outputStream; - this.renderer = renderer; - } /** @@ -165,17 +143,6 @@ public class FOTreeHandler extends FOInputHandler { initialMemory = runtime.totalMemory() - runtime.freeMemory(); startTime = System.currentTimeMillis(); } - try { - renderer.setupFontInfo(foTreeControl); - // check that the "any,normal,400" font exists - if (!foTreeControl.isSetupValid()) { - throw new SAXException(new FOPException( - "No default font defined by OutputConverter")); - } - renderer.startRenderer(outputStream); - } catch (IOException e) { - throw new SAXException(e); - } } /** -- 2.39.5