Re: [PATCH] basik-link not working in special situations (redesign)

2002-11-03 Thread Keiron Liddle
On Sat, 2002-11-02 at 21:31, Rainer Garus wrote:
> A link from page A to page B is only rendered in the pdf renderer correctly if page 
>B is prepared by the renderer before page A is rendered. In the following case page A 
>is rendered before page B is prepared (PN (X) is the pagenumber of page X):
> 
> (i)  PN (A) < PN (B)
> (ii) if there is a link from page A to page C then PN (C) <= PN (B)
> 
> Rainer Garus

Hi Rainer,

Thanks for the patch and bug report.

It seems that I have committed a patch to fix that problem before
reading the email.
You discovered the bug and cause before I did.
The patch also needed to handle the case where the renderer doesn't
support out of order rendering, in which case the forward link would not
work as the renderer has no way of knowing about the future page (this
will probably never be the case in practice).

Thanks,
Keiron.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




[PATCH] basik-link not working in special situations (redesign)

2002-11-02 Thread Rainer Garus
A link from page A to page B is only rendered in the pdf renderer correctly if page B 
is prepared by the renderer before page A is rendered. In the following case page A is 
rendered before page B is prepared (PN (X) is the pagenumber of page X):

(i)  PN (A) < PN (B)
(ii) if there is a link from page A to page C then PN (C) <= PN (B)

Rainer Garus
diff -u -r xml-fop/src/org/apache/fop/area/AreaTree.java 
xml-fop-new/src/org/apache/fop/area/AreaTree.java
--- xml-fop/src/org/apache/fop/area/AreaTree.java   Mon Sep 16 12:28:22 2002
+++ xml-fop-new/src/org/apache/fop/area/AreaTree.java   Fri Nov  1 22:26:22 2002
@@ -396,32 +396,19 @@
 public void addPage(PageViewport page) {
 super.addPage(page);
 
-// check prepared pages
-boolean cont = checkPreparedPages();
+renderer.preparePage(page);
+prepared.add(page);
 
-// if page finished
-if (cont && page.isResolved()) {
-try {
-renderer.renderPage(page);
-} catch (Exception e) {
-// use error handler to handle this FOP or IO Exception
-}
-page.clear();
-} else {
-preparePage(page);
-}
+renderPreparedPages();
 
 renderExtensions(pendingExt);
 pendingExt.clear();
 }
 
 /**
- * Check prepared pages
- * @return true if the current page should be rendered
- * false if the renderer doesn't support out of order
- * rendering and there are pending pages
+ * Render resolved pending pages
  */
-protected boolean checkPreparedPages() {
+protected void renderPreparedPages() {
 for (Iterator iter = prepared.iterator(); iter.hasNext();) {
 PageViewport p = (PageViewport)iter.next();
 if (p.isResolved()) {
@@ -439,21 +426,8 @@
 }
 }
 }
-return renderer.supportsOutOfOrder() || prepared.isEmpty();
 }
 
-/**
- * Prepare a page.
- * An unresolved page can be prepared if the renderer supports
- * it and the page will be rendered later.
- * @param page the page to prepare
- */
-protected void preparePage(PageViewport page) {
-if (renderer.supportsOutOfOrder()) {
-renderer.preparePage(page);
-}
-prepared.add(page);
-}
 
 /**
  * Add an extension to this model.
@@ -490,7 +464,7 @@
  */
 public void endDocument() {
 // render any pages that had unresolved ids
-checkPreparedPages();
+renderPreparedPages();
 renderExtensions(endDocExt);
 }
 }
diff -u -r xml-fop/src/org/apache/fop/render/AbstractRenderer.java 
xml-fop-new/src/org/apache/fop/render/AbstractRenderer.java
--- xml-fop/src/org/apache/fop/render/AbstractRenderer.java Thu Sep 19 00:26:00 
2002
+++ xml-fop-new/src/org/apache/fop/render/AbstractRenderer.java Fri Nov  1 22:26:22 
+2002
@@ -122,8 +122,7 @@
 public void renderExtension(TreeExt ext) { }
 
 /**
- * Prepare a page for rendering. This is called if the renderer supports
- * out of order rendering. The renderer should prepare the page so that a
+ * Prepare a page for rendering. The renderer should prepare the page so that a
  * page further on in the set of pages can be rendered. The body of the
  * page should not be rendered. The page will be rendered at a later time
  * by the call to render page.
diff -u -r xml-fop/src/org/apache/fop/render/Renderer.java 
xml-fop-new/src/org/apache/fop/render/Renderer.java
--- xml-fop/src/org/apache/fop/render/Renderer.java Mon Sep  9 18:25:37 2002
+++ xml-fop-new/src/org/apache/fop/render/Renderer.java Fri Nov  1 22:26:22 2002
@@ -113,8 +113,7 @@
 void renderExtension(TreeExt ext);
 
 /**
- * This is called if the renderer supports out of order rendering. The
- * renderer should prepare the page so that a page further on in the set of
+ * The renderer should prepare the page so that a page further on in the set of
  * pages can be rendered. The body of the page should not be rendered. The
  * page will be rendered at a later time by the call to {@link
  * #renderPage(PageViewport)}.


http://www.w3.org/1999/XSL/Format";>


  

  



  

a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 
a, page 

a

  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]