Here's how this works:

Fop.java has this method, getDefaultHander() which creates an
FOTreeBuilder. This is actually the class that controls to whole
transformation by reacting on SAX events. FOTreeBuilder itself calls an
FOEventHandler of which AreaTreeHandler is a subclass. AreaTreeHandler
is used for paged formats like PDF and PS where the layout engine kicks
in to do the pagination. In the case of flow-oriented formats like RTF
and MIF the FOTreeBuilder gets different FOEventHandler subclasses from
the RendererFactory (like RTFHandler and MIFHandler). In this latter
case there will be no FormattingResults object you can build since you
don't know about the number of pages being generated.

So, I think it should be safe to remember the FOTreeBuilder as a member
variable in the Fop class (once it is created in getDefaultHandler()) and
access that instance later in a getFormattingResults() call. From
FOTreeBuilder, you can easily access the AreaTreeHandler through the
foEventHandler member variable.

Working with the FOUserAgent would be possible but I wouldn't prefer
that.

HTH

On 30.07.2005 10:09:45 Manuel Mall wrote:
> I think I have a handle on how to obtain the number of pages generated per 
> page sequence. However, I am struggling with how to best access the 
> FormattingResults structure in Fop.java.
> In 0.20.5 the structure lived in StreamRenderer which is now sort of 
> AreaTreeHandler. It is not clear to me how I can access AreaTreeHandler from 
> Fop.java as it appears not to be accessible from what Fop.java currently 
> holds? As an alternative the results structure could live in FOUserAgent as 
> FOUserAgent is known to both Fop.java and AreaTreeHandler. However, 
> FOUserAgent is currently used to only communicate user configurable items 
> into the fo processing not to report back which is the purpose of the 
> FormatingResults. As I am quite new to this I don't want to stuff things up 
> and would appreciate suggestions.
> 
> Thanks
> 
> Manuel
> On Thu, 28 Jul 2005 03:41 am, Simon Pepping wrote:
> ...
> > On Wed, Jul 27, 2005 at 08:43:50AM +0200, Jeremias Maerki wrote:
> > > Manuel,
> > >
> ...
> > > - Find a way to access the FormattingResults structure in Fop.java like
> > > it was done in 0.20.5.



Jeremias Maerki

Reply via email to