Browse Source

describes fop architecture (author: Arved Sandstrom)


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/release-0-13-0@193357 13f79535-47bb-0310-9956-ffa450edef68
release-0-13-0
fotis 24 years ago
parent
commit
91c6021405
1 changed files with 276 additions and 0 deletions
  1. 276
    0
      docs/architecture.html

+ 276
- 0
docs/architecture.html View File

@@ -0,0 +1,276 @@
<HTML><HEAD><SCRIPT language="JavaScript" src="resources/script.js" type="text/javascript"></SCRIPT><TITLE>FOP Mechanics</TITLE></HEAD><BODY alink="#ff0000" bgcolor="#ffffff" leftmargin="4" link="#0000ff" marginheight="4" marginwidth="4" text="#000000" topmargin="4" vlink="#0000aa"><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD align="left" height="60" rowspan="3" valign="top" width="135"><IMG border="0" height="60" hspace="0" src="resources/logo.gif" vspace="0" width="135"></TD><TD align="left" colspan="4" height="5" valign="top" width="456"><IMG border="0" height="5" hspace="0" src="resources/line.gif" vspace="0" width="456"></TD><TD align="left" height="60" rowspan="3" valign="top" width="29"><IMG border="0" height="60" hspace="0" src="resources/right.gif" vspace="0" width="29"></TD></TR><TR><TD align="left" bgcolor="#0086b2" colspan="4" height="35" valign="top" width="456"><IMG alt="" border="0" height="35" hspace="0" src="graphics/architecture-header.jpg" vspace="0" width="456"></TD></TR><TR><TD align="left" height="20" valign="top" width="168"><IMG border="0" height="20" hspace="0" src="resources/bottom.gif" vspace="0" width="168"></TD><TD align="left" height="20" valign="top" width="96"><A href="http://xml.apache.org/" onMouseOut="rolloverOff('xml');" onMouseOver="rolloverOn('xml');" target="new"><IMG alt="http://xml.apache.org/" border="0" height="20" hspace="0" name="xml" onLoad="rolloverLoad('xml','resources/button-xml-hi.gif','resources/button-xml-lo.gif');" src="resources/button-xml-lo.gif" vspace="0" width="96"></A></TD><TD align="left" height="20" valign="top" width="96"><A href="http://www.apache.org/" onMouseOut="rolloverOff('asf');" onMouseOver="rolloverOn('asf');" target="new"><IMG alt="http://www.apache.org/" border="0" height="20" hspace="0" name="asf" onLoad="rolloverLoad('asf','resources/button-asf-hi.gif','resources/button-asf-lo.gif');" src="resources/button-asf-lo.gif" vspace="0" width="96"></A></TD><TD align="left" height="20" valign="top" width="96"><A href="http://www.w3.org/" onMouseOut="rolloverOff('w3c');" onMouseOver="rolloverOn('w3c');" target="new"><IMG alt="http://www.w3.org/" border="0" height="20" hspace="0" name="w3c" onLoad="rolloverLoad('w3c','resources/button-w3c-hi.gif','resources/button-w3c-lo.gif');" src="resources/button-w3c-lo.gif" vspace="0" width="96"></A></TD></TR></TABLE><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD align="left" valign="top" width="120"><IMG border="0" height="14" hspace="0" src="resources/join.gif" vspace="0" width="120"><BR>
<A href="../index.html" onMouseOut="rolloverOff('side-ext-2');" onMouseOver="rolloverOn('side-ext-2');"><IMG alt="Home" border="0" height="12" hspace="0" name="side-ext-2" onLoad="rolloverLoad('side-ext-2','graphics/ext-2-label-2.jpg','graphics/ext-2-label-3.jpg');" src="graphics/ext-2-label-3.jpg" vspace="0" width="120"></A><BR>
<IMG border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR>
<A href="index.html" onMouseOut="rolloverOff('side-index');" onMouseOver="rolloverOn('side-index');"><IMG alt="Readme" border="0" height="12" hspace="0" name="side-index" onLoad="rolloverLoad('side-index','graphics/index-label-2.jpg','graphics/index-label-3.jpg');" src="graphics/index-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="download.html" onMouseOut="rolloverOff('side-download');" onMouseOver="rolloverOn('side-download');"><IMG alt="Download" border="0" height="12" hspace="0" name="side-download" onLoad="rolloverLoad('side-download','graphics/download-label-2.jpg','graphics/download-label-3.jpg');" src="graphics/download-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="running.html" onMouseOut="rolloverOff('side-running');" onMouseOver="rolloverOn('side-running');"><IMG alt="Running FOP" border="0" height="12" hspace="0" name="side-running" onLoad="rolloverLoad('side-running','graphics/running-label-2.jpg','graphics/running-label-3.jpg');" src="graphics/running-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="implemented.html" onMouseOut="rolloverOff('side-implemented');" onMouseOver="rolloverOn('side-implemented');"><IMG alt="Features" border="0" height="12" hspace="0" name="side-implemented" onLoad="rolloverLoad('side-implemented','graphics/implemented-label-2.jpg','graphics/implemented-label-3.jpg');" src="graphics/implemented-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="limitations.html" onMouseOut="rolloverOff('side-limitations');" onMouseOver="rolloverOn('side-limitations');"><IMG alt="Limitations" border="0" height="12" hspace="0" name="side-limitations" onLoad="rolloverLoad('side-limitations','graphics/limitations-label-2.jpg','graphics/limitations-label-3.jpg');" src="graphics/limitations-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="bugs.html" onMouseOut="rolloverOff('side-bugs');" onMouseOver="rolloverOn('side-bugs');"><IMG alt="Bugs" border="0" height="12" hspace="0" name="side-bugs" onLoad="rolloverLoad('side-bugs','graphics/bugs-label-2.jpg','graphics/bugs-label-3.jpg');" src="graphics/bugs-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="examples.html" onMouseOut="rolloverOff('side-examples');" onMouseOver="rolloverOn('side-examples');"><IMG alt="Examples" border="0" height="12" hspace="0" name="side-examples" onLoad="rolloverLoad('side-examples','graphics/examples-label-2.jpg','graphics/examples-label-3.jpg');" src="graphics/examples-label-3.jpg" vspace="0" width="120"></A><BR>
<IMG border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR>
<A href="compiling.html" onMouseOut="rolloverOff('side-compiling');" onMouseOver="rolloverOn('side-compiling');"><IMG alt="Compiling" border="0" height="12" hspace="0" name="side-compiling" onLoad="rolloverLoad('side-compiling','graphics/compiling-label-2.jpg','graphics/compiling-label-3.jpg');" src="graphics/compiling-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="embedding.html" onMouseOut="rolloverOff('side-embedding');" onMouseOver="rolloverOn('side-embedding');"><IMG alt="Embedding" border="0" height="12" hspace="0" name="side-embedding" onLoad="rolloverLoad('side-embedding','graphics/embedding-label-2.jpg','graphics/embedding-label-3.jpg');" src="graphics/embedding-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="involved.html" onMouseOut="rolloverOff('side-involved');" onMouseOver="rolloverOn('side-involved');"><IMG alt="Getting involved" border="0" height="12" hspace="0" name="side-involved" onLoad="rolloverLoad('side-involved','graphics/involved-label-2.jpg','graphics/involved-label-3.jpg');" src="graphics/involved-label-3.jpg" vspace="0" width="120"></A><BR>
<IMG border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR>
<A href="faqs.html" onMouseOut="rolloverOff('side-faqs');" onMouseOver="rolloverOn('side-faqs');"><IMG alt="FAQs" border="0" height="12" hspace="0" name="side-faqs" onLoad="rolloverLoad('side-faqs','graphics/faqs-label-2.jpg','graphics/faqs-label-3.jpg');" src="graphics/faqs-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="specs.html" onMouseOut="rolloverOff('side-specs');" onMouseOver="rolloverOn('side-specs');"><IMG alt="Specifications" border="0" height="12" hspace="0" name="side-specs" onLoad="rolloverLoad('side-specs','graphics/specs-label-2.jpg','graphics/specs-label-3.jpg');" src="graphics/specs-label-3.jpg" vspace="0" width="120"></A><BR>
<A href="license.html" onMouseOut="rolloverOff('side-license');" onMouseOver="rolloverOn('side-license');"><IMG alt="License" border="0" height="12" hspace="0" name="side-license" onLoad="rolloverLoad('side-license','graphics/license-label-2.jpg','graphics/license-label-3.jpg');" src="graphics/license-label-3.jpg" vspace="0" width="120"></A><BR>

