aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-12-02 01:59:40 +0000
committerGlen Mazza <gmazza@apache.org>2004-12-02 01:59:40 +0000
commit58b03f1aa52fe8b8b34d044dfab8934e6a4a24af (patch)
treea70c2578067cdd0b1762ba25f54c5b22522c2b2b
parent67d4426da31f4c7f6344d630388c3fa7095ad6ce (diff)
downloadxmlgraphics-fop-58b03f1aa52fe8b8b34d044dfab8934e6a4a24af.tar.gz
xmlgraphics-fop-58b03f1aa52fe8b8b34d044dfab8934e6a4a24af.zip
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
-rw-r--r--src/java/org/apache/fop/area/AreaTreeHandler.java16
-rw-r--r--src/java/org/apache/fop/area/LinkResolver.java2
-rw-r--r--src/java/org/apache/fop/area/Resolvable.java12
-rw-r--r--src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java5
4 files changed, 20 insertions, 15 deletions
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 ??? */
}
}