3.3. Examples: Retrieving border and padding values

In this section we follow in detail how the border and padding values for the body region are retrieved. The relevant part of the input FO file is:

<fo:simple-page-master master-name="simpleA4" margin="4pt">
<fo:region-body margin="4pt+20%" border="3pt solid black"
  border-before-width="2pt" border-right-width="4pt"
  border-start-width="inherit"/>
</fo:simple-page-master>

This section was written after I added the cache to the look-up of property values.

3.3.1. Retrieving the margin-top value on region-body

This what we are retrieving:

 propertyList.getFOName() = "fo:region-body"
 org.apache.fop.fo.FOPropertyMapping.getPropertyName(propId) = "margin-top"

The margin values are retrieved by the method PropertyManager.getMarginProps. This is the call stack that leads up to it and on to the retrieval of the value of margin-top:

  [1] org.apache.fop.fo.properties.PropertyMaker.findProperty (PropertyMaker.java:240)
  [2] org.apache.fop.fo.PropertyList.findProperty (PropertyList.java:289)
  [3] org.apache.fop.fo.properties.PropertyMaker.get (PropertyMaker.java:291)
  [4] org.apache.fop.fo.PropertyList.get (PropertyList.java:261)
  [5] org.apache.fop.fo.PropertyList.get (PropertyList.java:247)
  [6] org.apache.fop.fo.PropertyManager.getMarginProps (PropertyManager.java:264)
  [7] org.apache.fop.fo.pagination.RegionBody.getViewportRectangle (RegionBody.java:58)
  [8] org.apache.fop.layoutmgr.PageLayoutManager.makeRegionViewport (PageLayoutManager.java:811)
  [9] org.apache.fop.layoutmgr.PageLayoutManager.createPageAreas (PageLayoutManager.java:784)
  [10] org.apache.fop.layoutmgr.PageLayoutManager.createPage (PageLayoutManager.java:721)
  [11] org.apache.fop.layoutmgr.PageLayoutManager.makeNewPage (PageLayoutManager.java:441)
  [12] org.apache.fop.layoutmgr.PageLayoutManager.doLayout (PageLayoutManager.java:191)

The retrieval proceeds as follows:

  • PropertyList.findProperty: Is the value in the cache? No.

  • PropertyMaker.findProperty: corresponding != null? No.

  • PropertyMaker.findProperty: Is this property explicitly specified? No.

  • PropertyMaker.findProperty: Can the corresponding property be computed? No, there is no corresponding property.

  • PropertyMaker.findProperty: Is a shorthand property for this property specified? Yes, margin is a shorthand for it. The property value is retrieved as:

     listprop = "[(4000mpt +20.0%)]"
    

    It is a list property as are all shorthand properties. The value for margin-top is extracted from it as:

     p = "(4000mpt +20.0%)"
    

  • PropertyList.findProperty: Add the value to the cache.

3.3.2. Retrieving the border-before-style value on region-body

This what we are retrieving:

 propertyList.getFOName() = "fo:region-body"
 org.apache.fop.fo.FOPropertyMapping.getPropertyName(propId) = "border-before-style"

The border values are retrieved by the method PropertyManager.getBorderAndPadding. This is the call stack that leads up to it and on to the retrieval of the value of border-before-style:

  [1] org.apache.fop.fo.properties.PropertyMaker.findProperty (PropertyMaker.java:240)
  [2] org.apache.fop.fo.PropertyList.findProperty (PropertyList.java:289)
  [3] org.apache.fop.fo.properties.PropertyMaker.get (PropertyMaker.java:291)
  [4] org.apache.fop.fo.PropertyList.get (PropertyList.java:261)
  [5] org.apache.fop.fo.PropertyList.get (PropertyList.java:247)
  [6] org.apache.fop.fo.PropertyManager.initBorderInfo (PropertyManager.java:155)
  [7] org.apache.fop.fo.PropertyManager.getBorderAndPadding (PropertyManager.java:143)
  [8] org.apache.fop.fo.PropertyManager.getMarginProps (PropertyManager.java:289)
  [9] org.apache.fop.fo.pagination.RegionBody.getViewportRectangle (RegionBody.java:58)
  [10] org.apache.fop.layoutmgr.PageLayoutManager.makeRegionViewport (PageLayoutManager.java:811)
  [11] org.apache.fop.layoutmgr.PageLayoutManager.createPageAreas (PageLayoutManager.java:784)
  [12] org.apache.fop.layoutmgr.PageLayoutManager.createPage (PageLayoutManager.java:721)
  [13] org.apache.fop.layoutmgr.PageLayoutManager.makeNewPage (PageLayoutManager.java:441)
  [14] org.apache.fop.layoutmgr.PageLayoutManager.doLayout (PageLayoutManager.java:191)

