diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-11-14 12:55:46 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-11-14 12:55:46 +0000 |
commit | 18536029a6533a850dd1508f938b0ad20f1a0e72 (patch) | |
tree | ce799e9527fc49e4bbb527c125920591b545c939 /src/java/org/apache/fop/layoutmgr | |
parent | f848d591de7458a04b111d243935b08bbd47c5fd (diff) | |
download | xmlgraphics-fop-18536029a6533a850dd1508f938b0ad20f1a0e72.tar.gz xmlgraphics-fop-18536029a6533a850dd1508f938b0ad20f1a0e72.zip |
Updated from Jakarta Commons IO 1.0 to 1.1. CopyUtils.copy() becomes IOUtils.copy() again. CopyUtils in 1.0 was not ideal design decision.
Fixed most of the unappropriate System.err/System.out/Exception.printStackTrace(). Those that aren't fixed and are not legitimate calls (in main() methods etc.) are marked with a TODO item.
Some Javadocs and style updates.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@344111 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
11 files changed, 97 insertions, 127 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java index cec2c5425..d118fa4a6 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java @@ -81,8 +81,7 @@ public abstract class AbstractBaseLayoutManager case LengthBase.CONTAINING_REFAREA_WIDTH: return getReferenceAreaIPD(); default: - log.error("Unknown base type for LengthBase:" + lengthBase); - new Exception().printStackTrace(); + log.error(new Exception("Unknown base type for LengthBase:" + lengthBase)); return 0; } } else { diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java index 743d30574..fbac14f38 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java @@ -174,12 +174,14 @@ public abstract class AbstractBreaker { ElementListObserver.observe(elementList, "breaker", null); } + /** + * Starts the page breaking process. + * @param flowBPD the constant available block-progression-dimension (used for every part) + */ public void doLayout(int flowBPD) { LayoutContext childLC = createLayoutContext(); childLC.setStackLimit(new MinOptMax(flowBPD)); - //System.err.println("Vertical alignment: " + - // currentSimplePageMaster.getRegion(FO_REGION_BODY).getDisplayAlign()); if (getCurrentDisplayAlign() == Constants.EN_X_FILL) { //EN_FILL is non-standard (by LF) alignment = Constants.EN_JUSTIFY; @@ -492,7 +494,6 @@ public abstract class AbstractBreaker { private int optimizeLineLength(KnuthSequence effectiveList, int startElementIndex, int endElementIndex) { ListIterator effectiveListIterator; // optimize line length - //System.out.println(" "); int boxCount = 0; int accumulatedLineLength = 0; int greatestMinimumLength = 0; @@ -520,10 +521,10 @@ public abstract class AbstractBreaker { int averageLineLength = 0; if (accumulatedLineLength > 0 && boxCount > 0) { averageLineLength = (int) (accumulatedLineLength / boxCount); - //System.out.println("PSLM> lunghezza media = " + averageLineLength); + log.debug("Average line length = " + averageLineLength); if (averageLineLength < greatestMinimumLength) { averageLineLength = greatestMinimumLength; - //System.out.println(" correzione, ora e' = " + averageLineLength); + log.debug(" Correction to: " + averageLineLength); } } return averageLineLength; diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 6107aadd7..5a53c7239 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -690,7 +690,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager Position lastPos = null; while (parentIter.hasNext()) { pos = (Position) parentIter.next(); - //System.out.println("pos = " + pos.getClass().getName()); if (pos.getIndex() >= 0) { if (firstPos == null) { firstPos = pos; @@ -728,13 +727,10 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager // pos was created by this BlockLM and was inside a penalty // allowing or forbidding a page break // nothing to do - /* LF *///System.out.println(" penalty"); } else { // innerPosition was created by another LM positionList.add(innerPosition); lastLM = innerPosition.getLM(); - /* LF *///System.out.println(" " + - // innerPosition.getClass().getName()); } } @@ -756,7 +752,6 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager // // the last item inside positionList is a LeafPosition // // (a LineBreakPosition, more precisely); this means that // // the whole paragraph is on the same page - // System.out.println("paragrafo intero"); // childPosIter = new KnuthPossPosIter(storedList, 0, // storedList.size()); //} else { @@ -781,11 +776,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager lastLM = element.getLayoutManager(); } } - //System.out.println("addAreas riferito a storedList da " + - // iFirst + " a " + iLast); - //System.out.println("splitLength= " + splitLength - // + " (" + neededUnits(splitLength) + " unita') " - // + (neededUnits(splitLength) * bpUnit - splitLength) + " spazi"); + //log.debug("Adding areas from " + iFirst + " to " + iLast); + //log.debug("splitLength= " + splitLength + // + " (" + neededUnits(splitLength) + " units') " + // + (neededUnits(splitLength) * bpUnit - splitLength) + // + " spacing"); // add space before and / or after the paragraph // to reach a multiple of bpUnit if (bSpaceBefore && bSpaceAfter) { @@ -810,8 +805,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager + foBlockSpaceAfter.min) * bpUnit - splitLength; } - //System.out.println("spazio prima = " + adjustedSpaceBefore - // + " spazio dopo = " + adjustedSpaceAfter + " totale = " + + //log.debug("space before = " + adjustedSpaceBefore + // + " space after = " + adjustedSpaceAfter + " total = " + // (adjustedSpaceBefore + adjustedSpaceAfter + splitLength)); childPosIter = new KnuthPossPosIter(splitList, 0, splitList .size()); diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 838e23cfb..1a5e796f6 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -232,7 +232,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager */ public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) { - //System.out.println(" BLM.addAreas>"); getParentArea(null); // if this will create the first block area in a page @@ -316,7 +315,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager // // the last item inside positionList is a LeafPosition // // (a LineBreakPosition, more precisely); this means that // // the whole paragraph is on the same page - // System.out.println("paragrafo intero"); // childPosIter = new KnuthPossPosIter(storedList, 0, // storedList.size()); //} else { @@ -341,11 +339,11 @@ public class BlockLayoutManager extends BlockStackingLayoutManager lastLM = element.getLayoutManager(); } } - //System.out.println("addAreas riferito a storedList da " + - // iFirst + " a " + iLast); - //System.out.println("splitLength= " + splitLength - // + " (" + neededUnits(splitLength) + " unita') " - // + (neededUnits(splitLength) * bpUnit - splitLength) + " spazi"); + //log.debug("Adding areas from " + iFirst + " to " + iLast); + //log.debug("splitLength= " + splitLength + // + " (" + neededUnits(splitLength) + " units') " + // + (neededUnits(splitLength) * bpUnit - splitLength) + // + " spacing"); // add space before and / or after the paragraph // to reach a multiple of bpUnit if (bSpaceBefore && bSpaceAfter) { @@ -370,7 +368,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager + foSpaceAfter.min) * bpUnit - splitLength; } - //System.out.println("spazio prima = " + adjustedSpaceBefore + //log.debug("spazio prima = " + adjustedSpaceBefore // + " spazio dopo = " + adjustedSpaceAfter + " totale = " + // (adjustedSpaceBefore + adjustedSpaceAfter + splitLength)); childPosIter = new KnuthPossPosIter(splitList, 0, splitList diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index b3ad7225b..a8561b752 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -178,11 +178,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager * @see LayoutManager#getNextKnuthElements(LayoutContext, int) */ public LinkedList getNextKnuthElements(LayoutContext context, int alignment) { - /* LF *///System.err.println("BLM.getNextKnuthElements> keep-together = " + //log.debug("BLM.getNextKnuthElements> keep-together = " // + layoutProps.keepTogether.getType()); - /* LF *///System.err.println(" keep-with-previous = " + + //log.debug(" keep-with-previous = " + // layoutProps.keepWithPrevious.getType()); - /* LF *///System.err.println(" keep-with-next = " + + //log.debug(" keep-with-next = " + // layoutProps.keepWithNext.getType()); BlockLevelLayoutManager curLM; // currently active LM BlockLevelLayoutManager prevLM = null; // previously active LM @@ -388,11 +388,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#negotiateBPDAdjustment(int, org.apache.fop.layoutmgr.KnuthElement) */ public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) { -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> " + adj); -/*LF*/ //System.out.println(" lastElement e' " + (lastElement.isPenalty() +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> " + adj); +/*LF*/ //log.debug(" lastElement e' " + (lastElement.isPenalty() // ? "penalty" : (lastElement.isGlue() ? "glue" : "box" ))); -/*LF*/ //System.out.println(" position e' " + lastElement.getPosition().getClass().getName()); -/*LF*/ //System.out.println(" " + (bpUnit > 0 ? "unit" : "")); +/*LF*/ //log.debug(" position e' " + lastElement.getPosition().getClass().getName()); +/*LF*/ //log.debug(" " + (bpUnit > 0 ? "unit" : "")); Position innerPosition = ((NonLeafPosition) lastElement.getPosition()).getPosition(); if (innerPosition == null && lastElement.isGlue()) { @@ -400,11 +400,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager if (((KnuthGlue) lastElement).getAdjustmentClass() == SPACE_BEFORE_ADJUSTMENT) { // this adjustment applies to space-before adjustedSpaceBefore += adj; -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> spazio prima: " + adj); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> spazio prima: " + adj); } else { // this adjustment applies to space-after adjustedSpaceAfter += adj; -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> spazio dopo: " + adj); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> spazio dopo: " + adj); } return adj; } else if (innerPosition instanceof MappingPosition) { @@ -414,7 +414,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager MappingPosition mappingPos = (MappingPosition)innerPosition; if (lastElement.isGlue()) { // lastElement is a glue -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> bpunit con glue"); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> bpunit con glue"); ListIterator storedListIterator = storedList.listIterator( mappingPos.getFirstIndex()); int newAdjustment = 0; @@ -424,7 +424,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager newAdjustment += ((BlockLevelLayoutManager)storedElement .getLayoutManager()).negotiateBPDAdjustment( adj - newAdjustment, storedElement); -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> (progressivo) righe: " +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> (progressivo) righe: " // + newAdjustment); } } @@ -435,19 +435,19 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager // lastElement is a penalty: this means that the paragraph // has been split between consecutive pages: // this may involve a change in the number of lines -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> bpunit con penalty"); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> bpunit con penalty"); KnuthPenalty storedPenalty = (KnuthPenalty) storedList.get(mappingPos.getLastIndex()); if (storedPenalty.getW() > 0) { // the original penalty has width > 0 -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> chiamata passata"); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> chiamata passata"); return ((BlockLevelLayoutManager)storedPenalty.getLayoutManager()) .negotiateBPDAdjustment(storedPenalty.getW(), (KnuthElement)storedPenalty); } else { // the original penalty has width = 0 // the adjustment involves only the spaces before and after -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> chiamata gestita"); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> chiamata gestita"); return adj; } } @@ -458,7 +458,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager int returnValue = ((BlockLevelLayoutManager)lastElement.getLayoutManager()) .negotiateBPDAdjustment(adj, lastElement); lastElement.setPosition(savedPos); -/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> righe: " + returnValue); +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> righe: " + returnValue); return returnValue; } else { // this should never happen @@ -471,7 +471,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager * @see BlockLevelLayoutManager#discardSpace(KnuthGlue) */ public void discardSpace(KnuthGlue spaceGlue) { - //System.out.println(" BLM.discardSpace> " + spaceGlue.getPosition().getClass().getName()); + //log.debug(" BLM.discardSpace> " + spaceGlue.getPosition().getClass().getName()); Position innerPosition = ((NonLeafPosition) spaceGlue.getPosition()).getPosition(); if (innerPosition == null || innerPosition.getLM() == this) { @@ -501,8 +501,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager * @see LayoutManager#getChangedKnuthElements(List, int) */ public LinkedList getChangedKnuthElements(List oldList, int alignment) { -/*LF*/ //System.out.println(""); -/*LF*/ //System.out.println(" BLM.getChangedKnuthElements> inizio: oldList.size() = " +/*LF*/ //log.debug(""); +/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = " // + oldList.size()); ListIterator oldListIterator = oldList.listIterator(); KnuthElement returnedElement; @@ -517,10 +517,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager while (oldListIterator.hasNext()) { oldElement = (KnuthElement)oldListIterator.next(); Position innerPosition = ((NonLeafPosition) oldElement.getPosition()).getPosition(); - //System.out.println(" BLM> unwrapping: " + //log.debug(" BLM> unwrapping: " // + (oldElement.isBox() ? "box " : (oldElement.isGlue() ? "glue " : "penalty")) // + " creato da " + oldElement.getLayoutManager().getClass().getName()); - //System.out.println(" BLM> unwrapping: " + //log.debug(" BLM> unwrapping: " // + oldElement.getPosition().getClass().getName()); if (innerPosition != null) { // oldElement was created by a descendant of this BlockLM @@ -557,19 +557,18 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } int iLast = ((MappingPosition) el.getPosition()).getLastIndex(); - //System.out.println(" si usa storedList da " + iFirst + " a " + iLast + //log-debug(" si usa storedList da " + iFirst + " a " + iLast // + " compresi su " + storedList.size() + " elementi totali"); workList = storedList.subList(iFirst, iLast + 1); } ListIterator workListIterator = workList.listIterator(); - //System.out.println(""); - //System.out.println(" BLM.getChangedKnuthElements> workList.size() = " + //log.debug(" BLM.getChangedKnuthElements> workList.size() = " // + workList.size() + " da 0 a " + (workList.size() - 1)); while (workListIterator.hasNext()) { currElement = (KnuthElement) workListIterator.next(); - //System.out.println("elemento n. " + workListIterator.previousIndex() + //log.debug("elemento n. " + workListIterator.previousIndex() // + " nella workList"); if (prevElement != null && prevElement.getLayoutManager() != currElement.getLayoutManager()) { @@ -580,7 +579,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager currElement.getLayoutManager(); boolean bSomethingAdded = false; if (prevLM != this) { - //System.out.println(" BLM.getChangedKnuthElements> chiamata da " + //log.debug(" BLM.getChangedKnuthElements> chiamata da " // + fromIndex + " a " + workListIterator.previousIndex() + " su " // + prevLM.getClass().getName()); returnedList.addAll(prevLM.getChangedKnuthElements(workList.subList( @@ -589,7 +588,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } else { // prevLM == this // do nothing - //System.out.println(" BLM.getChangedKnuthElements> elementi propri, " + //log.debug(" BLM.getChangedKnuthElements> elementi propri, " // + "ignorati, da " + fromIndex + " a " + workListIterator.previousIndex() // + " su " + prevLM.getClass().getName()); } @@ -614,7 +613,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager BlockLevelLayoutManager currLM = (BlockLevelLayoutManager) currElement.getLayoutManager(); if (currLM != this) { - //System.out.println(" BLM.getChangedKnuthElements> chiamata da " + fromIndex + //log.debug(" BLM.getChangedKnuthElements> chiamata da " + fromIndex // + " a " + oldList.size() + " su " + currLM.getClass().getName()); returnedList.addAll(currLM.getChangedKnuthElements( workList.subList(fromIndex, workList.size()), alignment)); @@ -625,7 +624,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager if (returnedList.size() > 0) { returnedList.removeLast(); } - //System.out.println(" BLM.getChangedKnuthElements> elementi propri, ignorati, da " + //log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da " // + fromIndex + " a " + workList.size()); } } @@ -654,7 +653,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } } - //System.out.println(" BLM.getChangedKnuthElements> intermedio: returnedList.size() = " + //log.debug(" BLM.getChangedKnuthElements> intermedio: returnedList.size() = " // + returnedList.size()); /* estensione: conversione complessiva */ @@ -702,7 +701,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } } - //System.out.println(" BLM.getChangedKnuthElements> finished: returnList.size() = " + //log.debug(" BLM.getChangedKnuthElements> finished: returnList.size() = " // + returnList.size()); return returnList; } @@ -875,13 +874,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager CommonBorderPaddingBackground.BEFORE), RelSide.BEFORE, isFirst, false, this)); } - //TODO Handle conditionality - /* - int bpBefore = borderAndPadding.getBorderBeforeWidth(false) - + borderAndPadding.getPaddingBefore(false, this); - if (bpBefore > 0) { - returnList.add(new KnuthBox(bpBefore, getAuxiliaryPosition(), true)); - }*/ } } @@ -907,13 +899,6 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager .getWidth(), RelSide.AFTER, false, isLast, this)); } - //TODO Handle conditionality - /* - int bpAfter = borderAndPadding.getBorderAfterWidth(false) - + borderAndPadding.getPaddingAfter(false, this); - if (bpAfter > 0) { - returnList.add(new KnuthBox(bpAfter, getAuxiliaryPosition(), true)); - }*/ } } @@ -1077,8 +1062,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager } protected LinkedList createUnitElements(LinkedList oldList) { - //System.out.println(" "); - //System.out.println("Start conversion: " + oldList.size() + //log.debug("Start conversion: " + oldList.size() // + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min // + " space-after.min=" + layoutProps.spaceAfter.getSpace().min); // add elements at the beginning and at the end of oldList @@ -1101,23 +1085,22 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager MinOptMax totalUnits = new MinOptMax(0); LinkedList newList = new LinkedList(); - //System.out.println(" "); - //System.out.println(" Prima scansione"); + //log.debug(" Prima scansione"); // scan the list once to compute total min, opt and max length ListIterator oldListIterator = oldList.listIterator(); while (oldListIterator.hasNext()) { KnuthElement element = (KnuthElement) oldListIterator.next(); if (element.isBox()) { totalLength.add(new MinOptMax(element.getW())); - //System.out.println("box " + element.getW()); + //log.debug("box " + element.getW()); } else if (element.isGlue()) { totalLength.min -= ((KnuthGlue) element).getZ(); totalLength.max += ((KnuthGlue) element).getY(); //leafValue = ((LeafPosition) element.getPosition()).getLeafPos(); - //System.out.println("glue " + element.getW() + " + " + //log.debug("glue " + element.getW() + " + " // + ((KnuthGlue) element).getY() + " - " + ((KnuthGlue) element).getZ()); } else { - //System.out.println((((KnuthPenalty)element).getP() == KnuthElement.INFINITE + //log.debug((((KnuthPenalty)element).getP() == KnuthElement.INFINITE // ? "PENALTY " : "penalty ") + element.getW()); } } @@ -1125,11 +1108,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager totalUnits = new MinOptMax(neededUnits(totalLength.min), neededUnits(totalLength.opt), neededUnits(totalLength.max)); - //System.out.println(" totalLength= " + totalLength); - //System.out.println(" unita'= " + totalUnits); + //log.debug(" totalLength= " + totalLength); + //log.debug(" unita'= " + totalUnits); - //System.out.println(" "); - //System.out.println(" Seconda scansione"); + //log.debug(" Seconda scansione"); // scan the list once more, stopping at every breaking point // in order to compute partial min, opt and max length // and create the new elements @@ -1212,7 +1194,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager int uNewShrink = (unitsBeforeBreak.opt - unitsBeforeBreak.min) - (unsuppressibleUnits.opt - unsuppressibleUnits.min); - //System.out.println("(" + //log.debug("(" // + unsuppressibleUnits.min + "-" + unsuppressibleUnits.opt + "-" // + unsuppressibleUnits.max + ") " // + " -> " + unitsBeforeBreak.min + "-" + unitsBeforeBreak.opt + "-" @@ -1245,7 +1227,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager mappingPos, false)); unsuppressibleUnits.add(new MinOptMax(uNewNormal - uLengthChange)); - //System.out.println(" box " + (uNewNormal - uLengthChange)); + //log.debug(" box " + (uNewNormal - uLengthChange)); // new infinite penalty, glue and box, if necessary if (uNewStretch - uStretchChange > 0 @@ -1263,15 +1245,15 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager LINE_NUMBER_ADJUSTMENT, mappingPos, false)); - //System.out.println(" PENALTY"); - //System.out.println(" glue 0 " + iStretchUnits + " " + iShrinkUnits); + //log.debug(" PENALTY"); + //log.debug(" glue 0 " + iStretchUnits + " " + iShrinkUnits); unsuppressibleUnits.max += iStretchUnits; unsuppressibleUnits.min -= iShrinkUnits; if (!oldListIterator.hasNext()) { newList.add(new KnuthBox(0, mappingPos, false)); - //System.out.println(" box 0"); + //log.debug(" box 0"); } } @@ -1296,10 +1278,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager LINE_NUMBER_ADJUSTMENT, mappingPos, false)); - //System.out.println(" PENALTY"); - //System.out.println(" glue 0 " + uStretchChange + " " + uShrinkChange); - //System.out.println(" penalty " + uLengthChange + " * unit"); - //System.out.println(" glue 0 " + (- uStretchChange) + " " + //log.debug(" PENALTY"); + //log.debug(" glue 0 " + uStretchChange + " " + uShrinkChange); + //log.debug(" penalty " + uLengthChange + " * unit"); + //log.debug(" glue 0 " + (- uStretchChange) + " " // + (- uShrinkChange)); } else if (oldListIterator.hasNext()) { // new penalty @@ -1307,7 +1289,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager 0, false, mappingPos, false)); - //System.out.println(" penalty " + uLengthChange + " * unit"); + //log.debug(" penalty " + uLengthChange + " * unit"); } // update firstIndex firstIndex = lastIndex + 1; @@ -1347,9 +1329,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager wrongBox.getPosition(), false)); newList.addFirst(new KnuthGlue(decreasedLength, 0, 0, SPACE_BEFORE_ADJUSTMENT, wrongBox.getPosition(), false)); - //System.out.println(" rimosso box " + neededUnits(wrongBox.getW())); - //System.out.println(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0"); - //System.out.println(" aggiunto box " + neededUnits( + //log.debug(" rimosso box " + neededUnits(wrongBox.getW())); + //log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0"); + //log.debug(" aggiunto box " + neededUnits( // wrongBox.getW() - decreasedLength)); } @@ -1388,10 +1370,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager // insert the correct glue newList.addLast(new KnuthGlue(decreasedLength, 0, 0, SPACE_AFTER_ADJUSTMENT, wrongBox.getPosition(), false)); - //System.out.println(" rimosso box " + neededUnits(wrongBox.getW())); - //System.out.println(" aggiunto box " + neededUnits( + //log.debug(" rimosso box " + neededUnits(wrongBox.getW())); + //log.debug(" aggiunto box " + neededUnits( // wrongBox.getW() - decreasedLength)); - //System.out.println(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0"); + //log.debug(" aggiunto glue " + neededUnits(decreasedLength) + " 0 0"); } return newList; diff --git a/src/java/org/apache/fop/layoutmgr/PositionIterator.java b/src/java/org/apache/fop/layoutmgr/PositionIterator.java index cc0c73c89..24a641ebd 100644 --- a/src/java/org/apache/fop/layoutmgr/PositionIterator.java +++ b/src/java/org/apache/fop/layoutmgr/PositionIterator.java @@ -84,7 +84,6 @@ public abstract class PositionIterator implements Iterator { if (bHasNext) { Object retObj = getPos(nextObj); lookAhead(); - //System.out.println(retObj); return retObj; } else { throw new NoSuchElementException("PosIter"); diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index 6a8608955..9028f17cf 100644 --- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java @@ -108,7 +108,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { // get elements from curLM returnedList = curLM.getNextKnuthElements(childLC, alignment); - //System.out.println("FLM.getNextKnuthElements> returnedList.size() = " + //log.debug("FLM.getNextKnuthElements> returnedList.size() = " // + returnedList.size()); // "wrap" the Position inside each element @@ -148,7 +148,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { && ((KnuthPenalty)returnedList.getLast()).getP() == -KnuthElement.INFINITE) { // a descendant of this flow has break-after -/*LF*/ //System.out.println("FLM - break after!!"); +/*LF*/ //log.debug("FLM - break after!!"); return returnList; } /*LF*/ } diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index cc76a4572..d70a783fb 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -432,10 +432,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager if (addedPositions == lineLayouts.getLineCount(activePossibility)) { activePossibility++; addedPositions = 0; - //System.out.println(" "); } - //System.out.println("LLM> (" + (lineLayouts.getLineNumber(activePossibility) - addedPositions) + ") difference = " + difference + " ratio = " + ratio); + //log.debug("LLM> (" + (lineLayouts.getLineNumber(activePossibility) - addedPositions) + ") difference = " + difference + " ratio = " + ratio); lineLayouts.addBreakPosition(makeLineBreakPosition(par, (bestActiveNode.line > 1 ? bestActiveNode.previous.position + 1: 0), bestActiveNode.position, @@ -543,26 +542,26 @@ public class LineLayoutManager extends InlineStackingLayoutManager if (pageAlignment == EN_JUSTIFY) { // leave all active nodes and find the optimum line number - //System.out.println("LBA.filterActiveNodes> " + activeNodeCount + " layouts"); + //log.debug("LBA.filterActiveNodes> " + activeNodeCount + " layouts"); for (int i = startLine; i < endLine; i++) { for (KnuthNode node = getNode(i); node != null; node = node.next) { - //System.out.println(" + lines = " + node.line + " demerits = " + node.totalDemerits); + //log.debug(" + lines = " + node.line + " demerits = " + node.totalDemerits); bestActiveNode = compareNodes(bestActiveNode, node); } } // scan the node set once again and remove some nodes - //System.out.println("LBA.filterActiveList> layout selection"); + //log.debug("LBA.filterActiveList> layout selection"); for (int i = startLine; i < endLine; i++) { for (KnuthNode node = getNode(i); node != null; node = node.next) { //if (Math.abs(node.line - bestActiveNode.line) > maxDiff) { //if (false) { if (node.line != bestActiveNode.line && node.totalDemerits > MAX_DEMERITS) { - //System.out.println(" XXX lines = " + node.line + " demerits = " + node.totalDemerits); + //log.debug(" XXX lines = " + node.line + " demerits = " + node.totalDemerits); removeNode(i, node); } else { - //System.out.println(" ok lines = " + node.line + " demerits = " + node.totalDemerits); + //log.debug(" ok lines = " + node.line + " demerits = " + node.totalDemerits); } } } @@ -1105,8 +1104,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager shorter or longer lines */ //TODO This code snippet is disabled. Reenable? if (false && alignment == EN_JUSTIFY && textAlignment == EN_JUSTIFY) { - //System.out.println("LLM.getNextKnuthElements> layouts with more lines? " + lineLayouts.canUseMoreLines()); - //System.out.println(" layouts with fewer lines? " + lineLayouts.canUseLessLines()); + //log.debug("LLM.getNextKnuthElements> layouts with more lines? " + lineLayouts.canUseMoreLines()); + //log.debug(" layouts with fewer lines? " + lineLayouts.canUseLessLines()); if (!lineLayouts.canUseMoreLines()) { alg.resetAlgorithm(); lineLayouts.savePossibilities(true); @@ -1132,8 +1131,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager lineLayouts.restorePossibilities(); iLineWidth = savedLineWidth; } - //System.out.println("LLM.getNextKnuthElements> now, layouts with more lines? " + lineLayouts.canUseMoreLines()); - //System.out.println(" now, layouts with fewer lines? " + lineLayouts.canUseLessLines()); + //log.debug("LLM.getNextKnuthElements> now, layouts with more lines? " + lineLayouts.canUseMoreLines()); + //log.debug(" now, layouts with fewer lines? " + lineLayouts.canUseLessLines()); } } return lineLayouts; @@ -1299,7 +1298,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false)); } - //System.out.println("first=" + nFirstLines + " inner=" + nInnerLines + //log.debug("first=" + nFirstLines + " inner=" + nInnerLines // + " optional=" + nOptionalLines + " eliminable=" + nEliminableLines // + " last=" + nLastLines // + " (condOpt=" + nConditionalOptionalLines + " condEl=" + nConditionalEliminableLines + ")"); @@ -1386,7 +1385,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager //} //int lineNumberDifference = (int)((double) totalAdj / constantLineHeight); int lineNumberDifference = (int) Math.round((double) totalAdj / constantLineHeight + (adj > 0 ? - 0.4 : 0.4)); - //System.out.println(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + " variazione applicata = " + lineNumberDifference); + //log.debug(" LLM> variazione calcolata = " + ((double) totalAdj / constantLineHeight) + " variazione applicata = " + lineNumberDifference); lineLayouts = (LineLayoutPossibilities)lineLayoutsList.get(pos.getLeafPos()); lineNumberDifference = lineLayouts.applyLineCountAdjustment(lineNumberDifference); return lineNumberDifference * constantLineHeight; @@ -1405,7 +1404,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager LinkedList returnList = new LinkedList(); for (int p = 0; p < knuthParagraphs.size(); p++) { lineLayouts = (LineLayoutPossibilities)lineLayoutsList.get(p); - //System.out.println("demerits of the chosen layout: " + lineLayouts.getChosenDemerits()); + //log.debug("demerits of the chosen layout: " + lineLayouts.getChosenDemerits()); for (int i = 0; i < lineLayouts.getChosenLineCount(); i++) { if (!((BlockLevelLayoutManager) parentLM).mustKeepTogether() && i >= fobj.getOrphans() @@ -1414,10 +1413,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false)); } LineBreakPosition lbp = (LineBreakPosition) lineLayouts.getChosenPosition(i); - //System.out.println("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference); - //System.out.println(" shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch); + //log.debug("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference); + //log.debug(" shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch); - //System.out.println("linewidth= " + lbp.lineWidth + " difference= " + lbp.difference + " indent= " + lbp.startIndent); + //log.debug("linewidth= " + lbp.lineWidth + " difference= " + lbp.difference + " indent= " + lbp.startIndent); MinOptMax contentIPD; if (alignment == EN_JUSTIFY) { contentIPD = new MinOptMax( @@ -1750,8 +1749,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager updatedRatio = (float) updatedDifference / lbp.availableShrink; } lc.setIPDAdjust(updatedRatio); - //System.out.println("LLM.addAreas> old difference = " + lbp.difference + " new difference = " + updatedDifference); - //System.out.println(" old ratio = " + lbp.ipdAdjust + " new ratio = " + updatedRatio); + //log.debug("LLM.addAreas> old difference = " + lbp.difference + " new difference = " + updatedDifference); + //log.debug(" old ratio = " + lbp.ipdAdjust + " new ratio = " + updatedRatio); } else if (false && textAlignment == EN_CENTER) { // re-compute indent int updatedIndent = lbp.startIndent diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java index d7f41efb9..524fe9d9d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutPossibilities.java @@ -157,7 +157,8 @@ public class LineLayoutPossibilities { chosenIndex = optimumIndex; } } -/*LF*/ //System.out.println(">> minLineCount = " + getMinLineCount() + " optLineCount = " + getOptLineCount() + " maxLineCount() = " + getMaxLineCount()); + //log.debug(">> minLineCount = " + getMinLineCount() + // + " optLineCount = " + getOptLineCount() + " maxLineCount() = " + getMaxLineCount()); } public void addBreakPosition(Position pos, int i) { diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index c8cedb0bb..5a98deac6 100644 --- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -385,10 +385,10 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager while (oldListIterator.hasNext()) { oldElement = (KnuthElement)oldListIterator.next(); Position innerPosition = ((NonLeafPosition) oldElement.getPosition()).getPosition(); - //System.out.println(" BLM> unwrapping: " + (oldElement.isBox() + //log.debug(" BLM> unwrapping: " + (oldElement.isBox() // ? "box " : (oldElement.isGlue() ? "glue " : "penalty")) // + " creato da " + oldElement.getLayoutManager().getClass().getName()); - //System.out.println(" BLM> unwrapping: " + //log.debug(" BLM> unwrapping: " // + oldElement.getPosition().getClass().getName()); if (innerPosition != null) { // oldElement was created by a descendant of this BlockLM diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java index 1cc7df68a..2708b440a 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java @@ -692,24 +692,20 @@ public class TableContentLayoutManager implements PercentBaseContext { TableBody body = null; while (iterator.hasNext()) { Position pos = (Position)iterator.next(); - //System.out.println(pos); if (pos instanceof TableContentPosition) { TableContentPosition tcpos = (TableContentPosition)pos; lst.add(tcpos); - //System.out.println(tcpos.row); GridUnitPart part = (GridUnitPart)tcpos.gridUnitParts.get(0); if (body == null) { body = part.pgu.getBody(); } if (tcpos.getFlag(TableContentPosition.FIRST_IN_ROWGROUP) && tcpos.row.getFlag(EffRow.FIRST_IN_BODY)) { - //System.out.println("pgu is first in body"); firstPos = true; } if (tcpos.getFlag(TableContentPosition.LAST_IN_ROWGROUP) && tcpos.row.getFlag(EffRow.LAST_IN_BODY)) { - //System.out.println("pgu is last in body"); lastPos = true; getTableLM().getCurrentPV().addMarkers(body.getMarkers(), true, firstPos, lastPos); |