]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
PR:
authorGlen Mazza <gmazza@apache.org>
Sat, 4 Dec 2004 06:51:13 +0000 (06:51 +0000)
committerGlen Mazza <gmazza@apache.org>
Sat, 4 Dec 2004 06:51:13 +0000 (06:51 +0000)
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

src/java/org/apache/fop/area/BookmarkData.java
src/java/org/apache/fop/area/LinkResolver.java
src/java/org/apache/fop/area/PageViewport.java
src/java/org/apache/fop/area/Resolvable.java
src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java

index d0a49832723e944eb5be09eb3209d072d2eabdd8..44eec36fef7205d1c9f1916a69eaf6e5866658e1 100644 (file)
@@ -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();
         }
index 845cff8bdbea10ff41432d6d7cfd30c6ec3a33d5..cbc38095a6c96bbc225f365adc366154f0158dd6 100644 (file)
@@ -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) {
index a0c87a5c0e085e107f58c67b9ab43eaf7c2d1149..fdcbf26c2d4e705202a63232b9667efd8495d926 100644 (file)
@@ -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;
             }
         }
     }
index 97c889ce09f4212cb5b22b644b297ae64c460a5a..7d1da2c23ad1daa2acc8c69d94943b5155ee5f96 100644 (file)
@@ -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);
 }
index dcced2bb7c90e984455b13b25a03c011cf6b9f95..30db0d7e8eb15e87a6a500c1a7bf4b7f42183785 100644 (file)
@@ -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 ??? */
         }
     }