LinkedList returnList = new LinkedList();
for (int p = 0; p < knuthParagraphs.size(); p++) {
// null penalty between paragraphs
if (p > 0 && !((BlockLevelLayoutManager) parentLM).mustKeepTogether()) {
returnList.add(new BreakElement(
new Position(this), 0, context));
//returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
LineLayoutPossibilities llPoss;
llPoss = (LineLayoutPossibilities) lineLayoutsList.get(p);
KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
if (!seq.isInlineSequence()) {
LinkedList targetList = new LinkedList();
ListIterator listIter = seq.listIterator();
while (listIter.hasNext()) {
ListElement tempElement;
tempElement = (ListElement) listIter.next();
if (tempElement.getLayoutManager() != this) {
tempElement.setPosition(notifyPos(new NonLeafPosition(this,
tempElement.getPosition())));
}
targetList.add(tempElement);
}
returnList.addAll(targetList);
} else if (seq.isInlineSequence() && alignment == EN_JUSTIFY) {
/* justified vertical alignment (not in the XSL FO recommendation):
create a multi-layout sequence whose elements will contain
a conventional Position */
Position returnPosition = new LeafPosition(this, p);
createElements(returnList, llPoss, returnPosition);
} else {
/* "normal" vertical alignment: create a sequence whose boxes
represent effective lines, and contain LineBreakPositions */
Position returnPosition = new LeafPosition(this, p);
int startIndex = 0;
for (int i = 0;
i < llPoss.getChosenLineCount();
i++) {
if (!((BlockLevelLayoutManager) parentLM).mustKeepTogether()
&& i >= fobj.getOrphans()
&& i <= llPoss.getChosenLineCount() - fobj.getWidows()
&& returnList.size() > 0) {
// null penalty allowing a page break between lines
returnList.add(new BreakElement(
returnPosition, 0, context));
//returnList.add(new KnuthPenalty(0, 0, false, returnPosition, false));
}
int endIndex
= ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();