From 810dfe11fb6d2b2b17d9829e4ef49de4dc1f5975 Mon Sep 17 00:00:00 2001 From: fotis Date: Fri, 17 Nov 2000 10:18:28 +0000 Subject: [PATCH] adds a warning for regions in flows which don't exist in the layout master set [Kelly Campbell] git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193826 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/pagination/LayoutMasterSet.java | 16 +++++++++++++++- .../apache/fop/fo/pagination/PageSequence.java | 3 +++ .../fop/fo/pagination/SimplePageMaster.java | 15 ++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java index 89d32c8c5..a0bba54a6 100644 --- a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -164,7 +164,21 @@ public class LayoutMasterSet extends FObj { } } - + /** + * Checks whether or not a region name exists in this master set + * @returns true when the region name specified has a region in this LayoutMasterSet + */ + protected boolean regionNameExists(String regionName) + { + boolean result = false; + for (Enumeration e = simplePageMasters.elements(); e.hasMoreElements() ;) { + result = ((SimplePageMaster)e.nextElement()).regionNameExists(regionName); + if (result) { + return result; + } + } + return result; + } } diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java index aac9a1ed9..ee7f0deeb 100644 --- a/src/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/org/apache/fop/fo/pagination/PageSequence.java @@ -210,6 +210,9 @@ public class PageSequence extends FObj if (_flowMap.containsKey(flow.getFlowName())) { throw new FOPException("flow-names must be unique within an fo:page-sequence"); } + if (!this.layoutMasterSet.regionNameExists(flow.getFlowName())) { + MessageHandler.errorln("WARNING: region-name '"+flow.getFlowName()+"' doesn't exist in the layout-master-set."); + } _flowMap.put(flow.getFlowName(), flow); } diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java index a4bfeacde..71745c962 100644 --- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -57,8 +57,7 @@ import org.apache.fop.fo.properties.*; import org.apache.fop.layout.PageMaster; import org.apache.fop.apps.FOPException; -import java.util.Hashtable; - +import java.util.*; public class SimplePageMaster extends FObj { @@ -171,6 +170,16 @@ public class SimplePageMaster extends FObj { return _regions; } - + protected boolean regionNameExists(String regionName) + { + for (Enumeration regenum = _regions.elements(); regenum.hasMoreElements() ;) { + Region r = (Region)regenum.nextElement(); + if (r.getRegionName().equals(regionName)) { + return true; + } + } + return false; + + } } -- 2.39.5