<IMG border="0" height="14" hspace="0" src="resources/close.gif" vspace="0" width="120"><BR></TD><TD align="left" valign="top" width="500"><TABLE border="0" cellpadding="3" cellspacing="0"><TR><TD>

<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Introduction</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">

<P>
The overall process is controlled by <B>org.apache.fop.apps.Driver</B>. In
this class, a typical sequence is:</P>

<P><CODE><FONT face="courier, monospaced">Driver driver = new Driver();</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">driver.setRenderer(&quot;org.apache.fop.render.pdf.PDFRenderer&quot;, version);</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">driver.addElementMapping(&quot;org.apache.fop.fo.StandardElementMapping&quot;);</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">driver.addElementMapping(&quot;org.apache.fop.svg.SVGElementMapping&quot;);</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">driver.setWriter(new PrintWriter(new FileWriter(args[1])));</FONT></CODE></P>
<P></P>
<P><CODE><FONT face="courier, monospaced">driver.buildFOTree(parser, fileInputSource(args[0]));</FONT></CODE></P>
<P></P>
<P><CODE><FONT face="courier, monospaced">driver.format();</FONT></CODE></P>
<P></P>
<P><CODE><FONT face="courier, monospaced">driver.render();</FONT></CODE></P>
</FONT></TD></TR></TABLE><BR>

