aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2005-05-14 19:28:32 +0000
committerGlen Mazza <gmazza@apache.org>2005-05-14 19:28:32 +0000
commitf773f91721239ae4108739d0a677392e61b19f52 (patch)
treeffa27f47c8647903c2c049c46b4e2d1d737480b9 /src/java
parent39229973d4a042d3302a2d0cf50489fe01cdb09d (diff)
downloadxmlgraphics-fop-f773f91721239ae4108739d0a677392e61b19f52.tar.gz
xmlgraphics-fop-f773f91721239ae4108739d0a677392e61b19f52.zip
PSLM.getParentArea() consolidated into FLM's version; preLoadList()
preLoadNext() renamed to clearer createChildLMs()/createNextChildLMs(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198630 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java11
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java12
-rw-r--r--src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java16
-rw-r--r--src/java/org/apache/fop/layoutmgr/LMiter.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/LayoutManager.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java26
7 files changed, 33 insertions, 44 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 74b5bbfaf..f1970446b 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -308,11 +308,12 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
}
/**
- * Convenience method: preload a number of child LMs
+ * Create the LM instances for the children of the
+ * formatting object being handled by this LM.
* @param size the requested number of child LMs
* @return the list with the preloaded child LMs
*/
- protected List preLoadList(int size) {
+ protected List createChildLMs(int size) {
if (fobjIter == null) {
return null;
}
@@ -349,10 +350,10 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants
}
/**
- * @see org.apache.fop.layoutmgr.LayoutManager#preLoadNext
+ * @see org.apache.fop.layoutmgr.LayoutManager#createNextChildLMs
*/
- public boolean preLoadNext(int pos) {
- List newLMs = preLoadList(pos + 1 - childLMs.size());
+ public boolean createNextChildLMs(int pos) {
+ List newLMs = createChildLMs(pos + 1 - childLMs.size());
addChildLMs(newLMs);
return pos < childLMs.size();
}
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 5334bab97..4f194b924 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -114,7 +114,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
* This iterator creates and holds the complete list
* of child LMs.
* It uses fobjIter as its base iterator.
- * Block LM's preLoadNext uses this iterator
+ * Block LM's createNextChildLMs uses this iterator
* as its base iterator.
*/
protected class ProxyLMiter extends LMiter {
@@ -125,11 +125,11 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
public boolean hasNext() {
- return (curPos < listLMs.size()) ? true : preLoadNext(curPos);
+ return (curPos < listLMs.size()) ? true : createNextChildLMs(curPos);
}
- protected boolean preLoadNext(int pos) {
- List newLMs = preLoadList(pos + 1 - listLMs.size());
+ protected boolean createNextChildLMs(int pos) {
+ List newLMs = createChildLMs(pos + 1 - listLMs.size());
if (newLMs != null) {
listLMs.addAll(newLMs);
}
@@ -138,9 +138,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
}
/**
- * @see org.apache.fop.layoutmgr.LayoutManager#preLoadNext
+ * @see org.apache.fop.layoutmgr.LayoutManager#createNextChildLMs
*/
- public boolean preLoadNext(int pos) {
+ public boolean createNextChildLMs(int pos) {
while (proxyLMiter.hasNext()) {
LayoutManager lm = (LayoutManager) proxyLMiter.next();
diff --git a/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java
index 626532fa4..c1571f071 100644
--- a/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java
@@ -242,9 +242,9 @@ public class ContentLayoutManager implements InlineLevelLayoutManager {
Position bp2) { }
/**
- * @see org.apache.fop.layoutmgr.LayoutManager#preLoadNext
+ * @see org.apache.fop.layoutmgr.LayoutManager#createNextChildLMs
*/
- public boolean preLoadNext(int pos) {
+ public boolean createNextChildLMs(int pos) {
return false;
}
diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
index 7a8386dd2..08b29e211 100644
--- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
@@ -424,8 +424,20 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
* @see org.apache.fop.layoutmgr.LayoutManager#getParentArea(Area)
*/
public Area getParentArea(Area childArea) {
- // Get an area from the Page
- BlockParent parentArea = (BlockParent)parentLM.getParentArea(childArea);
+ BlockParent parentArea = null;
+ int aclass = childArea.getAreaClass();
+
+ if (aclass == Area.CLASS_NORMAL) {
+ parentArea = getCurrentPV().getCurrentFlow();
+ } else if (aclass == Area.CLASS_BEFORE_FLOAT) {
+ parentArea = getCurrentPV().getBodyRegion().getBeforeFloat();
+ } else if (aclass == Area.CLASS_FOOTNOTE) {
+ parentArea = getCurrentPV().getBodyRegion().getFootnote();
+ } else {
+ throw new IllegalStateException("(internal error) Invalid " +
+ "area class (" + aclass + ") requested.");
+ }
+
this.currentAreas[parentArea.getAreaClass()] = parentArea;
setCurrentArea(parentArea);
return parentArea;
diff --git a/src/java/org/apache/fop/layoutmgr/LMiter.java b/src/java/org/apache/fop/layoutmgr/LMiter.java
index 789e1dc50..776ff89bf 100644
--- a/src/java/org/apache/fop/layoutmgr/LMiter.java
+++ b/src/java/org/apache/fop/layoutmgr/LMiter.java
@@ -36,7 +36,7 @@ public class LMiter implements ListIterator {
}
public boolean hasNext() {
- return (curPos < listLMs.size()) ? true : lp.preLoadNext(curPos);
+ return (curPos < listLMs.size()) ? true : lp.createNextChildLMs(curPos);
}
public boolean hasPrevious() {
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/java/org/apache/fop/layoutmgr/LayoutManager.java
index 6c3187117..84a53cf64 100644
--- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/LayoutManager.java
@@ -159,11 +159,11 @@ public interface LayoutManager {
void addAreas(PositionIterator posIter, LayoutContext context);
/**
- * Load next child LMs, up to child LM index pos
+ * Create more child LMs of the parent, up to child LM index pos
* @param pos index up to which child LMs are requested
- * @return if requested index does exist
+ * @return true if requested index does exist
*/
- boolean preLoadNext(int pos);
+ boolean createNextChildLMs(int pos);
/**
* @return the list of child LMs
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index ad9ccab69..7b1cd4e01 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -22,7 +22,6 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.area.AreaTreeHandler;
import org.apache.fop.area.AreaTreeModel;
-import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.RegionViewport;
@@ -430,7 +429,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
RegionViewport rv = curPV.getPage().getRegionViewport(regionID);
StaticContentLayoutManager lm;
lm = (StaticContentLayoutManager)
- areaTreeHandler.getLayoutManagerMaker().makeLayoutManager(sc);
+ getLayoutManagerMaker().makeLayoutManager(sc);
lm.setTargetRegion(rv.getRegionReference());
lm.setParent(this);
lm.doLayout();
@@ -451,29 +450,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
}
/**
- * This is called from FlowLayoutManager when it needs to start
- * a new flow container (while generating areas).
- *
- * @param childArea The area for which a container is needed. It must be
- * some kind of block-level area. It must have area-class, break-before
- * and span properties set.
- * @return the parent area
- */
- public Area getParentArea(Area childArea) {
- int aclass = childArea.getAreaClass();
-
- if (aclass == Area.CLASS_NORMAL) {
- return curPV.getCurrentFlow();
- } else if (aclass == Area.CLASS_BEFORE_FLOAT) {
- return curPV.getBodyRegion().getBeforeFloat();
- } else if (aclass == Area.CLASS_FOOTNOTE) {
- return curPV.getBodyRegion().getFootnote();
- }
- // todo!!! other area classes (side-float, absolute, fixed)
- return null;
- }
-
- /**
* Depending on the kind of break condition, move to next column
* or page. May need to make an empty page if next page would
* not have the desired "handedness".