diff options
author | fotis <fotis@unknown> | 2000-11-17 10:18:28 +0000 |
---|---|---|
committer | fotis <fotis@unknown> | 2000-11-17 10:18:28 +0000 |
commit | 810dfe11fb6d2b2b17d9829e4ef49de4dc1f5975 (patch) | |
tree | 8e128f4659645994691f0621ad0c0d2532fb79e7 /src | |
parent | d7ed299805d46d9b135d59da477e57bb2eb68984 (diff) | |
download | xmlgraphics-fop-810dfe11fb6d2b2b17d9829e4ef49de4dc1f5975.tar.gz xmlgraphics-fop-810dfe11fb6d2b2b17d9829e4ef49de4dc1f5975.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/org/apache/fop/fo/pagination/LayoutMasterSet.java | 16 | ||||
-rw-r--r-- | src/org/apache/fop/fo/pagination/PageSequence.java | 3 | ||||
-rw-r--r-- | src/org/apache/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; + + } } |