aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area/Page.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/area/Page.java')
-rw-r--r--src/java/org/apache/fop/area/Page.java53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/java/org/apache/fop/area/Page.java b/src/java/org/apache/fop/area/Page.java
index 715bcfe85..a1d9e389f 100644
--- a/src/java/org/apache/fop/area/Page.java
+++ b/src/java/org/apache/fop/area/Page.java
@@ -22,19 +22,26 @@ package org.apache.fop.area;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.Serializable;
-import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.SimplePercentBaseContext;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.RegionBody;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.layoutmgr.TraitSetter;
+import static org.apache.fop.fo.Constants.FO_REGION_AFTER;
+import static org.apache.fop.fo.Constants.FO_REGION_BEFORE;
+import static org.apache.fop.fo.Constants.FO_REGION_BODY;
+import static org.apache.fop.fo.Constants.FO_REGION_END;
+import static org.apache.fop.fo.Constants.FO_REGION_START;
+import static org.apache.fop.fo.Constants.EN_ERROR_IF_OVERFLOW;
+import static org.apache.fop.fo.Constants.EN_HIDDEN;
+
/**
* The page.
* This holds the contents of the page. Each region is added.
@@ -58,7 +65,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
private RegionViewport regionAfter = null;
// temporary map of unresolved objects used when serializing the page
- private Map unresolved = null;
+ private Map<String, List<Resolvable>> unresolved = null;
/** Set to true to make this page behave as if it were not empty. */
private boolean fakeNonEmpty = false;
@@ -119,12 +126,10 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
spm.getWritingMode(), pageRefRect, reldims);
// Create a RegionViewport/ reference area pair for each page region
- RegionReference rr = null;
- for (Iterator regenum = spm.getRegions().values().iterator();
- regenum.hasNext();) {
- Region r = (Region)regenum.next();
+ RegionReference rr;
+ for (Region r : spm.getRegions().values()) {
RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM);
- if (r.getNameId() == Constants.FO_REGION_BODY) {
+ if (r.getNameId() == FO_REGION_BODY) {
rr = new BodyRegion((RegionBody) r, rvp);
} else {
rr = new RegionReference(r, rvp);
@@ -155,7 +160,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
* @param pageCTM page coordinate transformation matrix
* @return the new region viewport
*/
- private RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM) {
+ private static RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM) {
Rectangle2D relRegionRect = r.getViewportRectangle(reldims);
Rectangle2D absRegionRect = pageCTM.transform(relRegionRect);
// Get the region viewport rectangle in absolute coords by
@@ -164,8 +169,8 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
rv.setBPD((int)relRegionRect.getHeight());
rv.setIPD((int)relRegionRect.getWidth());
TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground(), null);
- rv.setClip(r.getOverflow() == Constants.EN_HIDDEN
- || r.getOverflow() == Constants.EN_ERROR_IF_OVERFLOW);
+ rv.setClip(r.getOverflow() == EN_HIDDEN
+ || r.getOverflow() == EN_ERROR_IF_OVERFLOW);
return rv;
}
@@ -180,7 +185,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
* where x=distance from left, y=distance from bottom, width=right-left
* height=top-bottom
*/
- private void setRegionReferencePosition(RegionReference rr, Region r,
+ private static void setRegionReferencePosition(RegionReference rr, Region r,
Rectangle2D absRegVPRect) {
FODimension reldims = new FODimension(0, 0);
rr.setCTM(CTM.getCTMandRelDims(r.getReferenceOrientation(),
@@ -200,15 +205,15 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
* @param port the region viewport to set
*/
public void setRegionViewport(int areaclass, RegionViewport port) {
- if (areaclass == Constants.FO_REGION_BEFORE) {
+ if (areaclass == FO_REGION_BEFORE) {
regionBefore = port;
- } else if (areaclass == Constants.FO_REGION_START) {
+ } else if (areaclass == FO_REGION_START) {
regionStart = port;
- } else if (areaclass == Constants.FO_REGION_BODY) {
+ } else if (areaclass == FO_REGION_BODY) {
regionBody = port;
- } else if (areaclass == Constants.FO_REGION_END) {
+ } else if (areaclass == FO_REGION_END) {
regionEnd = port;
- } else if (areaclass == Constants.FO_REGION_AFTER) {
+ } else if (areaclass == FO_REGION_AFTER) {
regionAfter = port;
}
}
@@ -221,15 +226,15 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
*/
public RegionViewport getRegionViewport(int areaClass) {
switch (areaClass) {
- case Constants.FO_REGION_BEFORE:
+ case FO_REGION_BEFORE:
return regionBefore;
- case Constants.FO_REGION_START:
+ case FO_REGION_START:
return regionStart;
- case Constants.FO_REGION_BODY:
+ case FO_REGION_BODY:
return regionBody;
- case Constants.FO_REGION_END:
+ case FO_REGION_END:
return regionEnd;
- case Constants.FO_REGION_AFTER:
+ case FO_REGION_AFTER:
return regionAfter;
default:
throw new IllegalArgumentException("No such area class with ID = " + areaClass);
@@ -284,7 +289,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
*
* @param unres the Map of unresolved objects
*/
- public void setUnresolvedReferences(Map unres) {
+ public void setUnresolvedReferences(Map<String, List<Resolvable>> unres) {
unresolved = unres;
}
@@ -295,7 +300,7 @@ public class Page extends AreaTreeObject implements Serializable, Cloneable {
*
* @return the de-serialized HashMap of unresolved objects
*/
- public Map getUnresolvedReferences() {
+ public Map<String, List<Resolvable>> getUnresolvedReferences() {
return unresolved;
}