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.

simple-properties.html 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  5. <title>Simple &lt;property&gt; Classes</title>
  6. <link type="text/css" href="../../../page.css" rel="stylesheet">
  7. </head>
  8. <body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" text="#000000" bgcolor="#FFFFFF">
  9. <div class="content">
  10. <h1>Simple &lt;property&gt; Classes</h1>
  11. <p>
  12. <font size="-2">by&nbsp;Peter B. West</font>
  13. </p>
  14. <ul class="minitoc">
  15. <li>
  16. <a href="#N10014">Introduction</a>
  17. </li>
  18. <li>
  19. <a href="#N10026">Common data</a>
  20. </li>
  21. <li>
  22. <a href="#N10075">Accessing &lt;property&gt; Data Constants</a>
  23. </li>
  24. </ul>
  25. <a name="N10014"></a>
  26. <h3>Introduction</h3>
  27. <p>
  28. An <a href="classes-overview.html">overview of the properties
  29. and classes</a> involved in handling properties has already
  30. been given. This discussion will go in detail into the way
  31. data are represented within properties. Iit is important to
  32. keep in mind that the primary avenue of access to the data and
  33. the methods of property classes is the <a href=
  34. "javascript:window.top.displayCode(
  35. 'PropertyConsts.html#PropertyConstsClass' )" ><span
  36. class="codefrag">PropertyConsts</span></a> class and its
  37. singleton object.
  38. </p>
  39. <a name="N10026"></a>
  40. <h3>Common data</h3>
  41. <p>
  42. <a href= "javascript:window.top.displayCode( 'Character.html' )" ><span
  43. class="codefrag">org.apache.fop.fo.properties.Character</span></a>
  44. is an example of a basic property class. The data fields
  45. common to all properties are:
  46. </p>
  47. <dl>
  48. <dt>
  49. <span class="codefrag">final int dataTypes</span>
  50. </dt>
  51. <dd>
  52. This field defines the allowable data types which may be
  53. assigned to the property. The value is chosen from the data
  54. type constants defined in <a href=
  55. "javascript:window.top.displayCode( 'Property.html#NOTYPE' )"
  56. ><span
  57. class="codefrag">org.apache.fop.fo.properties.Property</span></a>,
  58. and may consist of more than one of those constants,
  59. bit-ORed together.
  60. </dd>
  61. <dt>
  62. <span class="codefrag">final int traitMapping</span>
  63. </dt>
  64. <dd>
  65. This field defines the mapping of properties to traits in
  66. the <span class="codefrag">Area tree</span>. The value is
  67. chosen from the trait mapping constants defined in <a href=
  68. "javascript:window.top.displayCode( 'Property.html#NO_TRAIT' )"
  69. ><span
  70. class="codefrag">org.apache.fop.fo.properties.Property</span></a>,
  71. and may consist of more than one of those constants,
  72. bit-ORed together.
  73. </dd>
  74. <dt>
  75. <span class="codefrag">final int initialValueType</span>
  76. </dt>
  77. <dd>
  78. This field defines the data type of the initial value
  79. assigned to the property. The value is chosen from the
  80. initial value type constants defined in <a href=
  81. "javascript:window.top.displayCode( 'Property.html#NOTYPE_IT' )"
  82. ><span
  83. class="codefrag">org.apache.fop.fo.properties.Property</span></a>.
  84. In the simplest property classes, such as <span
  85. class="codefrag">Character</span>, there is no defined
  86. initial value type.
  87. </dd>
  88. <dt>
  89. <span class="codefrag">final int inherited</span>
  90. </dt>
  91. <dd>
  92. This field defines the kind of inheritance applicable to the
  93. property. The value is chosen from the inheritance
  94. constants defined in <a href=
  95. "javascript:window.top.displayCode( 'Property.html#NO' )" ><span
  96. class="codefrag">org.apache.fop.fo.properties.Property</span></a>.
  97. </dd>
  98. </dl>
  99. <a name="N10075"></a>
  100. <h3>Accessing &lt;property&gt; Data Constants</h3>
  101. <p>
  102. The constants above are generally accessed through the arrays
  103. maintained in the <a href= "javascript:window.top.displayCode(
  104. 'PropertyConsts.html#PropertyConstsClass' )" ><span
  105. class="codefrag">PropertyConsts</span></a> singleton <a href=
  106. "javascript:window.top.displayCode( 'PropertyConsts.html#pconsts'
  107. )" ><span class="codefrag">pconsts</span></a>. The first
  108. invocation of the method <a href=
  109. "javascript:window.top.displayCode(
  110. 'PropertyConsts.html#setupProperty' )" ><span
  111. class="codefrag">setupProperty</span></a> on the property
  112. generates a <span class="codefrag">Class</span> instance for
  113. the class, and stores it in the array <a href=
  114. "javascript:window.top.displayCode( 'PropertyConsts.html#classes'
  115. )" ><span class="codefrag">classes</span></a>. This <span
  116. class="codefrag">Class</span> object is used, in turn, to
  117. instantiate the singleton instance of the class, which is
  118. stored in the <a href= "javascript:window.top.displayCode(
  119. 'PropertyConsts.html#properties' )" ><span
  120. class="codefrag">Property[] properties</span></a> array of <a
  121. href= "javascript:window.top.displayCode(
  122. '../PropertyConsts.html#pconsts' )" ><span
  123. class="codefrag">pconsts</span></a>.
  124. </p>
  125. <p>
  126. <em>Reflection</em> methods are then used, via the same <span
  127. class="codefrag">Class</span> instance, to extract and store
  128. the static data fields. These arrays and associated access
  129. methods are:
  130. </p>
  131. <dl>
  132. <dt>
  133. <a href= "javascript:window.top.displayCode(
  134. 'PropertyConsts.html#datatypes' )" ><span
  135. class="codefrag">int[] datatypes</span></a>
  136. </dt>
  137. <dd>
  138. <a href= "javascript:window.top.displayCode(
  139. 'PropertyConsts.html#getDataTypes' )" ><span
  140. class="codefrag">int getDataTypes(int)</span></a>
  141. </dd>
  142. <dt>
  143. <a href= "javascript:window.top.displayCode(
  144. 'PropertyConsts.html#traitMappings' )" ><span
  145. class="codefrag">int[] traitMappings</span></a>
  146. </dt>
  147. <dd>
  148. <em>No access method yet defined.</em>
  149. </dd>
  150. <dt>
  151. <a href= "javascript:window.top.displayCode(
  152. 'PropertyConsts.html#initialValueTypes' )" ><span
  153. class="codefrag">int[] initialValueTypes</span></a>
  154. </dt>
  155. <dd>
  156. <a href= "javascript:window.top.displayCode(
  157. 'PropertyConsts.html#getInitialValueType' )" ><span
  158. class="codefrag">int getInitialValueType(int)</span></a>
  159. </dd>
  160. <dt>
  161. <a href= "javascript:window.top.displayCode(
  162. 'PropertyConsts.html#inherited' )" ><span
  163. class="codefrag">int[] inherited</span></a>
  164. </dt>
  165. <dd>
  166. <a href= "javascript:window.top.displayCode(
  167. 'PropertyConsts.html#inheritance' )" ><span
  168. class="codefrag">int inheritance(int)</span></a>
  169. </dd>
  170. </dl>
  171. <p>
  172. <strong>Previous:</strong> <a href = "PropertyConsts-class.html"
  173. >PropertyConsts class</a>
  174. </p>
  175. <p>
  176. <strong>Next:</strong> <a href= "getInitialValue.html"
  177. >getInitialValue()</a>
  178. </p>
  179. </div>
  180. <table summary="footer" cellspacing="0" cellpadding="0" width="100%" height="20" border="0">
  181. <tr>
  182. <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1"
  183. width="1" alt="" src="../../../skin/images/spacer.gif"><a
  184. href="../../../skin/images/label.gif"></a><a
  185. href="../../../skin/images/page.gif"></a><a
  186. href="../../../skin/images/chapter.gif"></a><a
  187. href="../../../skin/images/chapter_open.gif"></a><a
  188. href="../../../skin/images/current.gif"></a><a
  189. href="../../..//favicon.ico"></a></td>
  190. </tr>
  191. <tr>
  192. <td colspan="2" bgcolor="#CFDCED" class="copyright"
  193. align="center"><font size="2" face="Arial, Helvetica,
  194. Sans-Serif">Copyright &copy; 1999-2002&nbsp;The Apache
  195. Software Foundation. All rights reserved.<script
  196. type="text/javascript" language="JavaScript"><!--
  197. document.write(" - "+"Last Published: " +
  198. document.lastModified); // --></script></font></td>
  199. </tr>
  200. <tr>
  201. <td align="left" bgcolor="#CFDCED" class="logos"></td><td
  202. align="right" bgcolor="#CFDCED" class="logos"></td>
  203. </tr>
  204. </table>
  205. </body>
  206. </html>