3. Retrieving a property value

3.1. Overview

For all FO types the FO spec specifies a large number of property types for which the user may specify a value in order to modify the resulting layout of the document. Many of these properties have a default value, many others inherit their value from the parent FO if they are not specified. In principle the layout process must retrieve the value of each possible property type of an FO node in order to determine the appropriate value of the corresponding trait.

Retrieving a property value goes through these steps:

  • First determine if the property value was specified in one or other way. This is done in the method propertyMaker.findProperty

    • if this property has a corresponding property and if the corresponding property is forced, i.e. if this property is relative and if a value for the corresponding property was explicitly specified, compute and return it.

    • else

      • if a value for this property was explicitly specified, compute and return it

      • else if this property has a corresponding property, compute its value; if it is not null return it

      • else if a value for a relevant shorthand property was specified, compute and return it

      • else if this property is inheritable, find it at the parent; this repeats the whole process on the parent, and possibly its parents, up to the root node; if successful, return the found property value

  • If no property value is found, a default property value object is made; the default value is stored in the property maker as defaultValue:

    • if the default property value object was calculated earlier, it was cached as defaultProperty; return it

    • else make it in the same way as property value objects are made when the FO tree is constructed, in propertyMaker.make.

Compute corresponding, as used in findProperty, proceeds as follows:

  • use parent's property list or this property list?

  • check explicit or shorthand for corresponding

  • convert property

PropertyManager, CommonBorderAndPadding, CommonBackground, CommonMarginBlock, CommonHyphenation are convenience classes used in the calculation of the traits. PropertyManager has methods to return objects of these types. A CommonBorderAndPadding object and a CommonHyphenation object are cached. A CommonBackground object and a CommonMarginBlock object are calculated when requested. Similarly for many other convenience classes Common* for which PropertyManager can return an object. These classes are in package fo.properties. Similar classes called *Props are in package traits. Of these PropertyManager can only return a BlockProps object.