]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
PR:
authorGlen Mazza <gmazza@apache.org>
Sun, 6 Feb 2005 20:48:48 +0000 (20:48 +0000)
committerGlen Mazza <gmazza@apache.org>
Sun, 6 Feb 2005 20:48:48 +0000 (20:48 +0000)
Obtained from:
Submitted by:
Reviewed by:
Rolled the PageNumberGenerator from PSLM back into PageSequence (slightly simpler, also this functionality is useful for non-layout render types), renamed PageViewport.getPageNumber() to .getPageNumberString() to emphasize what it is actually returning.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198381 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/CachedRenderPagesModel.java
src/java/org/apache/fop/area/PageViewport.java
src/java/org/apache/fop/area/RenderPagesModel.java
src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java
src/java/org/apache/fop/fo/pagination/PageSequence.java
src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java
src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
src/java/org/apache/fop/render/ps/PSRenderer.java
src/java/org/apache/fop/render/xml/XMLRenderer.java

index d09f000019a66318f8e7a433c31f83e36199ceca..6c3d1cc1a04c8cfd98baf1e96be03cdb8364d260 100644 (file)
@@ -83,7 +83,7 @@ public class CachedRenderPagesModel extends RenderPagesModel {
                     if (!p.isResolved()) {
                         String[] idrefs = p.getIDRefs();
                         for (int count = 0; count < idrefs.length; count++) {
-                            log.warn("Page " + p.getPageNumber() + 
+                            log.warn("Page " + p.getPageNumberString() + 
                                 ": Unresolved id reference \"" + idrefs[count] 
                                 + "\" found.");
                         }
index 74a491614a60c09e751304d811b261139b17c542..90f3aaba650c4e11483a0617a68552599c2db7c6 100644 (file)
@@ -42,7 +42,7 @@ public class PageViewport implements Resolvable, Cloneable {
     private Page page;
     private Rectangle2D viewArea;
     private boolean clip = false;
-    private String pageNumber = null;
+    private String pageNumberString = null;
 
     // list of id references and the rectangle on the page
     private Map idReferences = null;
@@ -100,16 +100,16 @@ public class PageViewport implements Resolvable, Cloneable {
      * Set the page number for this page.
      * @param num the string representing the page number
      */
-    public void setPageNumber(String num) {
-        pageNumber = num;
+    public void setPageNumberString(String num) {
+        pageNumberString = num;
     }
 
     /**
      * Get the page number of this page.
      * @return the string that represents this page
      */
-    public String getPageNumber() {
-        return pageNumber;
+    public String getPageNumberString() {
+        return pageNumberString;
     }
 
     /**
@@ -368,7 +368,7 @@ public class PageViewport implements Resolvable, Cloneable {
     public String toString() {
         StringBuffer sb = new StringBuffer(64);
         sb.append("PageViewport: page=");
-        sb.append(getPageNumber());
+        sb.append(getPageNumberString());
         return sb.toString();
     }
 }
index c28b7fb6105d86a4912e1acfd9ff5742f8ef3bb8..b16a1c71a0a542917fe477917b8aafd8834d0581 100644 (file)
@@ -151,7 +151,7 @@ public class RenderPagesModel extends StorePagesModel {
                     if (!p.isResolved()) {
                         String[] idrefs = p.getIDRefs();
                         for (int count = 0; count < idrefs.length; count++) {
-                            log.warn("Page " + p.getPageNumber() + 
+                            log.warn("Page " + p.getPageNumberString() + 
                                 ": Unresolved id reference \"" + idrefs[count] 
                                 + "\" found.");
                         }
index 09115fdf8ff1fa5b5171afe1a4da94815ae780d0..29a4438f416fd62b5927dd3cbfa0e7abd77de1d0 100644 (file)
@@ -65,7 +65,7 @@ public class UnresolvedPageNumber extends TextArea implements Resolvable {
         if (pageIDRef.equals(id) && pages != null) {
             resolved = true;
             PageViewport page = (PageViewport)pages.get(0);
-            text = page.getPageNumber();
+            text = page.getPageNumberString();
             /**@todo Update IPD ??? */
         }
     }
index 1c6f4836eed5b5652a8f68c4407ccf9d5d9966f6..18678bf0c8c53637e1fa5b974e033abdab5a0f96 100644 (file)
@@ -87,7 +87,7 @@ public class PageSequence extends FObj {
     public int currentPageNumber = 0;
     private int explicitFirstNumber = 0; // explicitly specified
     public int firstPageNumber = 0; // actual
-    public PageNumberGenerator pageNumberGenerator;
+    private PageNumberGenerator pageNumberGenerator;
 
     private int pageCount = 0;
     private boolean isForcing = false;
@@ -678,11 +678,12 @@ public class PageSequence extends FObj {
     }
 
     /**
-     * Public accessor for getting the PageNumberGenerator.
-     * @return the PageNumberGenerator
+     * Retrieves the string representation of a page number applicable
+     * for this page sequence
+     * @return string representation of the page number
      */
-    public PageNumberGenerator getPageNumberGenerator() {
-        return pageNumberGenerator;
+    public String makeFormattedPageNumber(int pageNumber) {
+        return pageNumberGenerator.makeFormattedPageNumber(pageNumber);
     }
 
     /**
index 223151d9dff6c98f608d5bedb0e6ef2504b9137d..d2755fea38b53ca8baaef057f0fd12f881e4657e 100644 (file)
@@ -74,7 +74,7 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager {
         PageViewport page = parentLM.resolveRefID(fobj.getRefId());
         InlineArea inline = null;
         if (page != null) {
-            String str = page.getPageNumber();
+            String str = page.getPageNumberString();
             // get page string from parent, build area
             TextArea text = new TextArea();
             inline = text;
index 20b34d6e8cb50d7db790b88c18f7e771ac6c8dcc..e05ee1da7eea982e4c420617e85396e16d1f5c86 100644 (file)
@@ -44,7 +44,6 @@ import org.apache.fop.datatypes.FODimension;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.flow.Marker;
-import org.apache.fop.fo.pagination.PageNumberGenerator;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fo.pagination.Region;
 import org.apache.fop.fo.pagination.RegionBody;
@@ -76,7 +75,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
         }
     }
 
-    private PageNumberGenerator pageNumberGenerator;
     private int pageCount = 1;
     private String pageNumberString;
     private boolean isFirstPage = true;
@@ -194,8 +192,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
     public void activateLayout() {
         pageSeq.initPageNumber();
         pageCount = pageSeq.getCurrentPageNumber();
-        pageNumberGenerator = pageSeq.getPageNumberGenerator();
-        pageNumberString = pageNumberGenerator.makeFormattedPageNumber(pageCount);
+        pageNumberString = pageSeq.makeFormattedPageNumber(pageCount);
 
         LineArea title = null;
         if (pageSeq.getTitleFO() != null) {
@@ -221,7 +218,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
                 // finish page and add to area tree
                 finishPage();
                 pageCount++;
-                pageNumberString = pageNumberGenerator.makeFormattedPageNumber(pageCount);
+                pageNumberString = pageSeq.makeFormattedPageNumber(pageCount);
             }
         }
         pageCount--;
@@ -480,9 +477,9 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
             log.error("Cannot create page", fopex);
         }
 
-        curPage.setPageNumber(getCurrentPageNumber());
+        curPage.setPageNumberString(getCurrentPageNumber());
         if (log.isDebugEnabled()) {
-            log.debug("[" + curPage.getPageNumber() + "]");
+            log.debug("[" + curPage.getPageNumberString() + "]");
         }
         RegionViewport rv = curPage.getPage().getRegionViewport(
                     FO_REGION_BODY);
index 52c433b9dbad0172c6f8461e19e199bc1feca5e8..fbe7a998430969f27f8895b6fdfa165e02c8939c 100644 (file)
@@ -357,7 +357,7 @@ public class PSRenderer extends PrintRenderer {
 
         this.currentPageNumber++;
         gen.writeDSCComment(DSCConstants.PAGE, new Object[]
-                {page.getPageNumber(),
+                {page.getPageNumberString(),
                  new Integer(this.currentPageNumber)});
         final Integer zero = new Integer(0);
         final long pagewidth = Math.round(page.getViewArea().getWidth());
index ab1e20d74742e32305d52bc78c5bbdf40df598ab..4a2e54cf1c2845c0afaf822435b75e8283d44305 100644 (file)
@@ -338,7 +338,7 @@ public class XMLRenderer extends AbstractRenderer {
     public void renderPage(PageViewport page) throws IOException, FOPException {
         atts.clear();
         addAttribute("bounds", page.getViewArea());
-        addAttribute("nr", page.getPageNumber());
+        addAttribute("nr", page.getPageNumberString());
         startElement("pageViewport", atts);
         startElement("page");
         super.renderPage(page);