123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <!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>
- <link type="text/css" href="../../../page.css" rel="stylesheet">
- </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:window.top.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:window.top.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:window.top.displayCode(
- 'PropertyConsts.html#PropertyConstsClass' )" ><span
- class="codefrag">PropertyConsts</span></a> singleton <a href=
- "javascript:window.top.displayCode( 'PropertyConsts.html#pconsts'
- )" ><span class="codefrag">pconsts</span></a>.` As with the
- fields, the first invocation of the method <a href=
- "javascript:window.top.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:window.top.displayCode(
- 'PropertyConsts.html#properties' )" ><span
- class="codefrag">Property[] properties</span></a> array of <a
- href= "javascript:window.top.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:window.top.displayCode(
- 'PropertyConsts.html#getInitialValue' )" ><span
- class="codefrag">PropertyValue getInitialValue(int)</span></a>
- in <a href= "javascript:window.top.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:window.top.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:window.top.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:window.top.displayCode(
- 'Property.html#PropertyClass' )" ><span
- class="codefrag">Property</span></a> provides a base <a href=
- "javascript:window.top.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>
|