From: Glen Mazza Date: Thu, 2 Dec 2004 01:36:09 +0000 (+0000) Subject: More commenting, slightly clearer method names. X-Git-Tag: Root_Temp_KnuthStylePageBreaking~325 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=67d4426da31f4c7f6344d630388c3fa7095ad6ce;p=xmlgraphics-fop.git More commenting, slightly clearer method names. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198182 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/AreaTreeHandler.java b/src/java/org/apache/fop/area/AreaTreeHandler.java index aef0179a3..5cbeeca0f 100644 --- a/src/java/org/apache/fop/area/AreaTreeHandler.java +++ b/src/java/org/apache/fop/area/AreaTreeHandler.java @@ -139,7 +139,7 @@ public class AreaTreeHandler extends FOEventHandler { if (todo != null) { for (Iterator iter = todo.iterator(); iter.hasNext();) { Resolvable res = (Resolvable) iter.next(); - res.resolve(id, pvList); + res.resolveIDRef(id, pvList); } unresolvedIDRefs.remove(id); } @@ -201,7 +201,7 @@ public class AreaTreeHandler extends FOEventHandler { for (Iterator resIter = list.iterator(); resIter.hasNext();) { Resolvable res = (Resolvable)resIter.next(); if (!res.isResolved()) { - res.resolve(id, null); + res.resolveIDRef(id, null); } } } @@ -294,7 +294,7 @@ public class AreaTreeHandler extends FOEventHandler { String[] ids = res.getIDs(); for (int count = 0; count < ids.length; count++) { if (idLocations.containsKey(ids[count])) { - res.resolve(ids[count], (List) idLocations.get(ids[count])); + res.resolveIDRef(ids[count], (List) idLocations.get(ids[count])); } else { addUnresolvedIDRef(ids[count], res); } diff --git a/src/java/org/apache/fop/area/BookmarkData.java b/src/java/org/apache/fop/area/BookmarkData.java index 1f301e400..d0a498327 100644 --- a/src/java/org/apache/fop/area/BookmarkData.java +++ b/src/java/org/apache/fop/area/BookmarkData.java @@ -161,13 +161,13 @@ public class BookmarkData extends OffDocumentItem implements Resolvable { * PageViewport objects * @param pages the list of PageViewport objects the ID resolves to */ - public void resolve(String id, List pages) { + public void resolveIDRef(String id, List pages) { // this method is buggy if (!id.equals(idRef)) { BookmarkData bd = (BookmarkData)idRefs.get(id); idRefs.remove(id); if (bd != null) { - bd.resolve(id, pages); + bd.resolveIDRef(id, pages); if (bd.isResolved()) { checkFinish(); } diff --git a/src/java/org/apache/fop/area/LinkResolver.java b/src/java/org/apache/fop/area/LinkResolver.java index 05e9388f2..5da015d89 100644 --- a/src/java/org/apache/fop/area/LinkResolver.java +++ b/src/java/org/apache/fop/area/LinkResolver.java @@ -61,7 +61,7 @@ public class LinkResolver implements Resolvable, Serializable { /** * Resolve by adding an internal link. */ - public void resolve(String id, List pages) { + public void resolveIDRef(String id, List pages) { resolved = true; if (idRef.equals(id) && pages != null) { PageViewport page = (PageViewport)pages.get(0); diff --git a/src/java/org/apache/fop/area/PageViewport.java b/src/java/org/apache/fop/area/PageViewport.java index a0bbe6a58..a0c87a5c0 100644 --- a/src/java/org/apache/fop/area/PageViewport.java +++ b/src/java/org/apache/fop/area/PageViewport.java @@ -160,13 +160,9 @@ public class PageViewport implements Resolvable, Cloneable { } /** - * This resolves reference with a list of pages. - * The pages (PageViewport) contain the rectangle of the area. - * @param id the id to resolve - * @param pages the list of pages with the id area - * may be null if not found + * @see org.apache.fop.area.Resolveable#resolveIDRef(String, List) */ - public void resolve(String id, List pages) { + public void resolveIDRef(String id, List pages) { if (page == null) { if (pendingResolved == null) { pendingResolved = new HashMap(); @@ -178,7 +174,7 @@ public class PageViewport implements Resolvable, Cloneable { if (todo != null) { for (int count = 0; count < todo.size(); count++) { Resolvable res = (Resolvable)todo.get(count); - res.resolve(id, pages); + res.resolveIDRef(id, pages); } } } @@ -337,7 +333,7 @@ public class PageViewport implements Resolvable, Cloneable { for (Iterator iter = pendingResolved.keySet().iterator(); iter.hasNext();) { String id = (String) iter.next(); - resolve(id, (List)pendingResolved.get(id)); + resolveIDRef(id, (List)pendingResolved.get(id)); } pendingResolved = null; } diff --git a/src/java/org/apache/fop/area/Resolvable.java b/src/java/org/apache/fop/area/Resolvable.java index 61de613a0..def072885 100644 --- a/src/java/org/apache/fop/area/Resolvable.java +++ b/src/java/org/apache/fop/area/Resolvable.java @@ -45,11 +45,14 @@ public interface Resolvable { String[] getIDs(); /** - * This resolves reference with a list of pages. - * The pages (PageViewport) contain the rectangle of the area. - * @param id the id to resolve - * @param pages the list of pages with the id area - * may be null if not found + * 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. + * + * @param id an ID possibly 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 resolve(String id, List pages); + 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 3b56ae281..05bf28c7e 100644 --- a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java +++ b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java @@ -30,7 +30,7 @@ import java.util.List; */ public class UnresolvedPageNumber extends TextArea implements Resolvable { private boolean resolved = false; - private String pageRefId; + private String pageIDRef; /** * Create a new unresolvable page number. @@ -38,7 +38,7 @@ public class UnresolvedPageNumber extends TextArea implements Resolvable { * @param id the id reference for resolving this */ public UnresolvedPageNumber(String id) { - pageRefId = id; + pageIDRef = id; text = "?"; } @@ -48,20 +48,22 @@ public class UnresolvedPageNumber extends TextArea implements Resolvable { * @return the id reference for this unresolved page number */ public String[] getIDs() { - return new String[] {pageRefId}; + return new String[] {pageIDRef}; } /** - * Resolve this page number reference. - * This resolves the reference by getting the page number + * Resolve the page number idref + * This resolves the idref for this object by getting the page number * string from the first page in the list of pages that apply - * for the id reference. The word string is then set to the - * page number string. + * for this ID. The page number text is then set to the String value + * of the page number. * - * @param id the id reference being resolved - * @param pages the list of pages for the id reference + * @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 resolve(String id, List pages) { + public void resolveIDRef(String id, List pages) { resolved = true; if (pages != null) { PageViewport page = (PageViewport)pages.get(0);