From b638342ab96a6d344aab5fd9653ca24e29d90424 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Sun, 20 Jun 2004 07:46:13 +0000 Subject: [PATCH] 1. Created own logger for AbstractRenderer, removed logger setter from Renderer interface. 2. Validity checking for fo:repeatable-page-master-alternatives. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197739 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/Driver.java | 1 - .../fop/fo/pagination/LayoutMasterSet.java | 3 +++ .../RepeatablePageMasterAlternatives.java | 22 +++++++++++++++++++ .../apache/fop/render/AbstractRenderer.java | 13 +++-------- src/java/org/apache/fop/render/Renderer.java | 7 ------ .../org/apache/fop/tools/AreaTreeBuilder.java | 1 - 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/java/org/apache/fop/apps/Driver.java b/src/java/org/apache/fop/apps/Driver.java index 7b0cece47..cf4395a94 100644 --- a/src/java/org/apache/fop/apps/Driver.java +++ b/src/java/org/apache/fop/apps/Driver.java @@ -409,7 +409,6 @@ public class Driver { throws IllegalArgumentException { try { renderer = (Renderer)Class.forName(rendererClassName).newInstance(); - renderer.setLogger(getLogger()); renderer.setProducer(Version.getVersion()); renderer.setUserAgent(getUserAgent()); } catch (ClassNotFoundException e) { diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 3101df6e6..e2919c3de 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -69,6 +69,9 @@ public class LayoutMasterSet extends FObj { } } + /** + * @see org.apache.fop.fo.FONode#end + */ protected void end() { if (children == null) { missingChildElementError("(simple-page-master|page-sequence-master)+"); diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index 93b688734..701270343 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -23,8 +23,10 @@ import java.util.ArrayList; // XML import org.xml.sax.Attributes; +import org.xml.sax.Locator; // FOP +import org.apache.fop.fo.FOElementMapping; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; @@ -57,6 +59,26 @@ public class RepeatablePageMasterAlternatives extends FObj super(parent); } + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + XSL/FOP: (conditional-page-master-reference+) + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) { + if (!(nsURI == FOElementMapping.URI && + localName.equals("conditional-page-master-reference"))) { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * @see org.apache.fop.fo.FONode#end + */ + protected void end() { + if (children == null) { + missingChildElementError("(conditional-page-master-reference+)"); + } + } + /** * @see org.apache.fop.fo.FObj#addProperties */ diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java index c76b8f3b6..53a6f3b0a 100644 --- a/src/java/org/apache/fop/render/AbstractRenderer.java +++ b/src/java/org/apache/fop/render/AbstractRenderer.java @@ -64,6 +64,7 @@ import org.apache.fop.fo.Constants; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fo.pagination.Region; import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; // Avalon import org.apache.avalon.framework.configuration.Configurable; @@ -86,8 +87,8 @@ public abstract class AbstractRenderer /** * logging instance */ - protected Log logger = null; - + protected static Log logger = LogFactory.getLog("Renderer"); + /** * producer (usually "FOP") */ @@ -141,14 +142,6 @@ public abstract class AbstractRenderer public void configure(Configuration conf) throws ConfigurationException { } - /** - * Sets the Commons-Logging instance for this class - * @param logger The Commons-Logging instance - */ - public void setLogger(Log logger) { - this.logger = logger; - } - /** * Returns the Commons-Logging instance for this class * @return The Commons-Logging instance diff --git a/src/java/org/apache/fop/render/Renderer.java b/src/java/org/apache/fop/render/Renderer.java index d977e6a40..6ca5ad708 100644 --- a/src/java/org/apache/fop/render/Renderer.java +++ b/src/java/org/apache/fop/render/Renderer.java @@ -187,13 +187,6 @@ public interface Renderer { * @param cont The inline container area */ void renderContainer(Container cont); - - /** - * Tells the renderer to render an inline container. - * - * @param cont The inline container area - */ - void setLogger(Log logger); } diff --git a/src/java/org/apache/fop/tools/AreaTreeBuilder.java b/src/java/org/apache/fop/tools/AreaTreeBuilder.java index d2d0baff9..37b923d79 100644 --- a/src/java/org/apache/fop/tools/AreaTreeBuilder.java +++ b/src/java/org/apache/fop/tools/AreaTreeBuilder.java @@ -159,7 +159,6 @@ public class AreaTreeBuilder { rend = new SVGRenderer(); } - rend.setLogger(logger); FontInfo fontInfo = new FontInfo(); rend.setupFontInfo(fontInfo); FOUserAgent ua = new FOUserAgent(); -- 2.39.5