aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-05-17 07:02:14 +0000
committerJeremias Maerki <jeremias@apache.org>2005-05-17 07:02:14 +0000
commitf7e7da95ecf3a2190bf62b0475ecb46e1ddbfe49 (patch)
tree98aee96433c3e2d70ec59b2466111fec8075dcbc /src/java
parent0f80e203b0e56f4926eb2fba1c4404afda8d5223 (diff)
downloadxmlgraphics-fop-f7e7da95ecf3a2190bf62b0475ecb46e1ddbfe49.tar.gz
xmlgraphics-fop-f7e7da95ecf3a2190bf62b0475ecb46e1ddbfe49.zip
Converted System.out calls to logger calls.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractBreaker.java132
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java2
5 files changed, 79 insertions, 65 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
index 36adad77b..e170616e0 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
@@ -130,7 +130,7 @@ public abstract class AbstractBreaker {
BlockSequence blockList;
blockLists = new java.util.ArrayList();
- System.out.println("PLM> flow BPD =" + flowBPD);
+ log.debug("PLM> flow BPD =" + flowBPD);
//*** Phase 1: Get Knuth elements ***
int nextSequenceStartsOn = Constants.EN_ANY;
@@ -139,20 +139,22 @@ public abstract class AbstractBreaker {
}
//*** Phase 2: Alignment and breaking ***
- System.out.println("PLM> blockLists.size() = " + blockLists.size());
+ log.debug("PLM> blockLists.size() = " + blockLists.size());
for (blockListIndex = 0; blockListIndex < blockLists.size(); blockListIndex++) {
blockList = (BlockSequence) blockLists.get(blockListIndex);
//debug code start
- System.err.println(" blockListIndex = " + blockListIndex);
- String pagina = (blockList.startOn == Constants.EN_ANY) ? "any page"
- : (blockList.startOn == Constants.EN_ODD_PAGE) ? "odd page"
- : "even page";
- System.err.println(" sequence starts on " + pagina);
- logBlocklist(blockList);
+ if (log.isDebugEnabled()) {
+ log.debug(" blockListIndex = " + blockListIndex);
+ String pagina = (blockList.startOn == Constants.EN_ANY) ? "any page"
+ : (blockList.startOn == Constants.EN_ODD_PAGE) ? "odd page"
+ : "even page";
+ log.debug(" sequence starts on " + pagina);
+ logBlocklist(blockList);
+ }
//debug code end
- System.out.println("PLM> start of algorithm (" + this.getClass().getName()
+ log.debug("PLM> start of algorithm (" + this.getClass().getName()
+ "), flow BPD =" + flowBPD);
PageBreakingAlgorithm alg = new PageBreakingAlgorithm(getTopLevelLM(),
alignment, alignmentLast);
@@ -170,7 +172,7 @@ public abstract class AbstractBreaker {
//iOptPageNumber = alg.firstFit(effectiveList, flowBPD, 1, true);
iOptPageNumber = alg.findBreakingPoints(effectiveList, flowBPD, 1,
true, true);
- System.out.println("PLM> iOptPageNumber= " + iOptPageNumber
+ log.debug("PLM> iOptPageNumber= " + iOptPageNumber
+ " pageBreaks.size()= " + alg.getPageBreaks().size());
@@ -206,7 +208,7 @@ public abstract class AbstractBreaker {
for (int p = 0; p < partCount; p++) {
PageBreakPosition pbp = (PageBreakPosition) alg.getPageBreaks().get(p);
endElementIndex = pbp.getLeafPos();
- System.out.println("PLM> part: " + (p + 1)
+ log.debug("PLM> part: " + (p + 1)
+ ", break at position " + endElementIndex);
startPart(effectiveList, (p == 0));
@@ -243,7 +245,7 @@ public abstract class AbstractBreaker {
}
if (startElementIndex <= endElementIndex) {
- System.out.println(" addAreas da " + startElementIndex
+ log.debug(" addAreas da " + startElementIndex
+ " a " + endElementIndex);
childLC = new LayoutContext(0);
// add space before if display-align is center or bottom
@@ -311,20 +313,20 @@ public abstract class AbstractBreaker {
.removeLast();
switch (breakPenalty.getBreakClass()) {
case Constants.EN_PAGE:
- System.err.println("PLM> break - PAGE");
+ log.debug("PLM> break - PAGE");
nextSequenceStartsOn = Constants.EN_ANY;
break;
case Constants.EN_COLUMN:
- System.err.println("PLM> break - COLUMN");
+ log.debug("PLM> break - COLUMN");
//TODO Fix this when implementing multi-column layout
nextSequenceStartsOn = Constants.EN_COLUMN;
break;
case Constants.EN_ODD_PAGE:
- System.err.println("PLM> break - ODD PAGE");
+ log.debug("PLM> break - ODD PAGE");
nextSequenceStartsOn = Constants.EN_ODD_PAGE;
break;
case Constants.EN_EVEN_PAGE:
- System.err.println("PLM> break - EVEN PAGE");
+ log.debug("PLM> break - EVEN PAGE");
nextSequenceStartsOn = Constants.EN_EVEN_PAGE;
break;
default:
@@ -399,7 +401,7 @@ public abstract class AbstractBreaker {
int iOptPageNumber;
iOptPageNumber = alg.findBreakingPoints(blockList, availableBPD, 1,
true, true);
- System.out.println("PLM> iOptPageNumber= " + iOptPageNumber);
+ log.debug("PLM> iOptPageNumber= " + iOptPageNumber);
//
ListIterator sequenceIterator = blockList.listIterator();
@@ -412,10 +414,12 @@ public abstract class AbstractBreaker {
while (breakIterator.hasNext()) {
thisBreak = (PageBreakPosition) breakIterator.next();
- System.out.println("| first page: break= "
- + thisBreak.getLeafPos() + " difference= "
- + thisBreak.difference + " ratio= "
- + thisBreak.bpdAdjust);
+ if (log.isDebugEnabled()) {
+ log.debug("| first page: break= "
+ + thisBreak.getLeafPos() + " difference= "
+ + thisBreak.difference + " ratio= "
+ + thisBreak.bpdAdjust);
+ }
accumulatedS = 0;
adjustedDiff = 0;
@@ -428,7 +432,7 @@ public abstract class AbstractBreaker {
while (!(firstElement = (KnuthElement) sequenceIterator
.next()).isBox()) {
//
- System.out.println("PLM> ignoring glue or penalty element "
+ log.debug("PLM> ignoring glue or penalty element "
+ "at the beginning of the sequence");
if (firstElement.isGlue()) {
((BlockLevelLayoutManager) firstElement
@@ -502,14 +506,13 @@ public abstract class AbstractBreaker {
}
}
}
- System.out.println("| line number adj= "
+ log.debug("| line number adj= "
+ lineNumberMaxAdjustment);
- System.out.println("| space adj = "
+ log.debug("| space adj = "
+ spaceMaxAdjustment);
if (thisElement.isPenalty() && thisElement.getW() > 0) {
- System.out
- .println(" mandatory variation to the number of lines!");
+ log.debug(" mandatory variation to the number of lines!");
((BlockLevelLayoutManager) thisElement
.getLayoutManager()).negotiateBPDAdjustment(
thisElement.getW(), thisElement);
@@ -526,7 +529,7 @@ public abstract class AbstractBreaker {
thisBreak.difference,
(thisBreak.difference > 0 ? spaceMaxAdjustment.max
: -spaceMaxAdjustment.min));
- System.out.println("single space: "
+ log.debug("single space: "
+ (adjustedDiff == thisBreak.difference
|| thisBreak.bpdAdjust == 0 ? "ok"
: "ERROR"));
@@ -541,7 +544,7 @@ public abstract class AbstractBreaker {
thisBreak.difference - adjustedDiff,
((thisBreak.difference - adjustedDiff) > 0 ? spaceMaxAdjustment.max
: -spaceMaxAdjustment.min));
- System.out.println("lines and space: "
+ log.debug("lines and space: "
+ (adjustedDiff == thisBreak.difference
|| thisBreak.bpdAdjust == 0 ? "ok"
: "ERROR"));
@@ -571,27 +574,30 @@ public abstract class AbstractBreaker {
* @param blockList block list to log
*/
private void logBlocklist(KnuthSequence blockList) {
+ if (!log.isDebugEnabled()) {
+ return;
+ }
ListIterator tempIter = blockList.listIterator();
KnuthElement temp;
- System.out.println(" ");
+ log.debug(" ");
while (tempIter.hasNext()) {
temp = (KnuthElement) tempIter.next();
if (temp.isBox()) {
- System.out.println(tempIter.previousIndex()
+ log.debug(tempIter.previousIndex()
+ ") " + temp);
} else if (temp.isGlue()) {
- System.out.println(tempIter.previousIndex()
+ log.debug(tempIter.previousIndex()
+ ") " + temp);
} else {
- System.out.println(tempIter.previousIndex()
+ log.debug(tempIter.previousIndex()
+ ") " + temp);
}
if (temp.getPosition() != null) {
- System.out.println(" " + temp.getPosition());
+ log.debug(" " + temp.getPosition());
}
}
- System.out.println(" ");
+ log.debug(" ");
}
/**
@@ -599,28 +605,37 @@ public abstract class AbstractBreaker {
* @param effectiveList block list to log
*/
private void logEffectiveList(KnuthSequence effectiveList) {
- System.out.println("Effective list");
+ log.debug("Effective list");
logBlocklist(effectiveList);
}
private int adjustBlockSpaces(LinkedList spaceList, int difference, int total) {
- /*LF*/ System.out.println("AdjustBlockSpaces: difference " + difference + " / " + total + " on " + spaceList.size() + " spaces in block");
- ListIterator spaceListIterator = spaceList.listIterator();
- int adjustedDiff = 0;
- int partial = 0;
- while (spaceListIterator.hasNext()) {
- KnuthGlue blockSpace = (KnuthGlue)spaceListIterator.next();
- partial += (difference > 0 ? blockSpace.getY() : blockSpace.getZ());
- System.out.println("available = " + partial + " / " + total);
- System.out.println("competenza = " + (((int) ((float) partial * difference / total)) - adjustedDiff) + " / " + difference);
- int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace);
- adjustedDiff += newAdjust;
+ if (log.isDebugEnabled()) {
+ log.debug("AdjustBlockSpaces: difference " + difference + " / " + total
+ + " on " + spaceList.size() + " spaces in block");
+ }
+ ListIterator spaceListIterator = spaceList.listIterator();
+ int adjustedDiff = 0;
+ int partial = 0;
+ while (spaceListIterator.hasNext()) {
+ KnuthGlue blockSpace = (KnuthGlue)spaceListIterator.next();
+ partial += (difference > 0 ? blockSpace.getY() : blockSpace.getZ());
+ if (log.isDebugEnabled()) {
+ log.debug("available = " + partial + " / " + total);
+ log.debug("competenza = "
+ + (((int)((float) partial * difference / total)) - adjustedDiff)
+ + " / " + difference);
}
- return adjustedDiff;
+ int newAdjust = ((BlockLevelLayoutManager) blockSpace.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, blockSpace);
+ adjustedDiff += newAdjust;
}
+ return adjustedDiff;
+ }
private int adjustLineNumbers(LinkedList lineList, int difference, int total) {
- /*LF*/ System.out.println("AdjustLineNumbers: difference " + difference + " / " + total + " on " + lineList.size() + " elements");
+ if (log.isDebugEnabled()) {
+ log.debug("AdjustLineNumbers: difference " + difference + " / " + total + " on " + lineList.size() + " elements");
+ }
// int adjustedDiff = 0;
// int partial = 0;
@@ -645,17 +660,16 @@ public abstract class AbstractBreaker {
// }
// return adjustedDiff;
- ListIterator lineListIterator = lineList.listIterator();
- int adjustedDiff = 0;
- int partial = 0;
- while (lineListIterator.hasNext()) {
- KnuthGlue line = (KnuthGlue)lineListIterator.next();
- partial += (difference > 0 ? line.getY() : line.getZ());
- int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line);
- adjustedDiff += newAdjust;
- }
- return adjustedDiff;
+ ListIterator lineListIterator = lineList.listIterator();
+ int adjustedDiff = 0;
+ int partial = 0;
+ while (lineListIterator.hasNext()) {
+ KnuthGlue line = (KnuthGlue)lineListIterator.next();
+ partial += (difference > 0 ? line.getY() : line.getZ());
+ int newAdjust = ((BlockLevelLayoutManager) line.getLayoutManager()).negotiateBPDAdjustment(((int) ((float) partial * difference / total)) - adjustedDiff, line);
+ adjustedDiff += newAdjust;
}
-
+ return adjustedDiff;
+ }
}
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index ca9c8caad..05abe663f 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -407,7 +407,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
return returnValue;
} else {
// this should never happen
- System.err.println("BlockLayoutManager.negotiateBPDAdjustment(): unexpected Position");
+ log.error("BlockLayoutManager.negotiateBPDAdjustment(): unexpected Position");
return 0;
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
index c0d87a772..bd947febc 100644
--- a/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
@@ -18,8 +18,6 @@
package org.apache.fop.layoutmgr;
-import java.util.ArrayList;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
index 766ca99c8..6ca570d3b 100644
--- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
@@ -58,8 +58,10 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
// add nodes at the beginning of the list, as they are found
// backwards, from the last one to the first one
- System.out.println("BBA> difference= " + difference + " ratio= " + ratio
- + " posizione= " + bestActiveNode.position);
+ if (log.isDebugEnabled()) {
+ log.debug("BBA> difference= " + difference + " ratio= " + ratio
+ + " posizione= " + bestActiveNode.position);
+ }
insertPageBreakAsFirst(new PageBreakPosition(this.topLevelLM,
bestActiveNode.position, ratio, difference));
}
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index 4983027cc..64b35f0c6 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -230,7 +230,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
/*LF*/ childFLM = (FlowLayoutManager)curLM;
/*LF*/ } else {
/*LF*/ if (curLM != childFLM) {
-/*LF*/ System.out.println("PLM> figlio sconosciuto (invalid child LM)");
+/*LF*/ log.error("PSLM> invalid child LM");
/*LF*/ }
/*LF*/ }