You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

architecture.html 30KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <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>
  2. <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>
  3. <IMG border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR>
  4. <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>
  5. <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>
  6. <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>
  7. <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>
  8. <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>
  9. <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>
  10. <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>
  11. <IMG border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR>
  12. <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>
  13. <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>
  14. <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>
  15. <IMG alt="Architecture" border="0" height="12" hspace="0" src="graphics/architecture-label-1.jpg" vspace="0" width="120"><BR>
  16. <IMG border="0" height="6" hspace="0" src="resources/separator.gif" vspace="0" width="120"><BR>
  17. <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>
  18. <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>
  19. <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>
  20. <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>
  21. <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">
  22. <P>
  23. The overall process is controlled by <B>org.apache.fop.apps.Driver</B>. In
  24. this class, a typical sequence is:</P>
  25. <P><CODE><FONT face="courier, monospaced">Driver driver = new Driver();</FONT></CODE></P>
  26. <P><CODE><FONT face="courier, monospaced">driver.setRenderer(&quot;org.apache.fop.render.pdf.PDFRenderer&quot;, version);</FONT></CODE></P>
  27. <P><CODE><FONT face="courier, monospaced">driver.addElementMapping(&quot;org.apache.fop.fo.StandardElementMapping&quot;);</FONT></CODE></P>
  28. <P><CODE><FONT face="courier, monospaced">driver.addElementMapping(&quot;org.apache.fop.svg.SVGElementMapping&quot;);</FONT></CODE></P>
  29. <P><CODE><FONT face="courier, monospaced">driver.setWriter(new PrintWriter(new FileWriter(args[1])));</FONT></CODE></P>
  30. <P></P>
  31. <P><CODE><FONT face="courier, monospaced">driver.buildFOTree(parser, fileInputSource(args[0]));</FONT></CODE></P>
  32. <P></P>
  33. <P><CODE><FONT face="courier, monospaced">driver.format();</FONT></CODE></P>
  34. <P></P>
  35. <P><CODE><FONT face="courier, monospaced">driver.render();</FONT></CODE></P>
  36. </FONT></TD></TR></TABLE><BR>
  37. <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">
  38. <P>The class <B>org.apache.fop.fo.FOTreeBuilder</B> is responsible for actually
  39. constructing the FO tree. The key SAX events used are </P>
  40. <P><CODE><FONT face="courier, monospaced">startElement()</FONT></CODE>,</P>
  41. <P><CODE><FONT face="courier, monospaced">endElement()</FONT></CODE> and <CODE><FONT face="courier, monospaced">characters()</FONT></CODE>.</P>
  42. <P>All formatting objects derive from abstract class
  43. <B>org.apache.fop.fo.FONode</B>. The other FO classes inherit from
  44. <B>FONode</B> as follows:</P>
  45. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FONode</FONT></CODE></P>
  46. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|</FONT></CODE></P>
  47. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__________|________</FONT></CODE></P>
  48. <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>
  49. <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>
  50. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;|</FONT></CODE></P>
  51. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp;|___________________</FONT></CODE></P>
  52. <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>
  53. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;FObjMixed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SequenceSpecifier
  54. </FONT></CODE></P>
  55. <P>FO's extending FObj:</P>
  56. <P>Package org.apache.fop.fo.pagination:</P>
  57. <P><CODE><FONT face="courier, monospaced"> LayoutMasterSet</FONT></CODE></P>
  58. <P><CODE><FONT face="courier, monospaced"> PageSequence</FONT></CODE></P>
  59. <P><CODE><FONT face="courier, monospaced"> RegionAfter</FONT></CODE></P>
  60. <P><CODE><FONT face="courier, monospaced"> RegionBefore</FONT></CODE></P>
  61. <P><CODE><FONT face="courier, monospaced"> RegionBody</FONT></CODE></P>
  62. <P><CODE><FONT face="courier, monospaced"> Root</FONT></CODE></P>
  63. <P><CODE><FONT face="courier, monospaced"> SequenceSpecification</FONT></CODE></P>
  64. <P><CODE><FONT face="courier, monospaced"> SimplePageMaster</FONT></CODE></P>
  65. <P>Package org.apache.fop.fo.flow:</P>
  66. <P><CODE><FONT face="courier, monospaced">BlockContainer</FONT></CODE></P>
  67. <P><CODE><FONT face="courier, monospaced">DisplayGraphic</FONT></CODE></P>
  68. <P><CODE><FONT face="courier, monospaced">DisplayRule</FONT></CODE></P>
  69. <P><CODE><FONT face="courier, monospaced">DisplaySequence</FONT></CODE></P>
  70. <P><CODE><FONT face="courier, monospaced">Flow</FONT></CODE></P>
  71. <P><CODE><FONT face="courier, monospaced">InlineGraphic</FONT></CODE></P>
  72. <P><CODE><FONT face="courier, monospaced">ListBlock</FONT></CODE></P>
  73. <P><CODE><FONT face="courier, monospaced">ListItem</FONT></CODE></P>
  74. <P><CODE><FONT face="courier, monospaced">ListItemBody</FONT></CODE></P>
  75. <P><CODE><FONT face="courier, monospaced">ListItemLabel</FONT></CODE></P>
  76. <P><CODE><FONT face="courier, monospaced">PageNumber</FONT></CODE></P>
  77. <P><CODE><FONT face="courier, monospaced">StaticContent</FONT></CODE></P>
  78. <P><CODE><FONT face="courier, monospaced">Table</FONT></CODE></P>
  79. <P><CODE><FONT face="courier, monospaced">TableBody</FONT></CODE></P>
  80. <P><CODE><FONT face="courier, monospaced">TableCell</FONT></CODE></P>
  81. <P><CODE><FONT face="courier, monospaced">TableColumn</FONT></CODE></P>
  82. <P><CODE><FONT face="courier, monospaced">TableRow</FONT></CODE></P>
  83. <P>FO's extending SequenceSpecifier:</P>
  84. <P>Package org.apache.fop.fo.pagination:</P>
  85. <P><CODE><FONT face="courier, monospaced">SequenceSpecifierAlternating</FONT></CODE></P>
  86. <P><CODE><FONT face="courier, monospaced">SequenceSpecifierRepeating</FONT></CODE></P>
  87. <P><CODE><FONT face="courier, monospaced">SequenceSpecifierSingle</FONT></CODE></P>
  88. <P>FO's extending FObjMixed:</P>
  89. <P>Package org.apache.fop.fo.flow:</P>
  90. <P><CODE><FONT face="courier, monospaced">Block</FONT></CODE></P>
  91. <P><CODE><FONT face="courier, monospaced">InlineSequence</FONT></CODE></P>
  92. <P><CODE><FONT face="courier, monospaced">SimpleLink</FONT></CODE></P>
  93. </FONT></TD></TR></TABLE><BR>
  94. <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">
  95. <P>
  96. The class inheritance described above only describes the nature of the
  97. content. Every FO in FOP also has a parent, and a Vector of children. The
  98. parent attribute (in the Java sense), in particular, is used to enforce
  99. constraints required by the FO hierarchy.
  100. </P>
  101. <P>
  102. FONode, among other things, ensures that FO's have a parent, that they
  103. have children, that they maintain a marker of where the layout was up to
  104. (for FObj's it is the child number, and for FOText's it is the character
  105. number), and that they have a <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method.
  106. </P>
  107. </FONT></TD></TR></TABLE><BR>
  108. <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">
  109. <P>
  110. Every FO class has code that looks something like this:
  111. </P>
  112. <P><CODE><FONT face="courier, monospaced">public static class Maker extends FObj.Maker {</FONT></CODE></P>
  113. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; public FObj make(FObj parent, PropertyList propertyList)</FONT></CODE></P>
  114. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp; throws FOPException</FONT></CODE></P>
  115. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; {</FONT></CODE></P>
  116. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp; return new SimplePageMaster(parent, propertyList);</FONT></CODE></P>
  117. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; }</FONT></CODE></P>
  118. <P><CODE><FONT face="courier, monospaced">}</FONT></CODE></P>
  119. <P>
  120. The class also has a static method that resembles
  121. </P>
  122. <P><CODE><FONT face="courier, monospaced">public static FObj.Maker maker()</FONT></CODE></P>
  123. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; {</FONT></CODE></P>
  124. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp;&nbsp;&nbsp; return new PageSequence.Maker();</FONT></CODE></P>
  125. <P><CODE><FONT face="courier, monospaced">&nbsp;&nbsp; }</FONT></CODE></P>
  126. <P>
  127. A hash 'fobjTable' exists in <B>FOTreeBuilder</B>, and maps the FO names (such as
  128. 'fo:table') to object references to the appropriate factories
  129. (such as <B>Table.Maker</B>).
  130. </P>
  131. <P>
  132. Properties (recall that FO's have properties, areas have traits, and XML
  133. nodes have attributes) are also a concern of <B>FOTreeBuilder</B>. It
  134. accomplishes this by using <B>PropertyListBuilder</B>, which contains a hash of
  135. property names and <I>their</I> respective makers. The base class for
  136. properties is <B>Property</B>, and the property makers extend
  137. <B>Property.Maker</B>.
  138. </P>
  139. </FONT></TD></TR></TABLE><BR>
  140. <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">
  141. <P>
  142. <B>FOTreeBuilder</B> calls <CODE><FONT face="courier, monospaced">format()</FONT></CODE> on the root FO, passing
  143. it the <B>AreaTree</B>
  144. reference. In turn, <B>Root</B> calls <CODE><FONT face="courier, monospaced">format()</FONT></CODE> on each
  145. <B>PageSequence</B>, passing <I>it</I>
  146. the <B>AreaTree</B> reference.
  147. </P>
  148. <P>
  149. The <B>PageSequence</B> <CODE><FONT face="courier, monospaced">format()</FONT></CODE> method does the following things:
  150. </P>
  151. <OL>
  152. <LI>Makes a <B>Page</B>, using <B>PageMasterFactory</B> to produce a
  153. <B>PageMaster</B>, and
  154. using <CODE><FONT face="courier, monospaced">makePage()</FONT></CODE> in the latter class. In the simplest picture,
  155. a <B>Page</B> has
  156. 5 areas represented by <B>AreaContainers</B>;</LI>
  157. <LI>Handles layout for <B>StaticContent</B> objects in the 'before' and 'after'
  158. regions, if set. This uses the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method in
  159. <B>StaticContent</B>;</LI>
  160. <LI>If a page break is not forced, it will continue to layout the flow into
  161. the body area (<B>AreaContainer</B>) of the current page;</LI>
  162. <LI>It continues with (1) when layout into the current page is done, but
  163. the flow is not empty.</LI>
  164. </OL>
  165. </FONT></TD></TR></TABLE><BR>
  166. <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">
  167. <P>
  168. FO's that represent actual areas, starting with <B>Flow</B> and
  169. <B>StaticContent</B>, have
  170. a <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method, with the following signature:
  171. </P>
  172. <P>
  173. <CODE><FONT face="courier, monospaced">
  174. public Status layout(Area area)
  175. </FONT></CODE>
  176. </P>
  177. <P>
  178. The fundamental role of the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method is to manage the layout of
  179. children and/or to generate new areas.
  180. </P>
  181. <P>
  182. <B>Example</B>: the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method for <B>Flow</B> generates no new areas - it manages the
  183. layout of the flow children.
  184. </P>
  185. <P>
  186. <B>Example</B>: the <CODE><FONT face="courier, monospaced">layout()</FONT></CODE> method for <B>Block</B>
  187. generates a new <B>BlockArea</B> in and of
  188. itself, and also manages the layout of the block children, which are added
  189. to the <B>BlockArea</B> before that is itself added to its parent
  190. <B>Area</B>.
  191. </P>
  192. <P>
  193. <CODE><FONT face="courier, monospaced">Layout()</FONT></CODE> methods are subject to the general constraint that possibly not
  194. all of their children can be accommodated, and they report back accordingly
  195. with an appropriate <B>Status</B>.
  196. </P>
  197. </FONT></TD></TR></TABLE><BR>
  198. <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">
  199. <P>
  200. This is a separate process. The <CODE><FONT face="courier, monospaced">render()</FONT></CODE> method in
  201. <B>Driver</B> is invoked (say,
  202. by <B>CommandLine</B>) with the laid-out <B>AreaTree</B> and a
  203. <B>PrintWriter</B> as arguments.
  204. This actually calls the <CODE><FONT face="courier, monospaced">render()</FONT></CODE> method in a specific implementation of
  205. the <B>Renderer</B> interface, typically <B>PDFRenderer</B> or
  206. <B>AWTRenderer</B>.
  207. </P>
  208. <P>
  209. At the highest level <B>PDFRenderer</B>, for example, begins by rendering each
  210. <B>Page</B>. The <CODE><FONT face="courier, monospaced">render()</FONT></CODE> method in <B>Page</B> (as is the case for other areas),
  211. invokes a particular method in the renderer of choice, e.g.
  212. <CODE><FONT face="courier, monospaced">renderPage()</FONT></CODE>.
  213. <B>NOTE</B>: this system is bypassed for <B>Page</B>, incidentally.
  214. </P>
  215. <P>
  216. Rendering will not be discussed further in this document, as most of our
  217. current effort must concentrate on layout. Section 4.12 in the XSL WD
  218. discusses some issues applicable to rendering.
  219. </P>
  220. </FONT></TD></TR></TABLE><BR>
  221. </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>
  222. Copyright &copy; 1999 The Apache Software Foundation.
  223. All Rights Reserved.
  224. </I></FONT></TD></TR></TABLE></BODY></HTML>