diff options
author | Glen Mazza <gmazza@apache.org> | 2005-02-06 20:48:48 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2005-02-06 20:48:48 +0000 |
commit | 365625169d7febf9ae67460614bcd42f05d66274 (patch) | |
tree | 06fb0733c66addad890cdfe54b6b0734a70b7df3 /src/java/org/apache/fop | |
parent | 53e0eb6fda134dd1097feed0e6cc315e2220f846 (diff) | |
download | xmlgraphics-fop-365625169d7febf9ae67460614bcd42f05d66274.tar.gz xmlgraphics-fop-365625169d7febf9ae67460614bcd42f05d66274.zip |
PR:
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
Diffstat (limited to 'src/java/org/apache/fop')
9 files changed, 22 insertions, 24 deletions
diff --git a/src/java/org/apache/fop/area/CachedRenderPagesModel.java b/src/java/org/apache/fop/area/CachedRenderPagesModel.java index d09f00001..6c3d1cc1a 100644 --- a/src/java/org/apache/fop/area/CachedRenderPagesModel.java +++ b/src/java/org/apache/fop/area/CachedRenderPagesModel.java @@ -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."); } diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java index 74a491614..90f3aaba6 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/java/org/apache/fop/area/PageViewport.java @@ -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(); } } diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/java/org/apache/fop/area/RenderPagesModel.java index c28b7fb61..b16a1c71a 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/java/org/apache/fop/area/RenderPagesModel.java @@ -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."); } diff --git a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java index 09115fdf8..29a4438f4 100644 --- a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java +++ b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java @@ -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 ??? */ } } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 1c6f4836e..18678bf0c 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -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); } /** diff --git a/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java index 223151d9d..d2755fea3 100644 --- a/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java @@ -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; diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index 20b34d6e8..e05ee1da7 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -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); diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java index 52c433b9d..fbe7a9984 100644 --- a/src/java/org/apache/fop/render/ps/PSRenderer.java +++ b/src/java/org/apache/fop/render/ps/PSRenderer.java @@ -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()); diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index ab1e20d74..4a2e54cf1 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -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); |