org.apache.fop.fo.properties

Class CompoundPropertyMaker

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
CondLengthProperty.Maker, KeepProperty.Maker, LengthPairProperty.Maker, LengthRangeProperty.Maker, SpaceProperty.Maker

public class CompoundPropertyMaker
extends PropertyMaker

This class extends Property.Maker with support for sub-properties.

Field Summary

Fields inherited from class org.apache.fop.fo.properties.PropertyMaker

contextDep, corresponding, defaultProperty, defaultValue, propId, setByShorthand

Constructor Summary

CompoundPropertyMaker(int propId)
Construct an instance of a CompoundPropertyMaker for the given property.

Method Summary

void
addSubpropMaker(PropertyMaker subproperty)
Add a subproperty to this maker.
protected Property
checkEnumValues(String value)
For compound properties which can take enumerate values.
protected Property
convertProperty(Property p, PropertyList propertyList, FObj fo)
Return a Property object based on the passed Property object.
Property
get(int subpropertyId, PropertyList propertyList, boolean tryInherit, boolean tryDefault)
Return the property on the current FlowObject.
PropertyMaker
getSubpropMaker(int subpropertyId)
Return a Maker object which is used to set the values on components of compound property types, such as "space".
Property
make(PropertyList propertyList)
Make a compound property with default values.
Property
make(PropertyList propertyList, String value, FObj fo)
Create a Property object from an attribute specification.
Property
make(Property baseProperty, int subpropertyId, PropertyList propertyList, String value, FObj fo)
Return a property value for a compound property.
protected Property
makeCompound(PropertyList propertyList, FObj parentFO)
Create a empty compound property and fill it with default values for the subproperties.
void
useGeneric(PropertyMaker generic)

Methods inherited from class org.apache.fop.fo.properties.PropertyMaker

addEnum, addKeyword, addShorthand, addSubpropMaker, checkEnumValues, checkValueKeywords, clone, compute, convertProperty, convertPropertyDatatype, convertShorthandProperty, findProperty, get, getName, getPercentBase, getPropId, getShorthand, getSubprop, getSubpropMaker, isInherited, make, make, make, makeNewProperty, setByShorthand, setCorresponding, setDatatypeParser, setDefault, setDefault, setInherited, setPercentBase, setSubprop, useGeneric

Constructor Details

CompoundPropertyMaker

public CompoundPropertyMaker(int propId)
Construct an instance of a CompoundPropertyMaker for the given property.
Parameters:
propId - The Constant ID of the property to be made.

Method Details

addSubpropMaker

public void addSubpropMaker(PropertyMaker subproperty)
Add a subproperty to this maker.
Overrides:
addSubpropMaker in interface PropertyMaker
Parameters:
subproperty -

checkEnumValues

protected Property checkEnumValues(String value)
For compound properties which can take enumerate values. Delegate the enumeration check to one of the subpropeties.
Overrides:
checkEnumValues in interface PropertyMaker
Parameters:
value - the string containing the property value
Returns:
the Property encapsulating the enumerated equivalent of the input value

convertProperty

protected Property convertProperty(Property p,
                                   PropertyList propertyList,
                                   FObj fo)
            throws PropertyException
Return a Property object based on the passed Property object. This method is called if the Property object built by the parser isn't the right type for this compound property.
Overrides:
convertProperty in interface PropertyMaker
Parameters:
p - The Property object return by the expression parser
propertyList - The PropertyList object being built for this FO.
fo - The parent FO for the FO whose property is being made.
Returns:
A Property of the correct type or null if the parsed value can't be converted to the correct type.
Throws:
PropertyException - for invalid or inconsistent FO input

get

public Property get(int subpropertyId,
                    PropertyList propertyList,
                    boolean tryInherit,
                    boolean tryDefault)
            throws PropertyException
Return the property on the current FlowObject. Depending on the passed flags, this will try to compute it based on other properties, or if it is inheritable, to return the inherited value. If all else fails, it returns the default value.
Overrides:
get in interface PropertyMaker
Parameters:
subpropertyId - The subproperty id of the property being retrieved. Is 0 when retriving a base property.
propertyList - The PropertyList object being built for this FO.
tryInherit - true if inherited properties should be examined.
tryDefault - true if the default value should be returned.

getSubpropMaker

public PropertyMaker getSubpropMaker(int subpropertyId)
Return a Maker object which is used to set the values on components of compound property types, such as "space". Overridden by property maker subclasses which handle compound properties.
Overrides:
getSubpropMaker in interface PropertyMaker
Parameters:
subpropertyId - the id of the component for which a Maker is to returned, for example CP_OPTIMUM, if the FO attribute is space.optimum='10pt'.
Returns:
the Maker object specified

make

public Property make(PropertyList propertyList)
            throws PropertyException
Make a compound property with default values.
Overrides:
make in interface PropertyMaker
Parameters:
propertyList - The PropertyList object being built for this FO.
Returns:
the Property object corresponding to the parameters
Throws:
PropertyException - for invalid or inconsisten FO input

make

public Property make(PropertyList propertyList,
                     String value,
                     FObj fo)
            throws PropertyException
Create a Property object from an attribute specification.
Overrides:
make in interface PropertyMaker
Parameters:
propertyList - The PropertyList object being built for this FO.
value - The attribute value.
fo - The parent FO for the FO whose property is being made.
Returns:
The initialized Property object.
Throws:
PropertyException - for invalid or inconsistent FO input

make

public Property make(Property baseProperty,
                     int subpropertyId,
                     PropertyList propertyList,
                     String value,
                     FObj fo)
            throws PropertyException
Return a property value for a compound property. If the property value is already partially initialized, this method will modify it.
Overrides:
make in interface PropertyMaker
Parameters:
baseProperty - The Property object representing the compound property, for example: SpaceProperty.
subpropertyId - The Constants ID of the subproperty (component) whose value is specified.
propertyList - The propertyList being built.
value - the value of the
fo - The parent FO for the FO whose property is being made.
Returns:
baseProperty (or if null, a new compound property object) with the new subproperty added
Throws:
PropertyException - for invalid or inconsistent FO input

makeCompound

protected Property makeCompound(PropertyList propertyList,
                                FObj parentFO)
            throws PropertyException
Create a empty compound property and fill it with default values for the subproperties.
Parameters:
propertyList - The propertyList being built.
parentFO - The parent FO for the FO whose property is being made.
Returns:
a Property subclass object holding a "compound" property object initialized to the default values for each component.
Throws:
PropertyException - ...

useGeneric

public void useGeneric(PropertyMaker generic)
Overrides:
useGeneric in interface PropertyMaker

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.