From: Glen Mazza Date: Sat, 4 Dec 2004 06:51:13 +0000 (+0000) Subject: PR: X-Git-Tag: Root_Temp_KnuthStylePageBreaking~323 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd0a400a78ecab6d0200a3a969a723bc912aa289;p=xmlgraphics-fop.git PR: Obtained from: Submitted by: Reviewed by: More code commenting. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198184 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/BookmarkData.java b/src/java/org/apache/fop/area/BookmarkData.java index d0a498327..44eec36fe 100644 --- a/src/java/org/apache/fop/area/BookmarkData.java +++ b/src/java/org/apache/fop/area/BookmarkData.java @@ -179,7 +179,6 @@ public class BookmarkData extends OffDocumentItem implements Resolvable { pageRef = (PageViewport)pages.get(0); } // TODO get rect area of id on page - idRefs.remove(idRef); checkFinish(); } diff --git a/src/java/org/apache/fop/area/LinkResolver.java b/src/java/org/apache/fop/area/LinkResolver.java index 845cff8bd..cbc38095a 100644 --- a/src/java/org/apache/fop/area/LinkResolver.java +++ b/src/java/org/apache/fop/area/LinkResolver.java @@ -60,6 +60,8 @@ public class LinkResolver implements Resolvable, Serializable { /** * Resolve by adding an internal link. + * + * @see org.apache.fop.area.Resolveable#resolveIDRef(String, List) */ public void resolveIDRef(String id, List pages) { if (idRef.equals(id) && pages != null) { diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java index a0c87a5c0..fdcbf26c2 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/java/org/apache/fop/area/PageViewport.java @@ -48,8 +48,10 @@ public class PageViewport implements Resolvable, Cloneable { private Map idReferences = null; // this keeps a list of currently unresolved areas or extensions - // once the thing is resolved it is removed + // once an idref is resolved it is removed // when this is empty the page can be rendered + private Map unresolvedIDRefs = new HashMap(); + private Map unresolved = null; private Map pendingResolved = null; @@ -131,14 +133,14 @@ public class PageViewport implements Resolvable, Cloneable { * @param id the id of the reference * @param res the resolver of the reference */ - public void addUnresolvedIDRef(String id, Resolvable res) { - if (unresolved == null) { - unresolved = new HashMap(); + public void addUnresolvedIDRef(String idref, Resolvable res) { + if (unresolvedIDRefs == null) { + unresolvedIDRefs = new HashMap(); } - List list = (List)unresolved.get(id); + List list = (List)unresolvedIDRefs.get(idref); if (list == null) { list = new ArrayList(); - unresolved.put(id, list); + unresolvedIDRefs.put(idref, list); } list.add(res); } @@ -148,7 +150,7 @@ public class PageViewport implements Resolvable, Cloneable { * @return true if the page is resolved and can be rendered */ public boolean isResolved() { - return unresolved == null; + return unresolvedIDRefs == null; } /** @@ -169,8 +171,8 @@ public class PageViewport implements Resolvable, Cloneable { } pendingResolved.put(id, pages); } else { - if (unresolved != null) { - List todo = (List)unresolved.get(id); + if (unresolvedIDRefs != null) { + List todo = (List)unresolvedIDRefs.get(id); if (todo != null) { for (int count = 0; count < todo.size(); count++) { Resolvable res = (Resolvable)todo.get(count); @@ -179,10 +181,10 @@ public class PageViewport implements Resolvable, Cloneable { } } } - if (unresolved != null) { - unresolved.remove(id); - if (unresolved.isEmpty()) { - unresolved = null; + if (unresolvedIDRefs != null) { + unresolvedIDRefs.remove(id); + if (unresolvedIDRefs.isEmpty()) { + unresolvedIDRefs = null; } } } diff --git a/src/java/org/apache/fop/area/Resolvable.java b/src/java/org/apache/fop/area/Resolvable.java index 97c889ce0..7d1da2c23 100644 --- a/src/java/org/apache/fop/area/Resolvable.java +++ b/src/java/org/apache/fop/area/Resolvable.java @@ -51,12 +51,12 @@ public interface Resolvable { * identifies to the AreaTreeHandler which idrefs it needs * resolved. After the idrefs are resolved, the ATH calls this * method to allow the Resolvable object to update itself with - * the PageViewport information. + * the PageViewport information. * * @param id an ID matching one of the Resolvable object's * unresolved idref's. * @param pages the list of PageViewports with the given ID - * may be null if ID is not tied to any + * */ void resolveIDRef(String id, List pages); } diff --git a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java index dcced2bb7..30db0d7e8 100644 --- a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java +++ b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java @@ -58,15 +58,14 @@ public class UnresolvedPageNumber extends TextArea implements Resolvable { * for this ID. The page number text is then set to the String value * of the page number. * - * @param id the id associated with the pages parameter + * @param id an id whose PageViewports have been determined * @param pages the list of PageViewports associated with this ID */ public void resolveIDRef(String id, List pages) { - if (pages != null) { + if (pageIDRef.equals(id) && pages != null) { resolved = true; PageViewport page = (PageViewport)pages.get(0); - String str = page.getPageNumber(); - text = str; + text = page.getPageNumber(); /**@todo Update IPD ??? */ } }