]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
1. move renderer initialization work from FOTreeHandler to Driver
authorWilliam Victor Mote <vmote@apache.org>
Fri, 22 Aug 2003 17:21:48 +0000 (17:21 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Fri, 22 Aug 2003 17:21:48 +0000 (17:21 +0000)
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
src/java/org/apache/fop/fo/FOTreeHandler.java

index 560956a503558e14ecca086d44481fb6bd1060ca..39bff67998663488be3b50d176bcdd4ec9757ac4 100644 (file)
@@ -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
index 6556d4bbbd5316168afdea8e362d20dc97f3a0a2..90fc2278d94194e907f56965eb82e0c797a895ff 100644 (file)
@@ -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. <B>Note</B> 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);
-        }
     }
 
     /**