From 3d598730fe1e84e080ebd43580a6a60cb75bcb7e Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sun, 18 Jul 2004 00:50:08 +0000 Subject: [PATCH] 1. New constructor for Driver created, takes FOUserAgent constructor. Used for both CLI and AWTRenderer. (Thanks to Simon Pepping) 2. Removed Driver(AWTRenderer) constructor. 3. OutputStream validation moved to FOTreeBuilder. 4. Driver.reset() removed, not currently serving a purpose. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197797 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/Driver.java | 38 +++---------------- src/java/org/apache/fop/apps/Fop.java | 5 +-- src/java/org/apache/fop/fo/FOTreeBuilder.java | 9 +++++ .../apache/fop/render/awt/AWTRenderer.java | 7 ++-- .../fop/render/awt/viewer/PreviewDialog.java | 22 +++++------ .../org/apache/fop/tools/TestConverter.java | 2 +- 6 files changed, 32 insertions(+), 51 deletions(-) diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 41ae90469..f63581689 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -31,7 +31,6 @@ import org.xml.sax.XMLReader; // FOP import org.apache.fop.fo.Constants; import org.apache.fop.fo.FOTreeBuilder; -import org.apache.fop.render.awt.AWTRenderer; /** * Primary class that drives the overall FOP process. @@ -48,10 +47,6 @@ import org.apache.fop.render.awt.AWTRenderer; * use and the OutputStream to use to output the results of the * rendering (where applicable). *

- * Once the Driver is set up, the render method - * is called. The invocation of the method is - * render(Parser, InputSource). - *

* Here is an example use of Driver which outputs to AWT: * *

@@ -70,7 +65,7 @@ public class Driver implements Constants {
     /**
      * the stream to use to output the results of the renderer
      */
-    private OutputStream stream;
+    private OutputStream stream = null;
 
     /**
      * The system resources that FOP will use
@@ -82,17 +77,6 @@ public class Driver implements Constants {
      */
     public Driver() {
         foUserAgent = new FOUserAgent();
-        stream = null;
-    }
-
-    /**
-     * Constructor for AWTRenderer, which reuses the
-     * same renderer instance for document reloading
-     */
-    public Driver(AWTRenderer render) {
-        this();
-        renderType = RENDER_AWT;
-        foUserAgent = render.getUserAgent();
     }
 
     /**
@@ -105,12 +89,11 @@ public class Driver implements Constants {
     }
 
     /**
-     * Resets the Driver so it can be reused. Property and element
-     * mappings are reset to defaults.
-     * The output stream is cleared. The renderer is cleared.
+     * Constructor with FOUserAgent
+     * Used by CLI, AWTRenderer
      */
-    public synchronized void reset() {
-        stream = null;
+    public Driver(FOUserAgent ua) {
+        foUserAgent = ua;
     }
 
     /**
@@ -139,12 +122,6 @@ public class Driver implements Constants {
         this.stream = stream;
     }
 
-    private void validateOutputStream() {
-        if (this.stream == null) {
-            throw new IllegalStateException("OutputStream has not been set");
-        }
-    }
-
     /**
      * Method to set the rendering type desired. Must be one of
      *