<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Formatting Object Tree</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">
<P>The class <B>org.apache.fop.fo.FOTreeBuilder</B> is responsible for actually
constructing the FO tree. The key SAX events used are </P>
<P><CODE><FONT face="courier, monospaced">startElement()</FONT></CODE>,</P>
<P><CODE><FONT face="courier, monospaced">endElement()</FONT></CODE> and <CODE><FONT face="courier, monospaced">characters()</FONT></CODE>.</P>

<P>All formatting objects derive from abstract class
<B>org.apache.fop.fo.FONode</B>. The other FO classes inherit from
<B>FONode</B> as follows:</P>

<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FONode</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__________|________</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;FObj&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FOText</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;|</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;|___________________</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;FObjMixed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SequenceSpecifier
</FONT></CODE></P>

<P>FO's extending FObj:</P>

<P>Package org.apache.fop.fo.pagination:</P>


<P><CODE><FONT face="courier, monospaced"> LayoutMasterSet</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> PageSequence</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> RegionAfter</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> RegionBefore</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> RegionBody</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> Root</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> SequenceSpecification</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced"> SimplePageMaster</FONT></CODE></P>


<P>Package org.apache.fop.fo.flow:</P>


<P><CODE><FONT face="courier, monospaced">BlockContainer</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">DisplayGraphic</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">DisplayRule</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">DisplaySequence</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">Flow</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">InlineGraphic</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">ListBlock</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">ListItem</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">ListItemBody</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">ListItemLabel</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">PageNumber</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">StaticContent</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">Table</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">TableBody</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">TableCell</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">TableColumn</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">TableRow</FONT></CODE></P>

<P>FO's extending SequenceSpecifier:</P>

<P>Package org.apache.fop.fo.pagination:</P>


<P><CODE><FONT face="courier, monospaced">SequenceSpecifierAlternating</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">SequenceSpecifierRepeating</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">SequenceSpecifierSingle</FONT></CODE></P>

<P>FO's extending FObjMixed:</P>

<P>Package org.apache.fop.fo.flow:</P>


<P><CODE><FONT face="courier, monospaced">Block</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">InlineSequence</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">SimpleLink</FONT></CODE></P>

</FONT></TD></TR></TABLE><BR>

<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>FONode</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">
<P>
The class inheritance described above only describes the nature of the
content. Every FO in FOP also has a parent, and a Vector of children. The
parent attribute (in the Java sense), in particular, is used to enforce
constraints required by the FO hierarchy.
</P>

<P>
FONode, among other things, ensures that FO's have a parent, that they
have children, that they maintain a marker of where the layout was up to
(for FObj's it is the child number, and for FOText's it is the character
number), and that they have a <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method.
</P>
</FONT></TD></TR></TABLE><BR>

<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Making FO's</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">

<P>
Every FO class has code that looks something like this:
</P>

