]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
PR:
authorGlen Mazza <gmazza@apache.org>
Thu, 2 Dec 2004 01:59:40 +0000 (01:59 +0000)
committerGlen Mazza <gmazza@apache.org>
Thu, 2 Dec 2004 01:59:40 +0000 (01:59 +0000)
Obtained from:
Submitted by:
Reviewed by:
More commenting, changed definition of isResolved() somewhat in LinkResolver and UnresolvedPageNumber.

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

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

index 5cbeeca0f08f551fe4508a6340e15712b86aa678..36f7fe8a1a202ac9019dd3e68f3f5355fa3614ff 100644 (file)
@@ -160,7 +160,7 @@ public class AreaTreeHandler extends FOEventHandler {
     /**
      * Add an Resolvable object with an unresolved idref
      * @param idref the idref whose target id has not yet been located
-     * @param res the Resolvable object with the unresolved idref
+     * @param res the Resolvable object needing the idref to be resolved
      */
     public void addUnresolvedIDRef(String idref, Resolvable res) {
         Set todo = (Set) unresolvedIDRefs.get(idref);
@@ -193,15 +193,19 @@ public class AreaTreeHandler extends FOEventHandler {
      * @throws SAXException if there is some error
      */
     public void endDocument() throws SAXException {
-        // deal with unresolved references
+        /* 
+         * inform Resolveable objects that certain idrefs
+         * could not be found
+         * @todo unsure if this block is needed. 
+         */
         for (Iterator iter = unresolvedIDRefs.keySet().iterator(); 
                 iter.hasNext();) {
-            String id = (String)iter.next();
-            Set list = (Set) unresolvedIDRefs.get(id);
+            String idref = (String) iter.next();
+            Set list = (Set) unresolvedIDRefs.get(idref);
             for (Iterator resIter = list.iterator(); resIter.hasNext();) {
-                Resolvable res = (Resolvable)resIter.next();
+                Resolvable res = (Resolvable) resIter.next();
                 if (!res.isResolved()) {
-                    res.resolveIDRef(id, null);
+                    res.resolveIDRef(idref, null);
                 }
             }
         }
index 5da015d8918c92efc9cd55e01134d3ad0ef3486a..845cff8bdbea10ff41432d6d7cfd30c6ec3a33d5 100644 (file)
@@ -62,8 +62,8 @@ public class LinkResolver implements Resolvable, Serializable {
      * Resolve by adding an internal link.
      */
     public void resolveIDRef(String id, List pages) {
-        resolved = true;
         if (idRef.equals(id) && pages != null) {
+            resolved = true;
             PageViewport page = (PageViewport)pages.get(0);
             area.addTrait(Trait.INTERNAL_LINK, page.getKey());
         }
index def072885ea64101aaf991fe18a3a189c5b48975..97c889ce09f4212cb5b22b644b297ae64c460a5a 100644 (file)
@@ -45,11 +45,15 @@ public interface Resolvable {
     String[] getIDs();
 
     /**
-     * This method provides the opportunity for a Resolvable object
-     * to resolve one of its unresolved idrefs with the actual set of
-     * PageViewports containing the target ID.
+     * This method allows the Resolvable object to resolve one of
+     * its unresolved idrefs with the actual set of PageViewports
+     * containing the target ID.  The Resolvable object initially
+     * 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.
      *
-     * @param id an ID possibly matching one of the Resolvable object's
+     * @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
index 05bf28c7e888020daaaa06d7de04a86586631e34..dcced2bb7c90e984455b13b25a03c011cf6b9f95 100644 (file)
@@ -60,16 +60,13 @@ public class UnresolvedPageNumber extends TextArea implements Resolvable {
      *
      * @param id the id associated with the pages parameter
      * @param pages the list of PageViewports associated with this ID
-     * @todo determine why the ID passed in will (always?) equal the pageIDRef,
-     *      explain in comments above
      */
     public void resolveIDRef(String id, List pages) {
-        resolved = true;
         if (pages != null) {
+            resolved = true;
             PageViewport page = (PageViewport)pages.get(0);
             String str = page.getPageNumber();
             text = str;
-
             /**@todo Update IPD ??? */
         }
     }