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.2KB

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