2.2. Example of a compound property

In this example we illustrate the case where first the base attribute of a compound property is specified, and then the attribute for one of the components.

First the user specifies the attribute value leader-length="120pt".

A simple length property value is constructed first:

 p.getClass() = "class org.apache.fop.fo.properties.FixedLength"
 p = {
    millipoints: 120000
    org.apache.fop.fo.properties.Property.specVal: null
}
 p = "120000mpt"

Then it is converted into a compound property value. First a compound property with default component values is created:

 p.getClass() = "class org.apache.fop.fo.properties.LengthRangeProperty"
 p = {
    minimum: instance of org.apache.fop.fo.properties.FixedLength(id=759)
    optimum: instance of org.apache.fop.fo.properties.FixedLength(id=760)
    maximum: instance of org.apache.fop.fo.properties.PercentLength(id=761)
    bfSet: 0
    bChecked: true
    org.apache.fop.fo.properties.Property.specVal: null
}
 p = "LengthRange[min:0mpt, max:100.0%, opt:12000mpt]"

Then all components are set equal to the simple property value:

 prop.getClass() = "class org.apache.fop.fo.properties.LengthRangeProperty"
 prop = {
    minimum: instance of org.apache.fop.fo.properties.FixedLength(id=744)
    optimum: instance of org.apache.fop.fo.properties.FixedLength(id=744)
    maximum: instance of org.apache.fop.fo.properties.FixedLength(id=744)
    bfSet: 7
    bChecked: true
    org.apache.fop.fo.properties.Property.specVal: null
}
 prop = "LengthRange[min:120000mpt, max:120000mpt, opt:120000mpt]"

The property makers involved:

 this = "org.apache.fop.fo.properties.LengthRangeProperty$Maker@55a338"
 this.subproperties = instance of org.apache.fop.fo.properties.PropertyMaker[11] (id=766)
 getSubpropMaker(org.apache.fop.fo.Constants.CP_MINIMUM) = "org.apache.fop.fo.properties.LengthProperty$Maker@955cd5"
 getSubpropMaker(org.apache.fop.fo.Constants.CP_MAXIMUM) = "org.apache.fop.fo.properties.LengthProperty$Maker@1bde4"
 getSubpropMaker(org.apache.fop.fo.Constants.CP_OPTIMUM) = "org.apache.fop.fo.properties.LengthProperty$Maker@a77106"

Stack dump when making the compound property:

  [1] org.apache.fop.fo.properties.CompoundPropertyMaker.makeCompound (CompoundPropertyMaker.java:258)
  [2] org.apache.fop.fo.properties.CompoundPropertyMaker.convertProperty (CompoundPropertyMaker.java:173)
  [3] org.apache.fop.fo.properties.LengthRangeProperty$Maker.convertProperty (LengthRangeProperty.java:68)
  [4] org.apache.fop.fo.properties.PropertyMaker.make (PropertyMaker.java:392)
  [5] org.apache.fop.fo.properties.CompoundPropertyMaker.make (CompoundPropertyMaker.java:206)
  [6] org.apache.fop.fo.PropertyList.convertAttributeToProperty (PropertyList.java:418)
  [7] org.apache.fop.fo.PropertyList.addAttributesToList (PropertyList.java:374)
  [8] org.apache.fop.fo.FObj.addProperties (FObj.java:133)
  [9] org.apache.fop.fo.FObj.processNode (FObj.java:96)
  [10] org.apache.fop.fo.FOTreeBuilder.startElement (FOTreeBuilder.java:234)

Subsequently, the user specifies a component, leader-length.maximum="200pt".

First the subproperty is constructed as a simple length property:

 p.getClass() = "class org.apache.fop.fo.properties.FixedLength"
 p = {
    millipoints: 200000
    org.apache.fop.fo.properties.Property.specVal: null
}
 p = "200000mpt"

Then it is added to the compound property as the component maximum:

 prop.getClass() = "class org.apache.fop.fo.properties.LengthRangeProperty"
 prop = {
    minimum: instance of org.apache.fop.fo.properties.FixedLength(id=755)
    optimum: instance of org.apache.fop.fo.properties.FixedLength(id=755)
    maximum: instance of org.apache.fop.fo.properties.FixedLength(id=767)
    bfSet: 7
    bChecked: true
    org.apache.fop.fo.properties.Property.specVal: null
}
 prop = "LengthRange[min:120000mpt, max:200000mpt, opt:120000mpt]"

Stack dump when making the property:

  [1] org.apache.fop.fo.properties.PropertyMaker.make (PropertyMaker.java:378)
  [2] org.apache.fop.fo.properties.CompoundPropertyMaker.make (CompoundPropertyMaker.java:235)
  [3] org.apache.fop.fo.PropertyList.convertAttributeToProperty (PropertyList.java:423)
  [4] org.apache.fop.fo.PropertyList.addAttributesToList (PropertyList.java:374)
  [5] org.apache.fop.fo.FObj.addProperties (FObj.java:133)
  [6] org.apache.fop.fo.FObj.processNode (FObj.java:96)
  [7] org.apache.fop.fo.FOTreeBuilder.startElement (FOTreeBuilder.java:234)