diff options
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java')
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 482ec83c4..c4189d0c4 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -44,8 +44,8 @@ import org.apache.fop.fo.ValidationException; */ public class LayoutMasterSet extends FObj { - private Map simplePageMasters; - private Map pageSequenceMasters; + private Map<String, SimplePageMaster> simplePageMasters; + private Map<String, PageSequenceMaster> pageSequenceMasters; /** * Create a LayoutMasterSet instance that is a child of the given @@ -65,8 +65,8 @@ public class LayoutMasterSet extends FObj { /** {@inheritDoc} */ protected void startOfNode() throws FOPException { getRoot().setLayoutMasterSet(this); - simplePageMasters = new java.util.HashMap(); - pageSequenceMasters = new java.util.HashMap(); + simplePageMasters = new java.util.HashMap<String, SimplePageMaster>(); + pageSequenceMasters = new java.util.HashMap<String, PageSequenceMaster>(); } /** {@inheritDoc} */ @@ -98,18 +98,13 @@ public class LayoutMasterSet extends FObj { */ private void checkRegionNames() throws ValidationException { // (user-entered) region-name to default region map. - Map allRegions = new java.util.HashMap(); - for (Iterator spm = simplePageMasters.values().iterator(); - spm.hasNext();) { - SimplePageMaster simplePageMaster - = (SimplePageMaster)spm.next(); - Map spmRegions = simplePageMaster.getRegions(); - for (Iterator e = spmRegions.values().iterator(); - e.hasNext();) { - Region region = (Region) e.next(); + Map<String, String> allRegions = new java.util.HashMap<String, String>(); + for (SimplePageMaster simplePageMaster : simplePageMasters.values()) { + Map<String, Region> spmRegions = simplePageMaster.getRegions(); + for (Region region : spmRegions.values()) { if (allRegions.containsKey(region.getRegionName())) { String defaultRegionName - = (String) allRegions.get(region.getRegionName()); + = allRegions.get(region.getRegionName()); if (!defaultRegionName.equals(region.getDefaultRegionName())) { getFOValidationEventProducer().regionNameMappedToMultipleRegionClasses(this, region.getRegionName(), @@ -118,7 +113,7 @@ public class LayoutMasterSet extends FObj { } } allRegions.put(region.getRegionName(), - region.getDefaultRegionName()); + region.getDefaultRegionName()); } } } @@ -155,7 +150,7 @@ public class LayoutMasterSet extends FObj { * @return the requested simple-page-master */ public SimplePageMaster getSimplePageMaster(String masterName) { - return (SimplePageMaster)this.simplePageMasters.get(masterName); + return this.simplePageMasters.get(masterName); } /** @@ -185,7 +180,7 @@ public class LayoutMasterSet extends FObj { * @return the requested PageSequenceMaster instance */ public PageSequenceMaster getPageSequenceMaster(String masterName) { - return (PageSequenceMaster)this.pageSequenceMasters.get(masterName); + return this.pageSequenceMasters.get(masterName); } /** @@ -194,9 +189,8 @@ public class LayoutMasterSet extends FObj { * @return true when the region name specified has a region in this LayoutMasterSet */ public boolean regionNameExists(String regionName) { - for (Iterator e = simplePageMasters.values().iterator(); - e.hasNext();) { - if (((SimplePageMaster)e.next()).regionNameExists(regionName)) { + for (SimplePageMaster spm : simplePageMasters.values()) { + if (spm.regionNameExists(regionName)) { return true; } } |