Re: svn commit: r674484 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java
As it is, I have a class in the Temp_AreaTreeRedesign branch that extends AbstractXMLRenderer. I thought it useful to provide the class in trunk for anyone else who may wish to create their own XML based renderer for whatever purposes. However, IMO you can never have enough abstract classes, helps to hide/break up some of the complexity and remove some unnecessary code dependencies and give yourself options to extend the class. Adrian. Andreas Delmelle wrote: On Jul 7, 2008, at 15:39, Jeremias Maerki wrote: On 07.07.2008 15:28:26 acumiskey wrote: Author: acumiskey Date: Mon Jul 7 06:28:26 2008 New Revision: 674484 URL: http://svn.apache.org/viewvc?rev=674484view=rev Log: Added new AbstractXMLRenderer base class. Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/AbstractXMLRenderer.java (with props) What for? Just curious. Me too... Just abstracting to abstract seems to make little sense. :-/ Cheers Andreas
Re: DO NOT REPLY [Bug 40798] page-position=last doesn' t work for 1 page document
[EMAIL PROTECTED] wrote: https://issues.apache.org/bugzilla/show_bug.cgi?id=40798 ... I haven't gone back to the spec or the code, but assuming 1) that an only page is also both first and last, and 2) that isOnlyPage tells the truth about the page being tested, the problem seems to be with the if (isOnlyPage) {...} test. Shouldn't it be if (isOnlyPage) { if ( ! ( pagePosition == EN_ONLY || pagePosition == EN_FIRST || pagePosition == EN_LAST ) ) { return false; } --- Comment #7 from Dave Gerdt [EMAIL PROTECTED] 2008-07-08 13:59:23 PST --- Looking for a solution to this first page/last page problem I found a potential solution written by Ken Holman [1]. I assumed because he used it (and he seems to know a little about the subject ;) ) I had found my solution. (I hadn't discovered this bug yet...) However, the solution he provides doesn't work with FOP because as Simon points out above ConditionalPageMasterReference.isValid(isOddPage, isFirstPage, isLastPage,isBlankPage) ... says explicitly that a conditional pagemaster reference with page-position=last is not valid for a first page. Looking at the spec [2][3] I can't see any reason why that should be the case, though I'm no expert in the spec, to be sure. Can one of the devs comment on this? As a fix, I reordered the if statement in ConditionalPageMasterReference.isValid so that the block for isLastPage comes before the block for isFirstPage and removed 'return false' when pagePosition == EN_FIRST in the isLastPage block (see code below). This appears to fix the problem, at least for Ken's test file. Anyone see where this might blow up in my face somewhere else? I ran the test suite and everything seemed to come out fine. The test case is attached. [1] http://services.renderx.com/lists/xep-support/3856.html [2] http://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo_repeatable-page-master-alternatives [3] http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#page-position Reordered 'if' from ConditionalPageMasterReference.isValid: == if (isOnlyPage) { if (pagePosition != EN_ONLY) { return false; } } else if (isLastPage) { if (pagePosition == EN_REST) { return false; } else if (pagePosition == EN_FIRST) { //return false; } } else if (isFirstPage) { if (pagePosition == EN_REST) { return false; } else if (pagePosition == EN_LAST) { return false; } } else { if (pagePosition == EN_FIRST) { return false; } else if (pagePosition == EN_LAST) { return false; } } -- Peter B. West http://cv.pbw.id.au/ Folio http://defoe.sourceforge.net/folio/
Re: DO NOT REPLY [Bug 40798] page-position=last doesn' t work for 1 page document
I would agree with premise 1, but 2 is incorrect I believe. I don't have my proper development environment in front of me at the moment, but I believe you can trace the calls used to reach isValid back to PageProvider.cacheNextPage where you will find code like: SimplePageMaster spm = pageSeq.getNextSimplePageMaster( index, (startPageOfPageSequence == index), isLastPage, false, isBlank); You can see that isOnlyPage is simply passed as a false. I believe this is just a forward thinking move on the part of the developer preparing for XSL 1.1's page-position=only. This attribute is not supported in XSL 1.0. I think they just went ahead and built the framework to support it, but it is not actually implemented yet. Peter B. West [EMAIL PROTECTED] 07/08/08 6:23 PM [EMAIL PROTECTED] wrote: https://issues.apache.org/bugzilla/show_bug.cgi?id=40798 ... I haven't gone back to the spec or the code, but assuming 1) that an only page is also both first and last, and 2) that isOnlyPage tells the truth about the page being tested, the problem seems to be with the if (isOnlyPage) {...} test. Shouldn't it be if (isOnlyPage) { if ( ! ( pagePosition == EN_ONLY || pagePosition == EN_FIRST || pagePosition == EN_LAST ) ) { return false; } --- Comment #7 from Dave Gerdt [EMAIL PROTECTED] 2008-07-08 13:59:23 PST --- Looking for a solution to this first page/last page problem I found a potential solution written by Ken Holman [1]. I assumed because he used it (and he seems to know a little about the subject ;) ) I had found my solution. (I hadn't discovered this bug yet...) However, the solution he provides doesn't work with FOP because as Simon points out above ConditionalPageMasterReference.isValid(isOddPage, isFirstPage, isLastPage,isBlankPage) ... says explicitly that a conditional pagemaster reference with page-position=last is not valid for a first page. Looking at the spec [2][3] I can't see any reason why that should be the case, though I'm no expert in the spec, to be sure. Can one of the devs comment on this? As a fix, I reordered the if statement in ConditionalPageMasterReference.isValid so that the block for isLastPage comes before the block for isFirstPage and removed 'return false' when pagePosition == EN_FIRST in the isLastPage block (see code below). This appears to fix the problem, at least for Ken's test file. Anyone see where this might blow up in my face somewhere else? I ran the test suite and everything seemed to come out fine. The test case is attached. [1] http://services.renderx.com/lists/xep-support/3856.html [2] http://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo_repeatable-page-master-alternatives [3] http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#page-position Reordered 'if' from ConditionalPageMasterReference.isValid: == if (isOnlyPage) { if (pagePosition != EN_ONLY) { return false; } } else if (isLastPage) { if (pagePosition == EN_REST) { return false; } else if (pagePosition == EN_FIRST) { //return false; } } else if (isFirstPage) { if (pagePosition == EN_REST) { return false; } else if (pagePosition == EN_LAST) { return false; } } else { if (pagePosition == EN_FIRST) { return false; } else if (pagePosition == EN_LAST) { return false; } } -- Peter B. West http://cv.pbw.id.au/ Folio http://defoe.sourceforge.net/folio/
Re: DO NOT REPLY [Bug 40798] page-position=last doesn' t work for 1 page document
Ok. In that case, isOnlyPage is equivalent to (startPageOfPageSequence == index) isLastPage and then either replace the 'false' in the getSimplePageMaster call with that expression, or replace if (isOnlyPage) with if (isFirstPage isLastPage) Will either of these work with the rest of the code? David Gerdt wrote: I would agree with premise 1, but 2 is incorrect I believe. I don't have my proper development environment in front of me at the moment, but I believe you can trace the calls used to reach isValid back to PageProvider.cacheNextPage where you will find code like: SimplePageMaster spm = pageSeq.getNextSimplePageMaster( index, (startPageOfPageSequence == index), isLastPage, false, isBlank); You can see that isOnlyPage is simply passed as a false. I believe this is just a forward thinking move on the part of the developer preparing for XSL 1.1's page-position=only. This attribute is not supported in XSL 1.0. I think they just went ahead and built the framework to support it, but it is not actually implemented yet. Peter B. West [EMAIL PROTECTED] 07/08/08 6:23 PM [EMAIL PROTECTED] wrote: https://issues.apache.org/bugzilla/show_bug.cgi?id=40798 ... I haven't gone back to the spec or the code, but assuming 1) that an only page is also both first and last, and 2) that isOnlyPage tells the truth about the page being tested, the problem seems to be with the if (isOnlyPage) {...} test. Shouldn't it be if (isOnlyPage) { if ( ! ( pagePosition == EN_ONLY || pagePosition == EN_FIRST || pagePosition == EN_LAST ) ) { return false; } --- Comment #7 from Dave Gerdt [EMAIL PROTECTED] 2008-07-08 13:59:23 PST --- Looking for a solution to this first page/last page problem I found a potential solution written by Ken Holman [1]. I assumed because he used it (and he seems to know a little about the subject ;) ) I had found my solution. (I hadn't discovered this bug yet...) However, the solution he provides doesn't work with FOP because as Simon points out above ConditionalPageMasterReference.isValid(isOddPage, isFirstPage, isLastPage,isBlankPage) ... says explicitly that a conditional pagemaster reference with page-position=last is not valid for a first page. Looking at the spec [2][3] I can't see any reason why that should be the case, though I'm no expert in the spec, to be sure. Can one of the devs comment on this? As a fix, I reordered the if statement in ConditionalPageMasterReference.isValid so that the block for isLastPage comes before the block for isFirstPage and removed 'return false' when pagePosition == EN_FIRST in the isLastPage block (see code below). This appears to fix the problem, at least for Ken's test file. Anyone see where this might blow up in my face somewhere else? I ran the test suite and everything seemed to come out fine. The test case is attached. [1] http://services.renderx.com/lists/xep-support/3856.html [2] http://www.w3.org/TR/2001/REC-xsl-20011015/slice6.html#fo_repeatable-page-master-alternatives [3] http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#page-position Reordered 'if' from ConditionalPageMasterReference.isValid: == if (isOnlyPage) { if (pagePosition != EN_ONLY) { return false; } } else if (isLastPage) { if (pagePosition == EN_REST) { return false; } else if (pagePosition == EN_FIRST) { //return false; } } else if (isFirstPage) { if (pagePosition == EN_REST) { return false; } else if (pagePosition == EN_LAST) { return false; } } else { if (pagePosition == EN_FIRST) { return false; } else if (pagePosition == EN_LAST) { return false; } }