pbwest 2003/01/20 06:55:02 Added: src/documentation/content/design/alt.design/properties getInitialValue.html Log: Code documentation Revision Changes Path 1.1 xml-fop/src/documentation/content/design/alt.design/properties/getInitialValue.html Index: getInitialValue.html =================================================================== <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Generating Initial Values</title> <style type= "text/css" > span.codeDisplay {font:italic bold} body { font-family: Verdana, Helvetica, sans-serif; } .note { border: solid 1px #7099C5; background-color: #f0f0ff; } .note .label { background-color: #7099C5; color: #ffffff; } .content { padding: 5px 5px 5px 10px; font : Verdana, Helvetica, sans-serif; font-size : 90%; } </style> </head> <body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" text="#000000" bgcolor="#FFFFFF"> <div class="content"> <h1>Generating Initial Values</h1> <p> <font size="-2">by Peter B. West</font> </p> <ul class="minitoc"> <li> <a href="#N10014">Introduction</a> </li> <li> <a href="#N10021"> Generating & Accessing Initial Values </a> <ul class="minitoc"> <li> <a href="#N10062">Properties without getInitialValue()</a> </li> </ul> </li> </ul> <a name="N10014"></a> <h3>Introduction</h3> <p> The <a href="simple-properties.html">previous section</a> discussed the common data elements in the simplest examples of property classes. This section discusses more complex classes whose facilities are accessed only through various methods. </p> <a name="N10021"></a> <h3> Generating & Accessing Initial Values </h3> <p> <a href= "javascript:parent.displayCode( 'AutoRestore.html' )" ><span class="codefrag" >org.apache.fop.fo.properties.AutoRestore</span></a> is an example of the next most complex property class. In addition to all of the common static fields, these classes have initial data value types which require the dynamic generation of a PropertyValue instance. </p> <p> The method <a href= "javascript:parent.displayCode( 'AutoRestore.html#getInitialValue' )" ><span class="codefrag">PropertyValue getInitialValue(int)</span></a> returns an instance of PropertyValue of the appropriate subclass containing the initial value for this property. Like the static data fields, this value is, in turn, stored in the array of initial values maintained in the <a href= "javascript:parent.displayCode( 'PropertyConsts.html#PropertyConstsClass' )" ><span class="codefrag">PropertyConsts</span></a> singleton <a href= "javascript:parent.displayCode( 'PropertyConsts.html#pconsts' )" ><span class="codefrag">pconsts</span></a>.` As with the fields, the first invocation of the method <a href= "javascript:parent.displayCode( 'PropertyConsts.html#setupProperty' )" ><span class="codefrag">setupProperty</span></a> on the property instantiates the singleton instance of the class, and stores that instance in the in the <a href= "javascript:parent.displayCode( 'PropertyConsts.html#properties' )" ><span class="codefrag">Property[] properties</span></a> array of <a href= "javascript:parent.displayCode( 'PropertyConsts.html#pconsts' )" ><span class="codefrag">pconsts</span></a>. </p> <p> Unlike the static data fields, however, the initial value is not immediately generated. It is generated by a call to <a href= "javascript:parent.displayCode( 'PropertyConsts.html#getInitialValue' )" ><span class="codefrag">PropertyValue getInitialValue(int)</span></a> in <a href= "javascript:parent.displayCode( 'PropertyConsts.html#pconsts' )" ><span class="codefrag">pconsts</span></a>. This call, in turn, locates the relevant instance of the particular property class in the <a href= "javascript:parent.displayCode( 'PropertyConsts.html#properties' )" ><span class= "codefrag" >properties</span> array of <span class= "codefrag" >PropertyConsts</span></a>, and invokes the <span class= "codefrag" >getInitialValue()</span> of that instance. A side-effect of this call is to store the initial value in <a href= "javascript:parent.displayCode( 'PropertyConsts.html#initialValues' )" ><span class="codefrag">PropertyValue[] initialValues</span></a>. </p> <a name="N10062"></a> <h4>Properties without getInitialValue()</h4> <p> What about property classes which have no <span class="codefrag">getInitialValue()</span> method? The simplest classes, e.g. <span class="codefrag">Character</span>, fall into this category. As <a href="classes-overview.html#property-classes">noted previously</a>, all of the property classes extend <span class="codefrag">org.apache.fop.fo.properties.Property</span>. <a href= "javascript:parent.displayCode( 'Property.html#PropertyClass' )" ><span class="codefrag">Property</span></a> provides a base <a href= "javascript:parent.displayCode( 'Property.html#getInitialValue' )" ><span class="codefrag">PropertyValue getInitialValue(int)</span></a> method to which the simple classes fall back. Note that it is only valid for <span class="codefrag">NOTYPE_IT</span>, <span class="codefrag">AUTO_IT</span>, <span class="codefrag">NONE_IT</span> and <span class="codefrag">AURAL_IT</span> initial value types, so all classes which have any other initial value type must override this method. </p> <p> <strong>Previous:</strong> <a href = "simple-properties.html" >Simple property classes</a> </p> <p> <strong>Next:</strong> <a href= "enumerated-values.html" >Enumerated values</a> </p> </div> <table summary="footer" cellspacing="0" cellpadding="0" width="100%" height="20" border="0"> <tr> <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../../skin/images/spacer.gif"><a href="../../../skin/images/label.gif"></a><a href="../../../skin/images/page.gif"></a><a href="../../../skin/images/chapter.gif"></a><a href="../../../skin/images/chapter_open.gif"></a><a href="../../../skin/images/current.gif"></a><a href="../../..//favicon.ico"></a></td> </tr> <tr> <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright © 1999-2002 The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!-- document.write(" - "+"Last Published: " + document.lastModified); // --></script></font></td> </tr> <tr> <td align="left" bgcolor="#CFDCED" class="logos"></td><td align="right" bgcolor="#CFDCED" class="logos"></td> </tr> </table> </body> </html>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]