You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2006/04/24 20:39:06 UTC
svn commit: r396640 - in /xmlgraphics/fop/trunk: ./
src/java/org/apache/fop/area/ src/java/org/apache/fop/layoutmgr/
src/java/org/apache/fop/render/xml/
Author: jeremias
Date: Mon Apr 24 11:39:05 2006
New Revision: 396640
URL: http://svn.apache.org/viewcvs?rev=396640&view=rev
Log:
Bugfix: basic-links with internal destinations in documents with multiple page-sequences sometimes pointed at the wrong page.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeHandler.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/area/PageViewport.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
xmlgraphics/fop/trunk/status.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeHandler.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeHandler.java?rev=396640&r1=396639&r2=396640&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeHandler.java Mon Apr 24 11:39:05 2006
@@ -66,6 +66,8 @@
*/
public class AreaTreeHandler extends FOEventHandler {
+ private static Log log = LogFactory.getLog(AreaTreeHandler.class);
+
// show statistics after document complete?
private boolean outputStatistics;
@@ -104,8 +106,8 @@
private PageSequenceLayoutManager prevPageSeqLM;
- private static Log log = LogFactory.getLog(AreaTreeHandler.class);
-
+ private int idGen = 0;
+
/**
* Constructor.
* @param userAgent FOUserAgent object for process
@@ -460,5 +462,15 @@
model.handleOffDocumentItem(odi);
}
}
+
+ /**
+ * Generates and returns a unique key for a page viewport.
+ * @return the generated key.
+ */
+ public String generatePageViewportKey() {
+ this.idGen++;
+ return "P" + this.idGen;
+ }
+
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java?rev=396640&r1=396639&r2=396640&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/AreaTreeParser.java Mon Apr 24 11:39:05 2006
@@ -360,12 +360,14 @@
}
Rectangle2D viewArea = parseRect(attributes.getValue("bounds"));
int pageNumber = getAttributeAsInteger(attributes, "nr", -1);
+ String key = attributes.getValue("key");
String pageNumberString = attributes.getValue("formatted-nr");
String pageMaster = attributes.getValue("simple-page-master-name");
boolean blank = getAttributeAsBoolean(attributes, "blank", false);
currentPageViewport = new PageViewport(viewArea,
pageNumber, pageNumberString,
pageMaster, blank);
+ currentPageViewport.setKey(key);
}
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/PageViewport.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/PageViewport.java?rev=396640&r1=396639&r2=396640&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/PageViewport.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/PageViewport.java Mon Apr 24 11:39:05 2006
@@ -48,6 +48,13 @@
private Page page;
private Rectangle2D viewArea;
private String simplePageMasterName;
+
+ /**
+ * Unique key to identify the page. pageNumberString and pageIndex are both no option
+ * for this.
+ */
+ private String pageKey;
+
private int pageNumber = -1;
private String pageNumberString = null;
private int pageIndex = -1; //-1 = undetermined
@@ -206,6 +213,14 @@
}
/**
+ * Sets the unique key for this PageViewport that will be used to reference this page.
+ * @param key the unique key.
+ */
+ public void setKey(String key) {
+ this.pageKey = key;
+ }
+
+ /**
* Get the key for this page viewport.
* This is used so that a serializable key can be used to
* lookup the page or some other reference.
@@ -213,7 +228,10 @@
* @return a unique page viewport key for this area tree
*/
public String getKey() {
- return toString();
+ if (this.pageKey == null) {
+ throw new IllegalStateException("No page key set on the PageViewport: " + toString());
+ }
+ return this.pageKey;
}
/**
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java?rev=396640&r1=396639&r2=396640&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Mon Apr 24 11:39:05 2006
@@ -1042,6 +1042,8 @@
+ "does not support this.");
}
Page page = new Page(spm, index, pageNumberString, isBlank);
+ //Set unique key obtained from the AreaTreeHandler
+ page.getPageViewport().setKey(areaTreeHandler.generatePageViewportKey());
cachedPages.add(page);
return page;
} catch (FOPException e) {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=396640&r1=396639&r2=396640&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java Mon Apr 24 11:39:05 2006
@@ -462,6 +462,7 @@
public void renderPage(PageViewport page) throws IOException, FOPException {
atts.clear();
addAttribute("bounds", page.getViewArea());
+ addAttribute("key", page.getKey());
addAttribute("nr", page.getPageNumber());
addAttribute("formatted-nr", page.getPageNumberString());
addAttribute("simple-page-master-name", page.getSimplePageMasterName());
Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/status.xml?rev=396640&r1=396639&r2=396640&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Mon Apr 24 11:39:05 2006
@@ -28,6 +28,10 @@
<changes>
<release version="FOP Trunk">
<action context="Code" dev="JM" type="fix">
+ Bugfix: basic-links with internal destinations in documents with multiple
+ page-sequences sometimes pointed at the wrong page.
+ </action>
+ <action context="Code" dev="JM" type="fix">
Bugfix: Fixed ClassCastException when retrieve-marker is used as a direct child
if static-content in which case leading and trailing white space is not properly
removed.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org