Author: adelmelle
Date: Thu Feb 10 17:44:33 2011
New Revision: 1069496
URL: http://svn.apache.org/viewvc?rev=1069496&view=rev
Log:
Further cleanups: alignment of FlowLM.getNextKE() with pattern of the same
method in BlockStackingLM.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=1069496&r1=1069495&r2=1069496&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
Thu Feb 10 17:44:33 2011
@@ -232,15 +232,12 @@ public class BlockContainerLayoutManager
LayoutManager prevLM = null; // previously active LM
LayoutContext childLC;
- boolean doReset = isRestart;
if (isRestart) {
if (emptyStack) {
assert restartAtLM != null && restartAtLM.getParent() ==
this;
curLM = restartAtLM;
} else {
curLM = (LayoutManager) lmStack.pop();
- // make sure the initial LM is not reset
- doReset = false;
}
setCurrentChildLM(curLM);
} else {
@@ -248,14 +245,13 @@ public class BlockContainerLayoutManager
}
while (curLM != null) {
- if (doReset) {
- curLM.reset();
- }
-
childLC = makeChildLayoutContext(context);
// get elements from curLM
if (!isRestart || emptyStack) {
+ if (isRestart) {
+ curLM.reset();
+ }
returnedList = getNextChildElements(curLM, context,
childLC, alignment,
null, null, null);
} else {
@@ -263,8 +259,6 @@ public class BlockContainerLayoutManager
lmStack, restartPosition, restartAtLM);
// once encountered, irrelevant for following child LMs
emptyStack = true;
- // force reset as of the next child
- doReset = true;
}
if (contentList.isEmpty() &&
childLC.isKeepWithPreviousPending()) {
//Propagate keep-with-previous up from the first child
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=1069496&r1=1069495&r2=1069496&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
Thu Feb 10 17:44:33 2011
@@ -265,16 +265,12 @@ public abstract class BlockStackingLayou
LayoutContext childLC;
List<ListElement> childElements;
LayoutManager currentChildLM;
- // always reset in case of a restart (exception: see below)
- boolean doReset = isRestart;
if (isRestart) {
if (emptyStack) {
assert restartAtLM != null && restartAtLM.getParent() == this;
currentChildLM = restartAtLM;
} else {
currentChildLM = (LayoutManager) lmStack.pop();
- // make sure the initial child LM is not reset
- doReset = false;
}
setCurrentChildLM(currentChildLM);
} else {
@@ -282,13 +278,14 @@ public abstract class BlockStackingLayou
}
while (currentChildLM != null) {
- if (doReset) {
- currentChildLM.reset(); // TODO won't work with forced breaks
- }
childLC = makeChildLayoutContext(context);
if (!isRestart || emptyStack) {
+ if (isRestart) {
+ currentChildLM.reset(); // TODO won't work with forced
breaks
+ }
+
childElements = getNextChildElements(currentChildLM, context,
childLC, alignment,
null, null, null);
} else {
@@ -297,8 +294,6 @@ public abstract class BlockStackingLayou
lmStack, restartPosition, restartAtLM);
// once encountered, irrelevant for following child LMs
emptyStack = true;
- // force reset as of the next child
- doReset = true;
}
if (contentList.isEmpty()) {
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=1069496&r1=1069495&r2=1069496&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
Thu Feb 10 17:44:33 2011
@@ -83,42 +83,47 @@ public class FlowLayoutManager extends B
List<ListElement> elements = new LinkedList<ListElement>();
boolean isRestart = (restartPosition != null);
+ // always reset in case of restart (exception: see below)
+ boolean doReset = isRestart;
LayoutManager currentChildLM;
+ Stack<LayoutManager> lmStack = new Stack<LayoutManager>();
if (isRestart) {
currentChildLM = restartPosition.getLM();
if (currentChildLM == null) {
- throw new IllegalStateException(
- "Cannot find layout manager from where to re-start "
- + "layout after IPD change");
+ throw new IllegalStateException("Cannot find layout manager to
restart from");
}
if (restartLM != null && restartLM.getParent() == this) {
currentChildLM = restartLM;
- setCurrentChildLM(currentChildLM);
- currentChildLM.reset();
- if (addChildElements(elements, currentChildLM, context,
alignment) != null) {
- return elements;
- }
} else {
- Stack<LayoutManager> lmStack = new Stack<LayoutManager>();
while (currentChildLM.getParent() != this) {
lmStack.push(currentChildLM);
currentChildLM = currentChildLM.getParent();
}
- setCurrentChildLM(currentChildLM);
+ doReset = false;
+ }
+ setCurrentChildLM(currentChildLM);
+ } else {
+ currentChildLM = getChildLM();
+ }
+
+ while (currentChildLM != null) {
+ if (!isRestart || doReset) {
+ if (doReset) {
+ currentChildLM.reset(); // TODO won't work with forced
breaks
+ }
+ if (addChildElements(elements, currentChildLM, context,
alignment,
+ null, null, null) != null) {
+ return elements;
+ }
+ } else {
if (addChildElements(elements, currentChildLM, context,
alignment, lmStack,
restartPosition, restartLM) != null) {
return elements;
}
+ // restarted; force reset as of next child
+ doReset = true;
}
- }
-
- while ((currentChildLM = getChildLM()) != null) {
- if (isRestart) {
- currentChildLM.reset(); // TODO won't work with forced breaks
- }
- if (addChildElements(elements, currentChildLM, context, alignment)
!= null) {
- return elements;
- }
+ currentChildLM = getChildLM();
}
SpaceResolver.resolveElementList(elements);
@@ -129,11 +134,6 @@ public class FlowLayoutManager extends B
}
private List<ListElement> addChildElements(List<ListElement> elements,
- LayoutManager childLM, LayoutContext context, int alignment) {
- return addChildElements(elements, childLM, context, alignment, null,
null, null);
- }
-
- private List<ListElement> addChildElements(List<ListElement> elements,
LayoutManager childLM, LayoutContext context, int alignment,
Stack<LayoutManager> lmStack, Position position, LayoutManager
restartAtLM) {
if (handleSpanChange(childLM, context)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]