From: Peter Bernard West Date: Tue, 16 Mar 2004 12:17:53 +0000 (+0000) Subject: startRenderer and stopRenderer methods removed. X-Git-Tag: Defoe_export~244 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=28fb995a17e3f738572c899097502d31dad3f987;p=xmlgraphics-fop.git startRenderer and stopRenderer methods removed. Many fields and their setter removed - use general options setter. Commented out many fields until design of rendering in alt-design is finalised. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197455 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index 40dce8d6f..6d3dfc484 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -18,9 +18,8 @@ package org.apache.fop.render; -import java.io.IOException; import java.io.OutputStream; -import java.util.Date; +import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; // XML @@ -33,87 +32,56 @@ import org.apache.fop.area.RegionViewport; import org.apache.fop.apps.Fop; import org.apache.fop.configuration.FOUserAgent; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; - /** * Abstract base class for all renderers. The Abstract renderer does all the * top level processing of the area tree and adds some abstract methods to * handle viewports. This keeps track of the current block and inline position. */ public abstract class AbstractRenderer - implements Renderer, Configurable { + implements Renderer { - /** - * user agent - */ + protected OutputStream output; + /** user agent */ protected FOUserAgent userAgent; - /** - * producer (usually "FOP") - */ - protected String producer = "FOP"; - - /** - * creator of document - */ - protected String creator = null; - - /** - * creation time - */ - protected Date creationDate = null; - - /** - * renderer configuration - */ - protected Map options; - - /** - * block progression position - */ - protected int currentBPPosition = 0; - - /** - * inline progression position - */ - protected int currentIPPosition = 0; - - /** - * current inline progression position in block - */ - protected int currentBlockIPPosition = 0; + /** renderer configuration */ + protected Map options = new HashMap(); - /** - * the block progression position of the containing block used for - * absolutely positioned blocks - */ - protected int containingBPPosition = 0; - - /** - * the inline progression position of the containing block used for - * absolutely positioned blocks - */ - protected int containingIPPosition = 0; +// /** block progression position */ +// protected int currentBPPosition = 0; +// +// /** inline progression position */ +// protected int currentIPPosition = 0; +// +// /** current inline progression position in block */ +// protected int currentBlockIPPosition = 0; +// +// /** +// * the block progression position of the containing block used for +// * absolutely positioned blocks +// */ +// protected int containingBPPosition = 0; +// +// /** +// * the inline progression position of the containing block used for +// * absolutely positioned blocks +// */ +// protected int containingIPPosition = 0; protected Logger log = Logger.getLogger(Fop.fopPackage); - + /** - * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration) + * Implements Runnable.run() so that this thread can be started. + * Set up the fonts and perform other initialization. + * Respond to requests from layout thread for information + * Wait for requests from layout thread for layout. */ - public void configure(Configuration conf) throws ConfigurationException { - } - - /** @see org.apache.fop.render.Renderer */ - public void setProducer(String inProducer) { - producer = inProducer; + public void run() { } - /** @see org.apache.fop.render.Renderer */ - public void setCreator(String inCreator) { - creator = inCreator; + public synchronized void setOutputStream(OutputStream output) { + this.output = output; } // /** @@ -121,33 +89,15 @@ public abstract class AbstractRenderer // */ // public abstract void setupFontInfo(FOTreeControl foTreeControl); - /** - * @see org.apache.fop.render.Renderer - */ - public void setUserAgent(FOUserAgent agent) { + /** @see org.apache.fop.render.Renderer */ + public synchronized void setUserAgent(FOUserAgent agent) { userAgent = agent; } - /** - * @param date - */ - public void setCreationDate(Date date) { - creationDate = date; - } - - /** @see org.apache.fop.render.Renderer */ - public void setOptions(Map opt) { - options = opt; + public synchronized void setOption(String key, Object value) { + options.put(key, value); } - /** @see org.apache.fop.render.Renderer */ - public void startRenderer(OutputStream outputStream) - throws IOException { } - - /** @see org.apache.fop.render.Renderer */ - public void stopRenderer() - throws IOException { } - /** * Check if this renderer supports out of order rendering. If this renderer * supports out of order rendering then it means that the pages that are diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index 4507b635d..0fd20d9f4 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -21,9 +21,6 @@ package org.apache.fop.render; // Java import java.io.OutputStream; import java.io.IOException; -import java.util.Date; -import java.util.Map; - // FOP import org.apache.fop.apps.FOPException; import org.apache.fop.area.PageViewport; @@ -41,35 +38,9 @@ import org.apache.fop.configuration.FOUserAgent; * ({@link AbstractRenderer}, {@link PrintRenderer}) which already handle a lot * of things letting you concentrate on the details of the output format. */ -public interface Renderer { - - /** - * Role constant for Avalon. - */ - String ROLE = Renderer.class.getName(); +public interface Renderer extends Runnable { - - /** - * Initiates the rendering phase. - * This must only be called once for a rendering. If - * stopRenderer is called then this may be called again - * for a new document rendering. - * - * @param outputStream The OutputStream to use for output - * @exception IOException If an I/O error occurs - */ - void startRenderer(OutputStream outputStream) - throws IOException; - - /** - * Signals the end of the rendering phase. - * The renderer should reset to an initial state and dispose of - * any resources for the completed rendering. - * - * @exception IOException If an I/O error occurs - */ - void stopRenderer() - throws IOException; + void setOutputStream(OutputStream outputStream); /** * Set the User Agent. @@ -78,40 +49,7 @@ public interface Renderer { */ void setUserAgent(FOUserAgent agent); - /** - * Set up renderer options. - * - * @param options The Configuration for the renderer - */ - void setOptions(Map options); - - /** - * Set the producer of the rendering. If this method isn't called the - * renderer uses a default. Note: Not all renderers support this feature. - * - * @param producer The name of the producer (normally "FOP") to be - * embedded in the generated file. - */ - void setProducer(String producer); - - /** - * Set the creator of the document to be rendered. - * If this method isn't called the renderer uses a default. - * Note: Not all renderers support this feature. - * - * @param creator The name of the document creator - */ - void setCreator(String creator); - - /** - * Set the creator date/timeof the document to be rendered. - * If this method isn't called the renderer uses the current date/time - * as default. - * Note: Not all renderers support this feature. - * - * @param date The name of the document creator - */ - void setCreationDate(Date date); + void setOption(String key, Object value); /** * Reports if out of order rendering is supported.