The retrieval proceeds as follows:

  • PropertyList.findProperty: Is the value in the cache? No.

  • PropertyMaker.findProperty: corresponding != null, but corresponding.isCorrespondingForced() returns false. The corresponding property is border-top-style, which is not specified:

     org.apache.fop.fo.FOPropertyMapping.getPropertyName(correspondingId) = "border-top-style"
    

    This is the corresponding property maker:

     this = {
        baseMaker: instance of org.apache.fop.fo.properties.EnumProperty$Maker(id=816)
        lr_tb: 54
        rl_tb: 54
        tb_rl: 43
        useParent: false
        relative: true
    }
    

  • PropertyMaker.findProperty: Is this property explicitly specified? No.

  • PropertyMaker.findProperty: Can the corresponding property be computed? Yes, it can be derived from the property border, which is a shorthand for the corresponding property border-top-style. The returned value is 87, which stands for SOLID.

    Note that the shorthand was not used in the computation of corresponding.isCorrespondingForced(), but it is in the computation of the specified value of the corresponding property.

  • PropertyList.findProperty: Add the value to the cache.

3.3.3. Retrieving the border-before-width value on region-body

This what we are retrieving:

 propertyList.getFOName() = "fo:region-body"
 org.apache.fop.fo.FOPropertyMapping.getPropertyName(propId) = "border-before-width"

The border values are retrieved by the method PropertyManager.getBorderAndPadding. This is the call stack that leads up to it and on to the retrieval of the value of border-before-width:

main[1] where
  [1] org.apache.fop.fo.properties.PropertyMaker.findProperty (PropertyMaker.java:240)
  [2] org.apache.fop.fo.PropertyList.findProperty (PropertyList.java:289)
  [3] org.apache.fop.fo.properties.PropertyMaker.get (PropertyMaker.java:291)
  [4] org.apache.fop.fo.properties.CompoundPropertyMaker.get (CompoundPropertyMaker.java:146)
  [5] org.apache.fop.fo.PropertyList.get (PropertyList.java:261)
  [6] org.apache.fop.fo.PropertyList.get (PropertyList.java:247)
  [7] org.apache.fop.fo.PropertyManager.initBorderInfo (PropertyManager.java:157)
  [8] org.apache.fop.fo.PropertyManager.getBorderAndPadding (PropertyManager.java:143)
  [9] org.apache.fop.fo.PropertyManager.getMarginProps (PropertyManager.java:289)
  [10] org.apache.fop.fo.pagination.RegionBody.getViewportRectangle (RegionBody.java:58)
  [11] org.apache.fop.layoutmgr.PageLayoutManager.makeRegionViewport (PageLayoutManager.java:811)
  [12] org.apache.fop.layoutmgr.PageLayoutManager.createPageAreas (PageLayoutManager.java:784)
  [13] org.apache.fop.layoutmgr.PageLayoutManager.createPage (PageLayoutManager.java:721)
  [14] org.apache.fop.layoutmgr.PageLayoutManager.makeNewPage (PageLayoutManager.java:441)
  [15] org.apache.fop.layoutmgr.PageLayoutManager.doLayout (PageLayoutManager.java:191)

The difference with the call stack for border-before-style is that border-before-width is a compound property, with a minimum, an optimum and a maximum value.

The retrieval proceeds as follows:

  • PropertyList.findProperty: Is the value in the cache? No.

  • PropertyMaker.findProperty: corresponding != null, but corresponding.isCorrespondingForced() returns false. The corresponding property is border-top-width, which is not specified:

     org.apache.fop.fo.FOPropertyMapping.getPropertyName(correspondingId) = "border-top-width"
    

  • PropertyMaker.findProperty: Is this property explicitly specified? Yes. The property value is retrieved as:

     p = "CondLength[2000mpt]"
    

    The specified value was 2pt. When this attribute value was added to the property list, it was converted to a CondLength type.

  • PropertyList.findProperty: Add the value to the cache.

3.3.4. Retrieving the border-end-width value on region-body

This what we are retrieving:

 propertyList.getFOName() = "fo:region-body"
 org.apache.fop.fo.FOPropertyMapping.getPropertyName(propId) = "border-end-width"

The border values are retrieved by the method PropertyManager.getBorderAndPadding. The call stack that leads up to it and on to the retrieval of the value of border-end-width is identical to the call stack for border-before-width.

The retrieval proceeds as follows:

  • PropertyList.findProperty: Is the value in the cache? No.

  • PropertyMaker.findProperty: corresponding != null, and corresponding.isCorrespondingForced() returns true. The corresponding property is border-right-width, which is explicitly specified:

     org.apache.fop.fo.FOPropertyMapping.getPropertyName(correspondingId) = "border-right-width"
    

  • PropertyMaker.findProperty: Compute the corresponding property value. It is retrieved as:

     p = "CondLength[discard, 4000mpt]"
    

    The specified value was 4pt. When this attribute value was added to the property list, it was converted to a CondLength type.

  • PropertyList.findProperty: Add the value to the cache.