]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Created new Root.notifyPageSequenceFinished() method, consolidating
authorGlen Mazza <gmazza@apache.org>
Tue, 1 Mar 2005 00:11:03 +0000 (00:11 +0000)
committerGlen Mazza <gmazza@apache.org>
Tue, 1 Mar 2005 00:11:03 +0000 (00:11 +0000)
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

src/java/org/apache/fop/fo/pagination/Root.java
src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java

index 42e7bfdc5725777fe4ec7945afd7c631c53ac1dc..ffe6ea971cae1918d3729b813c5d954777d2bb8c 100644 (file)
@@ -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.");
-        }
+        }       
     }
 
     /**
index a571ffa862b795e2c453223068de17b7224d2570..d7cb07fa3ae4f0f5b33d6208920a2c316c134e29 100644 (file)
@@ -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() */