From 58b03f1aa52fe8b8b34d044dfab8934e6a4a24af Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Thu, 2 Dec 2004 01:59:40 +0000 Subject: PR: 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 | 16 ++++++++++------ src/java/org/apache/fop/area/LinkResolver.java | 2 +- src/java/org/apache/fop/area/Resolvable.java | 12 ++++++++---- .../org/apache/fop/area/inline/UnresolvedPageNumber.java | 5 +---- 4 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src/java/org/apache/fop') diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index 5cbeeca0f..36f7fe8a1 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -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); } } } diff --git a/src/java/org/apache/fop/area/LinkResolver.java b/src/java/org/apache/fop/area/LinkResolver.java index 5da015d89..845cff8bd 100644 --- a/src/java/org/apache/fop/area/LinkResolver.java +++ b/src/java/org/apache/fop/area/LinkResolver.java @@ -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()); } diff --git a/src/java/org/apache/fop/area/Resolvable.java b/src/java/org/apache/fop/area/Resolvable.java index def072885..97c889ce0 100644 --- a/src/java/org/apache/fop/area/Resolvable.java +++ b/src/java/org/apache/fop/area/Resolvable.java @@ -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 diff --git a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java index 05bf28c7e..dcced2bb7 100644 --- a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java +++ b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java @@ -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 ??? */ } } -- cgit v1.2.3