You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ar...@locus.apache.org on 2000/10/10 04:10:47 UTC
cvs commit: xml-fop/src/org/apache/fop/fo/pagination SimplePageMaster.java
arved 00/10/09 19:10:47
Modified: src/org/apache/fop/fo/pagination Tag: fop-0_14_0_regions
SimplePageMaster.java
Log:
region-name/multiple flow support
Revision Changes Path
No revision
No revision
1.7.4.1 +61 -10 xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java
Index: SimplePageMaster.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -u -r1.7 -r1.7.4.1
--- SimplePageMaster.java 2000/07/11 02:30:50 1.7
+++ SimplePageMaster.java 2000/10/10 02:10:46 1.7.4.1
@@ -1,4 +1,4 @@
-/*-- $Id: SimplePageMaster.java,v 1.7 2000/07/11 02:30:50 arved Exp $ --
+/*-- $Id: SimplePageMaster.java,v 1.7.4.1 2000/10/10 02:10:46 arved Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -58,6 +58,8 @@
import org.apache.fop.layout.Region;
import org.apache.fop.apps.FOPException;
+import java.util.Hashtable;
+
public class SimplePageMaster extends FObj {
public static class Maker extends FObj.Maker {
@@ -74,6 +76,8 @@
RegionBody regionBody;
RegionBefore regionBefore;
RegionAfter regionAfter;
+ private Hashtable regions;
+ private String masterName;
LayoutMasterSet layoutMasterSet;
PageMaster pageMaster;
@@ -83,14 +87,17 @@
super(parent, propertyList);
this.name = "fo:simple-page-master";
+ this.regions = new Hashtable();
+
if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet) parent;
String pm = this.properties.get("master-name").getString();
- if (pm == null) {
+ if (pm.equals("")) {
MessageHandler.errorln("WARNING: simple-page-master does not have "
+ "a master-name and so is being ignored");
} else {
this.layoutMasterSet.addSimplePageMaster(pm, this);
+ this.masterName = pm;
}
} else {
throw new FOPException("fo:simple-page-master must be child "
@@ -130,15 +137,59 @@
return this.pageMaster;
}
- protected void setRegionAfter(RegionAfter region) {
- this.regionAfter = region;
+ protected void setRegionAfter(RegionAfter region)
+ throws FOPException {
+ if (regions.containsKey(region.getRegionName()))
+ {
+ throw new FOPException("region names must be unique"
+ + " within simple-page-master '"
+ + getMasterName() + "'");
+ }
+ else
+ {
+ regions.put(region.getRegionName(), region.getName());
+ }
+ this.regionAfter = region;
+ }
+
+ protected void setRegionBefore(RegionBefore region)
+ throws FOPException {
+ if (regions.containsKey(region.getRegionName()))
+ {
+ throw new FOPException("region names must be unique"
+ + " within simple-page-master '"
+ + getMasterName() + "'");
+ }
+ else
+ {
+ regions.put(region.getRegionName(), region.getName());
+ }
+ this.regionBefore = region;
+ }
+
+ protected void setRegionBody(RegionBody region)
+ throws FOPException {
+ if (regions.containsKey(region.getRegionName()))
+ {
+ throw new FOPException("region names must be unique"
+ + " within simple-page-master '"
+ + getMasterName() + "'");
+ }
+ else
+ {
+ regions.put(region.getRegionName(), region.getName());
+ }
+ this.regionBody = region;
}
+
+ public Hashtable getRegions()
+ {
+ return regions;
+ }
- protected void setRegionBefore(RegionBefore region) {
- this.regionBefore = region;
- }
+ public String getMasterName()
+ {
+ return masterName;
+ }
- protected void setRegionBody(RegionBody region) {
- this.regionBody = region;
- }
}