}
/**
- * 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;
}
}
/**
- * @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();
}
* 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 {
}
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);
}
}
/**
- * @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();
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;
}
* @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;
}
public boolean hasNext() {
- return (curPos < listLMs.size()) ? true : lp.preLoadNext(curPos);
+ return (curPos < listLMs.size()) ? true : lp.createNextChildLMs(curPos);
}
public boolean hasPrevious() {
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
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;
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();
curPV = null;
}
- /**
- * 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