diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2011-01-09 12:16:18 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2011-01-09 12:16:18 +0000 |
commit | f7d9c3fa72b7b68b9b0af4ab71defd2c5dfc3e24 (patch) | |
tree | 8c8ead8cd1ffda814679c8600f2feea4b1e6c717 /src/java/org | |
parent | 2fb9c63eea373b6ec707b116286e97cfc72a594b (diff) | |
download | xmlgraphics-fop-f7d9c3fa72b7b68b9b0af4ab71defd2c5dfc3e24.tar.gz xmlgraphics-fop-f7d9c3fa72b7b68b9b0af4ab71defd2c5dfc3e24.zip |
Fix minor bug in validateChildNode() + make regions Map type-safe
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1056924 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/SimplePageMaster.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 8c95e1b8a..bd186db78 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -56,7 +56,7 @@ public class SimplePageMaster extends FObj { /** * Page regions (regionClass, Region) */ - private Map regions; + private Map<String, Region> regions; // used for node validation private boolean hasRegionBody = false; @@ -99,7 +99,7 @@ public class SimplePageMaster extends FObj { } //Well, there are only 5 regions so we can save a bit of memory here - regions = new HashMap(5); + regions = new HashMap<String, Region>(5); } /** {@inheritDoc} */ @@ -135,7 +135,7 @@ public class SimplePageMaster extends FObj { } else if (hasRegionEnd) { nodesOutOfOrderError(loc, "fo:region-before", "fo:region-end"); } else { - hasRegionBody = true; + hasRegionBefore = true; } } else if (localName.equals("region-after")) { if (!hasRegionBody) { @@ -192,8 +192,7 @@ public class SimplePageMaster extends FObj { * @param region region to add */ protected void addRegion(Region region) { - String key = String.valueOf(region.getNameId()); - regions.put(key, region); + regions.put(String.valueOf(region.getNameId()), region); } /** @@ -240,14 +239,14 @@ public class SimplePageMaster extends FObj { * @return the region, null if it doesn't exist */ public Region getRegion(int regionId) { - return (Region) regions.get(String.valueOf(regionId)); + return regions.get(String.valueOf(regionId)); } /** * Returns a Map of regions associated with this simple-page-master * @return the regions */ - public Map getRegions() { + public Map<String, Region> getRegions() { return regions; } @@ -258,9 +257,7 @@ public class SimplePageMaster extends FObj { * @return True if a region with this name exists */ protected boolean regionNameExists(String regionName) { - for (Iterator regenum = regions.values().iterator(); - regenum.hasNext();) { - Region r = (Region) regenum.next(); + for (Region r : regions.values()) { if (r.getRegionName().equals(regionName)) { return true; } |