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.

properties.xml 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?xml version="1.0" standalone="no"?>
  2. <!-- Overview -->
  3. <document>
  4. <header>
  5. <title>Properties</title>
  6. <subtitle>All you wanted to know about the Properties !</subtitle>
  7. <authors> <person name="Keiron Liddle" email="keiron@aftexsw.com"/>
  8. </authors>
  9. </header>
  10. <body><s1 title="Property Handling">
  11. <p>During XML Parsing, the FO tree is constructed. For each FO object (some
  12. subclass of FObj), the tree builder then passes the list of all
  13. attributes specified on the FO element to the handleAttrs method. This
  14. method converts the attribute specifications into a PropertyList.</p>
  15. <p>The actual work is done by a PropertyListBuilder (PLB for short). The
  16. basic idea of the PLB is to handle each attribute in the list in turn,
  17. find an appropriate "Maker" for it, call the Maker to convert the
  18. attribute value into a Property object of the correct type, and store
  19. that Property in the PropertyList.</p>
  20. <s2 title="Finding a Maker">
  21. <p>
  22. The PLB finds a "Maker" for the property based on the attribute name and
  23. the element name. Most Makers are generic and handle the attribute on
  24. any element, but it's possible to set up an element-specific property
  25. Maker. The attribute name to Maker mappings are automatically created
  26. during the code generation phase by processing the XML property
  27. description files.</p>
  28. </s2>
  29. <s2 title="Processing the attribute list">
  30. <p>The PLB first looks to see if the font-size property is specified, since
  31. it sets up relative units which can be used in other property
  32. specifications. Each attribute is then handled in turn. If the attribute
  33. specifies part of a compound property such as space-before.optimum, the
  34. PLB looks to see if the attribute list also contains the "base" property
  35. (space-before in this case) and processes that first.</p></s2>
  36. <s2 title="How the Property Maker works"><p>There is a family of Maker objects for each of the property datatypes,
  37. such as Length, Number, Enumerated, Space, etc. But since each Property
  38. has specific aspects such as whether it's inherited, its default value,
  39. its corresponding properties, etc. there is usually a specific Maker for
  40. each Property. All these Maker classes are created during the code
  41. generation phase by processing (using XSLT) the XML property description
  42. files to create Java classes.</p>
  43. <p>The Maker first checks for "keyword" values for a property. These are
  44. things like "thin, medium, thick" for the border-width property. The
  45. datatype is really a Length but it can be specified using these keywords
  46. whose actual value is determined by the "User Agent" rather than being
  47. specified in the XSL standard. For FOP, these values are currently
  48. defined in foproperties.xml. The keyword value is just a string, so it
  49. still needs to be parsed as described next.</p>
  50. <p>The Maker also checks to see if the property is an Enumerated type and
  51. then checks whether the value matches one of the specified enumeration
  52. values.</p>
  53. <p>Otherwise the Maker uses the property parser in the fo.expr package to
  54. evaluate the attribute value and return a Property object. The parser
  55. interprets the expression language and performs numeric operations and
  56. function call evaluations.</p>
  57. <p>If the returned Property value is of the correct type (specificed in
  58. foproperties.xml, where else?), the Maker returns it. Otherwise, it may
  59. be able to convert the returned type into the correct type.</p>
  60. <p>Some kinds of property values can't be fully resolved during FO tree
  61. building because they depend on layout information. This is the case of
  62. length values specified as percentages and of the special
  63. proportional-column-width(x) specification for table-column widths.
  64. These are stored as special kinds of Length objects which are evaluated
  65. during layout. Expressions involving "em" units which are relative to
  66. font-size _are_ resolved during the FO tree building however.</p></s2>
  67. <s2 title="Structure of the PropertyList">
  68. <p>The PropertyList extends HashMap and its basic function is to associate
  69. Property value objects with Property names. The Property objects are all
  70. subclasses of the base Property class. Each one simply contains a
  71. reference to one of the property datatype objects. Property provides
  72. accessors for all known datatypes and various subclasses override the
  73. accessor(s) which are reasonable for the datatype they store.</p>
  74. <p>The PropertyList itself provides various ways of looking up Property
  75. values to handle such issues as inheritance and corresponding
  76. properties. </p>
  77. <p>The main logic is:<br/>If the property is a writing-mode relative property (using start, end,
  78. before or after in its name), the corresponding absolute property value
  79. is returned if it's explicitly set on this FO. <br/>Otherwise, the
  80. writing-mode relative value is returned if it's explicitly set. If the
  81. property is inherited, the process repeats using the PropertyList of the
  82. FO's parent object. (This is easy because each PropertyList points to
  83. the PropertyList of the nearest ancestor FO.) If the property isn't
  84. inherited or no value is found at any level, the initial value is
  85. returned.</p></s2>
  86. <s2 title="References">
  87. <dl><dt>docs/design/properties.xml</dt> <dd>a more detailed version of this (generated
  88. html in docs/html-docs/design/properties.html)</dd>
  89. <dt>src/codegen/properties.dtd</dt> <dd>heavily commented DTD for foproperties.xml,
  90. but may not be completely up-to-date</dd></dl></s2>
  91. <s2 title="To Do"> <s3 title="documentation">
  92. <ul><li>explain PropertyManager vs. direct access</li>
  93. <li>Explain corresponding properties</li></ul></s3>
  94. <s3 title="development">
  95. <p>Lots of properties are incompletely handled, especially funny kinds of
  96. keyword values and shorthand values (one attribute which sets several
  97. properties)</p></s3></s2>
  98. </s1>
  99. </body></document>