<P><CODE><FONT face="courier, monospaced">public static class Maker extends FObj.Maker {</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; public FObj make(FObj parent, PropertyList propertyList)</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp; throws FOPException</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; {</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp; return new SimplePageMaster(parent, propertyList);</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; }</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">}</FONT></CODE></P>


<P>
The class also has a static method that resembles
</P>

<P><CODE><FONT face="courier, monospaced">public static FObj.Maker maker()</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; {</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp; return new PageSequence.Maker();</FONT></CODE></P>
<P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; }</FONT></CODE></P>

<P>
A hash 'fobjTable' exists in <B>FOTreeBuilder</B>, and maps the FO names (such as
'fo:table') to object references to the appropriate factories
(such as <B>Table.Maker</B>).
</P>

<P>
Properties (recall that FO's have properties, areas have traits, and XML
nodes have attributes) are also a concern of <B>FOTreeBuilder</B>. It
accomplishes this by using <B>PropertyListBuilder</B>, which contains a hash of
property names and <I>their</I> respective makers. The base class for
properties is <B>Property</B>, and the property makers extend
<B>Property.Maker</B>.
</P>
</FONT></TD></TR></TABLE><BR>
<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>FO Formatting</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">

<P>
<B>FOTreeBuilder</B> calls <CODE><FONT face="courier, monospaced">format()</FONT></CODE> on the root FO, passing
it the <B>AreaTree</B>
reference. In turn, <B>Root</B> calls <CODE><FONT face="courier, monospaced">format()</FONT></CODE> on each
<B>PageSequence</B>, passing <I>it</I>
the <B>AreaTree</B> reference.
</P>

<P>
The <B>PageSequence</B> <CODE><FONT face="courier, monospaced">format()</FONT></CODE> method does the following things:
</P>

<OL>
<LI>Makes a <B>Page</B>, using <B>PageMasterFactory</B> to produce a
<B>PageMaster</B>, and
using <CODE><FONT face="courier, monospaced">makePage()</FONT></CODE> in the latter class. In the simplest picture,
a <B>Page</B> has
5 areas represented by <B>AreaContainers</B>;</LI>

<LI>Handles layout for <B>StaticContent</B> objects in the 'before' and 'after'
regions, if set. This uses the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method in
<B>StaticContent</B>;</LI>

<LI>If a page break is not forced, it will continue to layout the flow into
the body area (<B>AreaContainer</B>) of the current page;</LI>

<LI>It continues with (1) when layout into the current page is done, but
the flow is not empty.</LI>
</OL>
</FONT></TD></TR></TABLE><BR>

<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Area Layout</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">

<P>
FO's that represent actual areas, starting with <B>Flow</B> and
<B>StaticContent</B>, have
a <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method, with the following signature:
</P>

<P>
<CODE><FONT face="courier, monospaced">
public Status layout(Area area)
</FONT></CODE>
</P>

<P>
The fundamental role of the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method is to manage the layout of
children and/or to generate new areas.
</P>

<P>
<B>Example</B>: the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method for <B>Flow</B> generates no new areas - it manages the
layout of the flow children.
</P>

<P>
<B>Example</B>: the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method for <B>Block</B>
generates a new <B>BlockArea</B> in and of
itself, and also manages the layout of the block children, which are added
to the <B>BlockArea</B> before that is itself added to its parent
<B>Area</B>.
</P>

<P>
<CODE><FONT face="courier, monospaced">Layout()</FONT></CODE> methods are subject to the general constraint that possibly not
all of their children can be accommodated, and they report back accordingly
with an appropriate <B>Status</B>.
</P>
</FONT></TD></TR></TABLE><BR>

<TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="666699" colspan="2" width="494"><TABLE border="0" cellpadding="0" cellspacing="0" width="494"><TR><TD bgcolor="#039acc" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#039acc" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#039acc" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#0086b2" width="492"><FONT color="#ffffff" face="arial,helvetica,sanserif" size="+1"><IMG border="0" height="2" hspace="0" src="resources/void.gif" vspace="0" width="2"><B>Rendering</B></FONT></TD><TD bgcolor="#017299" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR><TR><TD bgcolor="#0086b2" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD><TD bgcolor="#017299" height="1" width="492"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="492"></TD><TD bgcolor="#017299" height="1" width="1"><IMG border="0" height="1" hspace="0" src="resources/void.gif" vspace="0" width="1"></TD></TR></TABLE></TD></TR><TR><TD width="10">&nbsp;</TD><TD width="484"><FONT color="#000000" face="arial,helvetica,sanserif">

<P>
This is a separate process. The <CODE><FONT face="courier, monospaced">render()</FONT></CODE> method in
<B>Driver</B> is invoked (say,
by <B>CommandLine</B>) with the laid-out <B>AreaTree</B> and a
<B>PrintWriter</B> as arguments.
This actually calls the <CODE><FONT face="courier, monospaced">render()</FONT></CODE> method in a specific implementation of
the <B>Renderer</B> interface, typically <B>PDFRenderer</B> or
<B>AWTRenderer</B>.
</P>

<P>
At the highest level <B>PDFRenderer</B>, for example, begins by rendering each
<B>Page</B>. The <CODE><FONT face="courier, monospaced">render()</FONT></CODE> method in <B>Page</B> (as is the case for other areas),
invokes a particular method in the renderer of choice, e.g.
<CODE><FONT face="courier, monospaced">renderPage()</FONT></CODE>.
<B>NOTE</B>: this system is bypassed for <B>Page</B>, incidentally.
</P>

<P>
Rendering will not be discussed further in this document, as most of our
current effort must concentrate on layout. Section 4.12 in the XSL WD
discusses some issues applicable to rendering.
</P>
</FONT></TD></TR></TABLE><BR>

</TD></TR></TABLE></TD></TR></TABLE><BR><TABLE border="0" cellpadding="0" cellspacing="0" width="620"><TR><TD bgcolor="#0086b2"><IMG height="1" src="images/dot.gif" width="1"></TD></TR><TR><TD align="center"><FONT color="#0086b2" size="-1"><I>
Copyright &copy; 1999 The Apache Software Foundation.
All Rights Reserved.
</I></FONT></TD></TR></TABLE></BODY></HTML>

Loading…
Cancel
Save