From: Glen Mazza Date: Tue, 1 Mar 2005 00:11:03 +0000 (+0000) Subject: Created new Root.notifyPageSequenceFinished() method, consolidating X-Git-Tag: Root_Temp_KnuthStylePageBreaking~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf449e8e7cbe72b31df00eb9e4d66cc329ca891e;p=xmlgraphics-fop.git Created new Root.notifyPageSequenceFinished() method, consolidating two other methods to better stress that these occur as a unit. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198460 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index 42e7bfdc5..ffe6ea971 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -158,14 +158,6 @@ public class Root extends FObj { return endingPageNumberOfPreviousSequence; } - /** - * Sets the last page number by the just-finished page-sequence - * @param lastPageNumber the last page number of the sequence - */ - public void setEndingPageNumberOfPreviousSequence(int lastPageNumber) { - endingPageNumberOfPreviousSequence = lastPageNumber; - } - /** * Returns the total number of pages generated by FOP * (May not equal endingPageNumberOfPreviousSequence due to @@ -178,16 +170,19 @@ public class Root extends FObj { /** * Notify additional pages generated to increase the totalPagesGenerated counter - * @param lastPageNumber the last page number of the sequence + * @param lastPageNumber the last page number generated by the sequence + * @param additionalPages the total pages generated by the sequence (for statistics) * @throws IllegalArgumentException for negative additional page counts */ - public void notifyAdditionalPagesGenerated(int additionalPages) { + public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) { + if (additionalPages >= 0) { totalPagesGenerated += additionalPages; + endingPageNumberOfPreviousSequence = lastPageNumber; } else { throw new IllegalArgumentException( "Number of additional pages must be zero or greater."); - } + } } /** diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index a571ffa86..d7cb07fa3 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -212,8 +212,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { currentPageNum--; log.debug("Ending layout"); finishPage(); - pageSeq.getRoot().notifyAdditionalPagesGenerated((currentPageNum - startPageNum) + 1); - pageSeq.getRoot().setEndingPageNumberOfPreviousSequence(currentPageNum); + pageSeq.getRoot().notifyPageSequenceFinished(currentPageNum, (currentPageNum - startPageNum) + 1); } /** @see org.apache.fop.layoutmgr.LayoutManager#isBogus() */