Browse Source

More commenting, slightly clearer method names.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198182 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
Glen Mazza 19 years ago
parent
commit
5b100d51e1

+ 3
- 3
src/java/org/apache/fop/area/AreaTreeHandler.java View File

@@ -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);
}

+ 2
- 2
src/java/org/apache/fop/area/BookmarkData.java View File

@@ -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();
}

+ 1
- 1
src/java/org/apache/fop/area/LinkResolver.java View File

@@ -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);

+ 4
- 8
src/java/org/apache/fop/area/PageViewport.java View File

@@ -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;
}

+ 9
- 6
src/java/org/apache/fop/area/Resolvable.java View File

@@ -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);
}

+ 12
- 10
src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java View File

@@ -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);

Loading…
Cancel
Save