You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Vincent Hennebert <vi...@anyware-tech.com> on 2007/08/07 18:09:42 UTC

reset and resetPosition Methods on Layout Managers

Hi all,

There’s something quite strange in the layout code that I suspect comes 
from the pre-Knuth era.

AbstractLM defines a reset method that among other things calls 
resetPosition on children LMs. If you search for references to this 
reset method, you find out that it is only called within resetPosition 
methods. But those resetPosition methods are themselves only called by 
the reset method!

Unless I missed something those methods aren’t useful anymore and could 
be removed. Anyone against? It’s not like the layout managers needed to 
be cleaned up...

Vincent


Re: reset and resetPosition Methods on Layout Managers

Posted by Chris Bowditch <bo...@hotmail.com>.
Vincent Hennebert wrote:

> Hi all,
> 
> There’s something quite strange in the layout code that I suspect comes 
> from the pre-Knuth era.

Yes I think you are right.

> 
> AbstractLM defines a reset method that among other things calls 
> resetPosition on children LMs. If you search for references to this 
> reset method, you find out that it is only called within resetPosition 
> methods. But those resetPosition methods are themselves only called by 
> the reset method!
> 
> Unless I missed something those methods aren’t useful anymore and could 
> be removed. Anyone against? It’s not like the layout managers needed to 
> be cleaned up...

IIRC, those methods are intended as a means of allowing the IPD to 
change. Currently the LMs dont allow the IPD to change mid page 
sequence, but if the reset methods are properly implemented then if a 
change in IPD is detected then reset would be called on the 
PageSequenceLM. Of course, I don't believe the reset methods are 
properly implemented for the Knuth model, so you could remove them now 
and start from scratch when implementing support for changing IPD.

Chris



Re: reset and resetPosition Methods on Layout Managers

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
I finally removed them, rev. 604171.

Vincent


Simon Pepping wrote:
> On Wed, Aug 08, 2007 at 12:00:08PM +0100, Chris Bowditch wrote:
>> Vincent Hennebert wrote:
>>
>>> Hi all,
>>> There???s something quite strange in the layout code that I suspect comes 
>>> from the pre-Knuth era.
>> Yes I think you are right.
>>
>>> AbstractLM defines a reset method that among other things calls 
>>> resetPosition on children LMs. If you search for references to this reset 
>>> method, you find out that it is only called within resetPosition methods. 
>>> But those resetPosition methods are themselves only called by the reset 
>>> method!
>>> Unless I missed something those methods aren???t useful anymore and could 
>>> be removed. Anyone against? It???s not like the layout managers needed to 
>>> be cleaned up...
>> IIRC, those methods are intended as a means of allowing the IPD to change. 
>> Currently the LMs dont allow the IPD to change mid page sequence, but if 
>> the reset methods are properly implemented then if a change in IPD is 
>> detected then reset would be called on the PageSequenceLM. Of course, I 
>> don't believe the reset methods are properly implemented for the Knuth 
>> model, so you could remove them now and start from scratch when 
>> implementing support for changing IPD.
> 
> In the best-fit method the code always went one node too far, and then
> reset itself to the best node using these reset methods. Indeed, they
> do not seem useful anymore.
> 
> Simon
> 

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Re: reset and resetPosition Methods on Layout Managers

Posted by Simon Pepping <si...@oranjetip.home.leverkruid.eu>.
On Wed, Aug 08, 2007 at 12:00:08PM +0100, Chris Bowditch wrote:
> Vincent Hennebert wrote:
>
>> Hi all,
>> There???s something quite strange in the layout code that I suspect comes 
>> from the pre-Knuth era.
>
> Yes I think you are right.
>
>> AbstractLM defines a reset method that among other things calls 
>> resetPosition on children LMs. If you search for references to this reset 
>> method, you find out that it is only called within resetPosition methods. 
>> But those resetPosition methods are themselves only called by the reset 
>> method!
>> Unless I missed something those methods aren???t useful anymore and could 
>> be removed. Anyone against? It???s not like the layout managers needed to 
>> be cleaned up...
>
> IIRC, those methods are intended as a means of allowing the IPD to change. 
> Currently the LMs dont allow the IPD to change mid page sequence, but if 
> the reset methods are properly implemented then if a change in IPD is 
> detected then reset would be called on the PageSequenceLM. Of course, I 
> don't believe the reset methods are properly implemented for the Knuth 
> model, so you could remove them now and start from scratch when 
> implementing support for changing IPD.

In the best-fit method the code always went one node too far, and then
reset itself to the best node using these reset methods. Indeed, they
do not seem useful anymore.

Simon

-- 
Simon Pepping
home page: http://www.leverkruid.eu