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 Andreas L Delmelle <a_...@pandora.be> on 2005/08/26 20:07:09 UTC
Collapsing borders: FOTree stage -- progress update
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
First of all: many, many thanks to Finn for taking care of the default
border-precedence values!
Secondly: sorry for the rather long post.
This message is solely intended to keep you guys (and other interested
parties) informed about my progress in this matter, and perhaps, more
importantly, to give other devs the opportunity to yell 'STOP!' if
they see something that could be considered a Very Bad Thing (as Java
programming is still a leisure activity for me, it's all based on
theory rather than hands-on experience).
Ok, here goes:
* The first step I took was moving much of the logic that is currently
in CollapsingBorderModelEyeCatching (in the layout package) to
CommonBorderPaddingBackground.
More precisely: I created a subclass of the BorderInfo inner class.
This subclass, TableBorderInfo, provides two versions of a collapse()
method: one for eye-catching collapsing, and an overloaded one that
allows for passing in precedence values. Their signatures are:
public void collapse( BorderInfo, boolean );
public void collapse( BorderInfo, boolean, int, int );
The idea here is to make this functionality available to the FOTree as
well as Layout without moving essentially layout-related code into the
FOTree (or vice versa). I'm not absolutely sure that subclassing
BorderInfo is the appropriate approach, since the collapse() methods
could just as easily be added to BorderInfo itself. Personally, I did
this to make the distinction, as those methods do not apply to borders
on non-table FOs (but in the end, the other FOs simply won't call this
method, so there would be little harm in that).
In any case, the ultimate goal is to have layout only access the
collapse() methods for the situations where the FOTree lacks the
necessary context. The most obvious ones: breaks, spans and multiple
bodies.
But for a simple table with one body that has no row- or
column-spanning cells and that is small enough to fit on one page,
layout would only read the border-info from the FOs appropriate for the
given situation. The layout classes will still need to decide which FO
is the appropriate one, but once that decision has been made, all they
need to do is read the border-info and use the width (no additional
comparison/collapsing needed).
The collapse-method does not need to concern itself with which sides
the borders are on, as this depends on the types of FO the borders
belong to. (For example: when comparing header and body, the header's
after-border needs to be compared to the body's before-border, but when
comparing header and table, the pair is before/before) All it does is
compare its BorderInfo instance to another that is being passed in, and
modify the style/width/color values if and where necessary. The 'side'
issue should be dealt with at another level.
The primary function of the boolean parameter is to allow/prohibit the
property values to be replaced by those of the BorderInfo that is being
passed in as a parameter. If the parameter BorderInfo wins, it simply
keeps its own set of values, and depending on this flag, forces these
values onto the base BorderInfo for which collapse() was called. If the
parameter BorderInfo loses, its values are *always* discarded and
replaced. The boolean flag comes in handy, for example when
Table.omitHeaderAtBreak() is true. When resolving border-conflicts
between header and body, the body's border cannot be discarded/replaced
since it could still be relevant for all but the first page (or column)
that is spanned by the table.
This first step is as good as complete in my local sandbox.
[As a side-note: I'm also thinking of providing two getCollapsed()
methods that return the winning BorderInfo instance instead of actually
replacing one with the other. This might come in handy when the table
has more than one body, and may also prove useful for the
layout-classes, since it's not always desirable to actually change the
BorderInfo.]
* I added a class named TableBorderConflictResolver to the fo.flow
package. One of these will be instantiated for/enclosed by each Table
instance that doesn't have separated borders. This class is currently
under heavy construction, so I can't offer a lot of details yet.
The main idea here is to provide a set of overloaded versions of a
resolve() method that resolves the border-conflicts between the
enclosing Table instance and its descendants (one parameter) or between
two of the Table's descendants (two parameters). These methods are the
ones that will sort out the 'sides' issue. They will call
TableBorderInfo.collapse() for each pair of applicable sides
(start/start, end/end, before/before, after/before etc.)
* Evidently, Table then needs to allow its descendants to use the
TableBorderConflictResolver. I don't think this access needs to be
public, as the layout-classes have access to the FOs BorderInfo, so
they can call collapse() (or possibly getCollapsed()) directly when
they need to.
Other ideas are still a bit too remote/vague for me to able to give an
accurate description of them. I roughly see the resolving taking place
in two phases: once before the FOEventHandler.startXXX() is fired, and
once immediately before the endXXX() event. Those two phases each will
consist of two stages:
- - the first stage, called from TableBody/TableHeader/TableFooter,
resolves border conflicts between
Table/TableHeader/TableFooter/TableBody (and maybe TableColumn), so
could be described as working downwards/inwards
- - the second stage, called from TableCell, resolves the conflicts
between TableCells/TableRow/TableColumn/TableBody, so works
upwards/outwards
That's it for now. Probably more to follow during or after the weekend.
Cheers,
Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFDD1pZyHTbFO9b8aARAtrrAKDFXqdD+RVeTq+tlP7QqSCEDgp9nACfXI7M
xoA6intyi/edMxKXiMWHcfY=
=Pl9G
-----END PGP SIGNATURE-----
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 28, 2005, at 10:10, Manuel Mall wrote:
>
> Oooops - you better ignore this. Just realised that while padding and
> margin allow percentages border-width doesn't. So its not an issue.
> Sorry for the noise.
Ooops, that makes two of us... :-)
Sorry.
Andreas
Re: Collapsing borders: FOTree stage -- progress update
Posted by Manuel Mall <mm...@arcus.com.au>.
On Sun, 28 Aug 2005 10:33 am, Manuel Mall wrote:
> On Sat, 27 Aug 2005 02:07 am, Andreas L Delmelle wrote:
> > Hi all,
>
> <snip/>
>
> > * The first step I took was moving much of the logic that is
> > currently in CollapsingBorderModelEyeCatching (in the layout
> > package) to CommonBorderPaddingBackground.
>
> I must admit I know very little about collapsing borders. Therefore
> if my comment is useless just ignore it.
Oooops - you better ignore this. Just realised that while padding and
margin allow percentages border-width doesn't. So its not an issue.
Sorry for the noise.
Manuel
>
> I have recently worked on all this "percentage" stuff. This applies
> also to border-width specifications. I believe border-width is one of
> the inputs to the border collapse algorithm. Relative border-width
> specifications can only be resolved at layout time (with the
> appropriate context). This seems to indicate the border collapse
> algorithm (at least the parts related to border-width) can only run
> during layout.
>
> <snip/>
>
> > Cheers,
> >
> > Andreas
>
> Manuel
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 28, 2005, at 04:33, Manuel Mall wrote:
>
> I must admit I know very little about collapsing borders. Therefore if
> my comment is useless just ignore it.
Well, I certainly don't think it's useless...
> I have recently worked on all this "percentage" stuff. This applies
> also
> to border-width specifications. I believe border-width is one of the
> inputs to the border collapse algorithm. Relative border-width
> specifications can only be resolved at layout time (with the
> appropriate context). This seems to indicate the border collapse
> algorithm (at least the parts related to border-width) can only run
> during layout.
Not really, I think. That has been on my mind as well, but as I see it,
the border-widths will always be available as Length properties (not
necessarily as fixed widths, unless they were already specified in the
source document as such).
I don't really intend to resolve those widths yet, just determine at
FOTree stage *which* border (as in: specified on *which* element) will
be applicable. If they were specified as percentages, those will still
need to be resolved further on.
Does this address your concerns, or am I misunderstanding you here?
Cheers,
Andreas
Re: Collapsing borders: FOTree stage -- progress update
Posted by Manuel Mall <mm...@arcus.com.au>.
On Sat, 27 Aug 2005 02:07 am, Andreas L Delmelle wrote:
> Hi all,
>
<snip/>
> * The first step I took was moving much of the logic that is
> currently in CollapsingBorderModelEyeCatching (in the layout package)
> to CommonBorderPaddingBackground.
I must admit I know very little about collapsing borders. Therefore if
my comment is useless just ignore it.
I have recently worked on all this "percentage" stuff. This applies also
to border-width specifications. I believe border-width is one of the
inputs to the border collapse algorithm. Relative border-width
specifications can only be resolved at layout time (with the
appropriate context). This seems to indicate the border collapse
algorithm (at least the parts related to border-width) can only run
during layout.
<snip/>
> Cheers,
>
> Andreas
Manuel
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 28, 2005, at 14:38, Andreas L Delmelle wrote:
> On Aug 28, 2005, at 00:06, Jeremias Maerki wrote:
>
>> AFAIK you're trying to move the pre-resolvable pieces into the FO
>> tree while you only do the
>> specialities in the LMs, right?
>>
>
> Exactly. Come to think of it, maybe that last idea won't be feasible
Just for the sake of completeness (since I snipped away too much of my
own message :-) )
I'm talking about my own idea of storing extra BorderInfo instances.
Cheers,
Andreas
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 28, 2005, at 00:06, Jeremias Maerki wrote:
> AFAIK you're trying to move the pre-resolvable pieces into the FO tree
> while you only do the
> specialities in the LMs, right?
>
Exactly. Come to think of it, maybe that last idea won't be feasible
--at least not for the majority of the cells (those in the table-body).
For the header or footer this would be superfluous, since the resolved
borders will already be available from their own cells, and would
simply mean that layout has to decide between one cell's after-border
or another's before-border, so it may not be worth the effort. The
collapse methods will be available from within the layout package
anyway, so it can just pass those two BorderInfos into the method, and
get the right one from there...
We'll see.
Cheers,
Andreas
Re: Collapsing borders: FOTree stage -- progress update
Posted by Jeremias Maerki <de...@greenmail.ch>.
On 27.08.2005 23:19:40 Andreas L Delmelle wrote:
<snip/>
> BTW: since it is my intention to facilitate the job of the layout
> package in this matter, I'm considering adding BorderInfo instances
> (although I'm not sure where exactly) that keep the resolved info to
> use precisely in these layout-specific cases. What I mean is: even if
> the FOTree lacks some of the context, there is always the fact that it
> is a possibility (however remote) to have a page-break between two body
> elements.
> We could say: the BorderInfo to use in 95% of the cases is the one that
> is immediately available in the element's CommonBorderPaddingBackground
> instance, in the other 5% it's another one, available 'over there'
> (wherever that is). Layout would then not need to re-evaluate, but pick
> up the width from that 'special' BorderInfo instance.
> Does this sound like a sane thing?
Remembering your earlier ideas for your approach, I think so, although I
must say that I'm not sure if I really understand it. I keep having
problems following your ideas sometimes, but that's mostly because I'm
not so much the theoretical guy. AFAIK you're trying to move the
pre-resolvable pieces into the FO tree while you only do the
specialities in the LMs, right?
Jeremias Maerki
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 27, 2005, at 22:22, Jeremias Maerki wrote:
>
> On 27.08.2005 21:33:44 Andreas L Delmelle wrote:
>>
>> I'm wondering, for instance, whether the table's before-border specs
>> are only relevant for the first page that is spanned by the table. For
>> example: in case the table has a header (and
>> omit-header-at-break="false"), and the table's before-border wins,
>> then
>> it can still *appear* on the following pages (but that will be because
>> it *is* the header's before-border).
>
> No, the table only has an own border in the separate border model. In
> the collapsing border model only cells have borders. The FO spec is
> very clear on that. So it's absolutely normal that the border specified
> on the table-level can reappear on the following pages based on who
> ever
> wins.
I see. That seems to be exactly what I expected (although again, I
described it in the wrong terms).
To put it correctly: since the table before-border wins over header
before-border, it becomes the competing border for the before-borders
of the cells in the first row of the header. If all the cells in the
header's first row have the same before-border, the table's
before-border then becomes the before-border for all of them.
Sorry for my being unclear. The question was stated in terms of the
phase I'm currently working on: resolving the border-conflicts between
the table and its header/footer/bodies, and those between the
header/first body, body/body, last body/footer. The deeper table
elements will be something for next week.
<snip />
>> (so in this simplified case the after-border on one page
>> will *always* be the same as the before-border on the next)?
>
> No, I don't think so. I believe the collapsing only happens between two
> effectively adjacent cells, i.e., translated to one of our stages, more
> located in the area tree stage than in the FO tree stage, if you know
> what I mean. But I'm not sure here, because I think the spec is really
> not that clear in this little detail. But I'd also think it would be
> strange if the border after from the previous page would bleed over to
> the next page in this way.
OK, that means resolving after/before border conflicts between two
bodies would need to be deferred to layout.
Thanks for the useful comments.
BTW: since it is my intention to facilitate the job of the layout
package in this matter, I'm considering adding BorderInfo instances
(although I'm not sure where exactly) that keep the resolved info to
use precisely in these layout-specific cases. What I mean is: even if
the FOTree lacks some of the context, there is always the fact that it
is a possibility (however remote) to have a page-break between two body
elements.
We could say: the BorderInfo to use in 95% of the cases is the one that
is immediately available in the element's CommonBorderPaddingBackground
instance, in the other 5% it's another one, available 'over there'
(wherever that is). Layout would then not need to re-evaluate, but pick
up the width from that 'special' BorderInfo instance.
Does this sound like a sane thing?
Cheers,
Andreas
Re: Collapsing borders: FOTree stage -- progress update
Posted by Jeremias Maerki <de...@greenmail.ch>.
On 27.08.2005 21:33:44 Andreas L Delmelle wrote:
> On Aug 27, 2005, at 09:09, Jeremias Maerki wrote:
>
> > Ok, the shock is gone. Thank you for reassuring me that you know what
> > you do. That was my biggest concern. I'm happy that you can reuse some
> > of my code. Finally, someone can use something I wrote to make better
> > progress. Normally, it's the other way around. :-)
>
> FWIW, I noticed that as well.
>
> > So I'm wishing you the best of luck and I will assist where I can.
>
> Thanks. I already have a few remarks, but I'm not sure that you can
> offer assistance. This is mainly because there is an inherent
> difficulty in that XSL-FO 1.0 refers entirely to CSS for
> border-resolution rules, but CSS was written with HTML in mind... It's
> all so much simpler if there exists no such thing as page-breaks and
> you have to deal with one continuous table. Maybe this issue should be
> addressed at W3C? It's understandable that the XSL-FO WG wanted very
> much to avoid having to duplicate rules that are already defined in
> other Recommendations, but simply pointing to CSS, which was clearly
> meant for non-paginated layout, seems to leave too much room for
> implementation-dependent behavior...
>
> I'm wondering, for instance, whether the table's before-border specs
> are only relevant for the first page that is spanned by the table. For
> example: in case the table has a header (and
> omit-header-at-break="false"), and the table's before-border wins, then
> it can still *appear* on the following pages (but that will be because
> it *is* the header's before-border).
No, the table only has an own border in the separate border model. In
the collapsing border model only cells have borders. The FO spec is
very clear on that. So it's absolutely normal that the border specified
on the table-level can reappear on the following pages based on who ever
wins.
> Another one to chew on: start from a table without header/footer which
> does have multiple bodies. Suppose also that there are no borders
> specified on any elements other than the bodies (for the sake of
> simplicity). Now, if it turns out that a page-break occurs right in
> between the two bodies, does this mean that the later body's
> before-border still must be collapsed with the earlier body's
> after-border (so in this simplified case the after-border on one page
> will *always* be the same as the before-border on the next)?
No, I don't think so. I believe the collapsing only happens between two
effectively adjacent cells, i.e., translated to one of our stages, more
located in the area tree stage than in the FO tree stage, if you know
what I mean. But I'm not sure here, because I think the spec is really
not that clear in this little detail. But I'd also think it would be
strange if the border after from the previous page would bleed over to
the next page in this way.
Jeremias Maerki
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 27, 2005, at 09:09, Jeremias Maerki wrote:
> Ok, the shock is gone. Thank you for reassuring me that you know what
> you do. That was my biggest concern. I'm happy that you can reuse some
> of my code. Finally, someone can use something I wrote to make better
> progress. Normally, it's the other way around. :-)
FWIW, I noticed that as well.
> So I'm wishing you the best of luck and I will assist where I can.
Thanks. I already have a few remarks, but I'm not sure that you can
offer assistance. This is mainly because there is an inherent
difficulty in that XSL-FO 1.0 refers entirely to CSS for
border-resolution rules, but CSS was written with HTML in mind... It's
all so much simpler if there exists no such thing as page-breaks and
you have to deal with one continuous table. Maybe this issue should be
addressed at W3C? It's understandable that the XSL-FO WG wanted very
much to avoid having to duplicate rules that are already defined in
other Recommendations, but simply pointing to CSS, which was clearly
meant for non-paginated layout, seems to leave too much room for
implementation-dependent behavior...
I'm wondering, for instance, whether the table's before-border specs
are only relevant for the first page that is spanned by the table. For
example: in case the table has a header (and
omit-header-at-break="false"), and the table's before-border wins, then
it can still *appear* on the following pages (but that will be because
it *is* the header's before-border).
Another one to chew on: start from a table without header/footer which
does have multiple bodies. Suppose also that there are no borders
specified on any elements other than the bodies (for the sake of
simplicity). Now, if it turns out that a page-break occurs right in
between the two bodies, does this mean that the later body's
before-border still must be collapsed with the earlier body's
after-border (so in this simplified case the after-border on one page
will *always* be the same as the before-border on the next)?
Cheers,
Andreas
Re: Collapsing borders: FOTree stage -- progress update
Posted by Jeremias Maerki <de...@greenmail.ch>.
Ok, the shock is gone. Thank you for reassuring me that you know what
you do. That was my biggest concern. I'm happy that you can reuse some
of my code. Finally, someone can use something I wrote to make better
progress. Normally, it's the other way around. :-) So I'm wishing you
the best of luck and I will assist where I can. I'm extremely excited
about the prospect of having collapsing borders around. And thanks for
taking this task upon you.
On 27.08.2005 00:01:47 Andreas L Delmelle wrote:
> On Aug 26, 2005, at 21:32, Jeremias Maerki wrote:
>
> > You got me a little shocked when I read your post.
>
> Really? Good! Nothing personal, but I always tend to take
> 'shock-and-awe' to be a sign that I'm on the right track. I remember
> having driven Glen crazy on a few occasions, and that was precisely
> *because* I was right --although I was far from certain of it at the
> time.
>
> > Now I'm afraid I should have realized earlier on what you're up to.
>
> Afraid? Why exactly? Because you were so enthusiastic about the
> possibility of collapsing borders being supported by FOP, and now you
> fear that this enthusiasm was misplaced (or premature)? Well, I'll do
> my best not to be discouraged by your fear. :-)
>
> > I hope you were able to reuse at least a bit of the code I already
> > wrote for the collapsing
> > border model.
>
> Sure. That's why that step was completed so quickly. Because there was
> no need to start from scratch. Resolving the border conflicts in the
> FOTree will take a little more time, as that approach greatly differs
> from your initial solution to handle it *all* in layout.
> Still, see my recent reply to Peter Herweg's concerns. Now, apply that
> to this situation: if you hadn't done that work a few months back and
> committed it, what I'm doing now would definitely take much longer.
>
> > As far as I can remember most of that already worked quite well
> > (everything except element generation, I mean). The reason I stopped
> > with the collapsing border model was my failure to come up with the
> > right rules to handle the Knuth element generation for the cases
> > where headers and footers interact with body cells.
>
> Hmm... I see what you mean, but I'm taking this step (a step back?)
> precisely because I strongly suspect that the rules for element
> generation will become more apparent if/when the layout package is made
> to deal *only* with the layout-specific cases.
>
> <snip />
> > But I'm really concerned that you're hacking away on something for
> > which
> > a fundamental problem isn't solved, yet.
>
> Maybe so, but as I already pointed out somewhere in our discussion back
> then, the logic behind collapsing borders simply does not belong *in*
> the layout package. It only has to be *reachable* from there, in case
> the LM's need to resolve borders for the break/span situations.
> So, is this move necessary? Maybe not. I can't say. Is it desirable?
> IMO most definitely.
>
> Sure, it's a risk. Maybe eventually, when having to deal with that
> 'fundamental' problem, I too will reach a point where I'll be inclined
> to give up. Then again, maybe, in the meantime some ideas will arise on
> how to facilitate the eventual solution. I can't predict the future
> with absolute certainty, but I've got a hunch... Of course, it would be
> presumptuous to state that I *will* make it work, so I'm not going to.
> What I *am* going to do is *try* to make it appear more trivial than it
> is now. Even if it becomes only a tiny bit more trivial, that could
> well turn out to give us just what we were looking for.
> (In the worst case, by the time I'm done, I will have gained valuable
> insights into the innards of the properties-, fo- and layout-packages,
> so *I* can't view that to be a waste of time...)
>
> > Did you verify beforehand that you understand the interactions between
> > cells in break-conditions especially with headers and footers present?
> > That's where I gave up back
> > in May [1].
>
> I'm aware of the difficulties, but I am currently pretty convinced
> that, once the first part is completed --the move to the
> fo.flow/fo.properties packages-- this will somehow become easier to
> sort out. Strange as it may sound, ATM I (have to) force myself to
> ignore those interaction problems, as they bear no relation (yet) to
> what I feel needs to happen in the FOTree. Once this task is finished,
> layout problems will appear as exactly that: _layout_ problems.
> One thing I didn't mention yet is that 'moving' the logic is actually a
> big word, since I've yet to remove the references to it from the layout
> code. Currently 'copying' would perhaps better describe it. So, there's
> still another opportunity to bump in to ideas: when I'm forced to adapt
> the layout code to the new situation.
>
> One thing's for certain: it *will* make a difference, and I can only
> hope the difference will turn out to be a crucial one.
>
>
> Cheers,
>
> Andreas
> (with fingers crossed ;-))
Jeremias Maerki
Re: Collapsing borders: FOTree stage -- progress update
Posted by Andreas L Delmelle <a_...@pandora.be>.
On Aug 26, 2005, at 21:32, Jeremias Maerki wrote:
> You got me a little shocked when I read your post.
Really? Good! Nothing personal, but I always tend to take
'shock-and-awe' to be a sign that I'm on the right track. I remember
having driven Glen crazy on a few occasions, and that was precisely
*because* I was right --although I was far from certain of it at the
time.
> Now I'm afraid I should have realized earlier on what you're up to.
Afraid? Why exactly? Because you were so enthusiastic about the
possibility of collapsing borders being supported by FOP, and now you
fear that this enthusiasm was misplaced (or premature)? Well, I'll do
my best not to be discouraged by your fear. :-)
> I hope you were able to reuse at least a bit of the code I already
> wrote for the collapsing
> border model.
Sure. That's why that step was completed so quickly. Because there was
no need to start from scratch. Resolving the border conflicts in the
FOTree will take a little more time, as that approach greatly differs
from your initial solution to handle it *all* in layout.
Still, see my recent reply to Peter Herweg's concerns. Now, apply that
to this situation: if you hadn't done that work a few months back and
committed it, what I'm doing now would definitely take much longer.
> As far as I can remember most of that already worked quite well
> (everything except element generation, I mean). The reason I stopped
> with the collapsing border model was my failure to come up with the
> right rules to handle the Knuth element generation for the cases
> where headers and footers interact with body cells.
Hmm... I see what you mean, but I'm taking this step (a step back?)
precisely because I strongly suspect that the rules for element
generation will become more apparent if/when the layout package is made
to deal *only* with the layout-specific cases.
<snip />
> But I'm really concerned that you're hacking away on something for
> which
> a fundamental problem isn't solved, yet.
Maybe so, but as I already pointed out somewhere in our discussion back
then, the logic behind collapsing borders simply does not belong *in*
the layout package. It only has to be *reachable* from there, in case
the LM's need to resolve borders for the break/span situations.
So, is this move necessary? Maybe not. I can't say. Is it desirable?
IMO most definitely.
Sure, it's a risk. Maybe eventually, when having to deal with that
'fundamental' problem, I too will reach a point where I'll be inclined
to give up. Then again, maybe, in the meantime some ideas will arise on
how to facilitate the eventual solution. I can't predict the future
with absolute certainty, but I've got a hunch... Of course, it would be
presumptuous to state that I *will* make it work, so I'm not going to.
What I *am* going to do is *try* to make it appear more trivial than it
is now. Even if it becomes only a tiny bit more trivial, that could
well turn out to give us just what we were looking for.
(In the worst case, by the time I'm done, I will have gained valuable
insights into the innards of the properties-, fo- and layout-packages,
so *I* can't view that to be a waste of time...)
> Did you verify beforehand that you understand the interactions between
> cells in break-conditions especially with headers and footers present?
> That's where I gave up back
> in May [1].
I'm aware of the difficulties, but I am currently pretty convinced
that, once the first part is completed --the move to the
fo.flow/fo.properties packages-- this will somehow become easier to
sort out. Strange as it may sound, ATM I (have to) force myself to
ignore those interaction problems, as they bear no relation (yet) to
what I feel needs to happen in the FOTree. Once this task is finished,
layout problems will appear as exactly that: _layout_ problems.
One thing I didn't mention yet is that 'moving' the logic is actually a
big word, since I've yet to remove the references to it from the layout
code. Currently 'copying' would perhaps better describe it. So, there's
still another opportunity to bump in to ideas: when I'm forced to adapt
the layout code to the new situation.
One thing's for certain: it *will* make a difference, and I can only
hope the difference will turn out to be a crucial one.
Cheers,
Andreas
(with fingers crossed ;-))
Re: Collapsing borders: FOTree stage -- progress update
Posted by Jeremias Maerki <de...@greenmail.ch>.
You got me a little shocked when I read your post. Now I'm afraid I
should have realized earlier on what you're up to. I hope you were able
to reuse at least a bit of the code I already wrote for the collapsing
border model. As far as I can remember most of that already worked quite
well (everything except element generation, I mean). The reason I
stopped with the collapsing border model was my failure to come up with
the right rules to handle the Knuth element generation for the cases
where headers and footers interact with body cells. Note that I'm
talking about the theoretical level, not the implementation. Now I'm
concerned that you actually work on code that almost worked where
actually a problem needs to be solved before it comes to further coding.
I'm not saying that your reworking the code for collapsing border model
is bad or something. I might be necessary. I didn't think so back then.
But I'm really concerned that you're hacking away on something for which
a fundamental problem isn't solved, yet. Did you verify beforehand that
you understand the interactions between cells in break-conditions
especially with headers and footers present? That's where I gave up back
in May [1].
[1] http://www.nabble.com/-VOTE-Merge-Knuth-branch-back-into-HEAD-p23249.html
On 26.08.2005 20:07:09 Andreas L Delmelle wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> First of all: many, many thanks to Finn for taking care of the default
> border-precedence values!
> Secondly: sorry for the rather long post.
>
> This message is solely intended to keep you guys (and other interested
> parties) informed about my progress in this matter, and perhaps, more
> importantly, to give other devs the opportunity to yell 'STOP!' if
> they see something that could be considered a Very Bad Thing (as Java
> programming is still a leisure activity for me, it's all based on
> theory rather than hands-on experience).
>
> Ok, here goes:
>
> * The first step I took was moving much of the logic that is currently
> in CollapsingBorderModelEyeCatching (in the layout package) to
> CommonBorderPaddingBackground.
> More precisely: I created a subclass of the BorderInfo inner class.
> This subclass, TableBorderInfo, provides two versions of a collapse()
> method: one for eye-catching collapsing, and an overloaded one that
> allows for passing in precedence values. Their signatures are:
>
> public void collapse( BorderInfo, boolean );
> public void collapse( BorderInfo, boolean, int, int );
>
> The idea here is to make this functionality available to the FOTree as
> well as Layout without moving essentially layout-related code into the
> FOTree (or vice versa). I'm not absolutely sure that subclassing
> BorderInfo is the appropriate approach, since the collapse() methods
> could just as easily be added to BorderInfo itself. Personally, I did
> this to make the distinction, as those methods do not apply to borders
> on non-table FOs (but in the end, the other FOs simply won't call this
> method, so there would be little harm in that).
> In any case, the ultimate goal is to have layout only access the
> collapse() methods for the situations where the FOTree lacks the
> necessary context. The most obvious ones: breaks, spans and multiple
> bodies.
> But for a simple table with one body that has no row- or
> column-spanning cells and that is small enough to fit on one page,
> layout would only read the border-info from the FOs appropriate for the
> given situation. The layout classes will still need to decide which FO
> is the appropriate one, but once that decision has been made, all they
> need to do is read the border-info and use the width (no additional
> comparison/collapsing needed).
> The collapse-method does not need to concern itself with which sides
> the borders are on, as this depends on the types of FO the borders
> belong to. (For example: when comparing header and body, the header's
> after-border needs to be compared to the body's before-border, but when
> comparing header and table, the pair is before/before) All it does is
> compare its BorderInfo instance to another that is being passed in, and
> modify the style/width/color values if and where necessary. The 'side'
> issue should be dealt with at another level.
> The primary function of the boolean parameter is to allow/prohibit the
> property values to be replaced by those of the BorderInfo that is being
> passed in as a parameter. If the parameter BorderInfo wins, it simply
> keeps its own set of values, and depending on this flag, forces these
> values onto the base BorderInfo for which collapse() was called. If the
> parameter BorderInfo loses, its values are *always* discarded and
> replaced. The boolean flag comes in handy, for example when
> Table.omitHeaderAtBreak() is true. When resolving border-conflicts
> between header and body, the body's border cannot be discarded/replaced
> since it could still be relevant for all but the first page (or column)
> that is spanned by the table.
>
> This first step is as good as complete in my local sandbox.
> [As a side-note: I'm also thinking of providing two getCollapsed()
> methods that return the winning BorderInfo instance instead of actually
> replacing one with the other. This might come in handy when the table
> has more than one body, and may also prove useful for the
> layout-classes, since it's not always desirable to actually change the
> BorderInfo.]
>
> * I added a class named TableBorderConflictResolver to the fo.flow
> package. One of these will be instantiated for/enclosed by each Table
> instance that doesn't have separated borders. This class is currently
> under heavy construction, so I can't offer a lot of details yet.
> The main idea here is to provide a set of overloaded versions of a
> resolve() method that resolves the border-conflicts between the
> enclosing Table instance and its descendants (one parameter) or between
> two of the Table's descendants (two parameters). These methods are the
> ones that will sort out the 'sides' issue. They will call
> TableBorderInfo.collapse() for each pair of applicable sides
> (start/start, end/end, before/before, after/before etc.)
>
> * Evidently, Table then needs to allow its descendants to use the
> TableBorderConflictResolver. I don't think this access needs to be
> public, as the layout-classes have access to the FOs BorderInfo, so
> they can call collapse() (or possibly getCollapsed()) directly when
> they need to.
>
>
> Other ideas are still a bit too remote/vague for me to able to give an
> accurate description of them. I roughly see the resolving taking place
> in two phases: once before the FOEventHandler.startXXX() is fired, and
> once immediately before the endXXX() event. Those two phases each will
> consist of two stages:
> - - the first stage, called from TableBody/TableHeader/TableFooter,
> resolves border conflicts between
> Table/TableHeader/TableFooter/TableBody (and maybe TableColumn), so
> could be described as working downwards/inwards
> - - the second stage, called from TableCell, resolves the conflicts
> between TableCells/TableRow/TableColumn/TableBody, so works
> upwards/outwards
>
>
> That's it for now. Probably more to follow during or after the weekend.
>
> Cheers,
>
> Andreas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
>
> iD8DBQFDD1pZyHTbFO9b8aARAtrrAKDFXqdD+RVeTq+tlP7QqSCEDgp9nACfXI7M
> xoA6intyi/edMxKXiMWHcfY=
> =Pl9G
> -----END PGP SIGNATURE-----
Jeremias Maerki