Package org.apache.fop.fo
Class PropertyList
java.lang.Object
org.apache.fop.fo.PropertyList
- Direct Known Subclasses:
Marker.MarkerPropertyList
,StaticPropertyList
Class containing the collection of properties for a given FObj.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
A class to handle unknown shorthand property values e.g. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FObj
private static boolean[]
private static org.apache.commons.logging.Log
protected PropertyList
reference to the parent FO's propertyListprivate final PropertyList.UnknownPropertyHandler
-
Constructor Summary
ConstructorsConstructorDescriptionPropertyList
(FObj fObjToAttach, PropertyList parentPropertyList) Basic constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributesToList
(Attributes attributes) Adds the attributes, passed in by the parser to the PropertyList.private String
addAttributeToList
(Attributes attributes, String attributeName) private void
convertAttributeToProperty
(Attributes attributes, String attributeName, String attributeValue) private Property
findBaseProperty
(Attributes attributes, FObj parentFO, int propId, String basePropertyName, PropertyMaker propertyMaker) protected static String
findBasePropertyName
(String attributeName) Finds the first or base part (up to any period) of an attribute name.private static PropertyMaker
findMaker
(int propId) protected static String
findSubPropertyName
(String attributeName) Finds the second or sub part (portion past any period) of an attribute name.get
(int propId) Return the property on the current FlowObject.get
(int propId, boolean bTryInherit, boolean bTryDefault) Return the property on the current FlowObject.Constructs a CommonAbsolutePosition object.Constructs a CommonAural object.Constructs a BorderAndPadding object.abstract Property
getExplicit
(int propId) Return the value explicitly specified on this FO.getExplicitOrShorthand
(int propId) Return the value explicitly specified on this FO.getFObj()
Constructs a CommonFont object.getFromParent
(int propId) Return the value of this property on the parent of this FO.Constructs a CommonHyphenation object.getInherited
(int propId) Return the value of this property inherited by this FO.Constructs a CommonMarginBlock object.Constructs a CommonMarginInline object.getNearestSpecified
(int propId) Return the "nearest" specified value for the given property.getPropertyForAttribute
(Attributes attributes, String attributeName, String attributeValue) Constructs a RelativePositionProps objects.private Property
getShorthand
(int propId) Constructs a CommonTextDecoration object.Gets the current list of unknown property valuesprotected void
handleInvalidProperty
(org.apache.xmlgraphics.util.QName attr) Handles an invalid property.private boolean
isInherited
(int propId) protected boolean
isValidPropertyName
(String propertyName) Validates a property name.private Property
makeProperty
(int propId) abstract void
putExplicit
(int propId, Property value) Set an value defined explicitly on this FO.int
selectFromWritingMode
(int lrtb, int rltb, int tbrl, int tblr) Select a writing mode dependent property ID based on value of writing mode property.void
validatePropertyValue
(String propertyValue, Property output, Property property) Adds an unknown property value to the property list so that if necessary, a warning can be displayed.
-
Field Details
-
inheritableProperty
private static boolean[] inheritableProperty -
parentPropertyList
reference to the parent FO's propertyList -
fobj
-
log
private static org.apache.commons.logging.Log log -
unknownPropertyHandler
-
-
Constructor Details
-
PropertyList
Basic constructor.- Parameters:
fObjToAttach
- the FO this PropertyList should be attached toparentPropertyList
- the PropertyList belonging to the new objects parent
-
-
Method Details
-
getFObj
- Returns:
- the FObj object to which this propertyList is attached
-
getParentFObj
- Returns:
- the FObj object attached to the parentPropertyList
-
validatePropertyValue
Adds an unknown property value to the property list so that if necessary, a warning can be displayed.- Parameters:
propertyValue
- The unknown property valueoutput
- The output of the property to validateproperty
- The original property containing the full value
-
getUnknownPropertyValues
Gets the current list of unknown property values- Returns:
- The set containing the list of unknown property values
-
getParentPropertyList
- Returns:
- the FObj object attached to the parentPropetyList
-
getExplicitOrShorthand
Return the value explicitly specified on this FO.- Parameters:
propId
- The id of the property whose value is desired.- Returns:
- The value if the property is explicitly set or set by a shorthand property, otherwise null.
- Throws:
PropertyException
- ...
-
getExplicit
Return the value explicitly specified on this FO.- Parameters:
propId
- The ID of the property whose value is desired.- Returns:
- The value if the property is explicitly set, otherwise null.
-
putExplicit
Set an value defined explicitly on this FO.- Parameters:
propId
- The ID of the property to set.value
- The value of the property.
-
getInherited
Return the value of this property inherited by this FO. Implements the inherited-property-value function. The property must be inheritable!- Parameters:
propId
- The ID of the property whose value is desired.- Returns:
- The inherited value, otherwise null.
- Throws:
PropertyException
- ...
-
get
Return the property on the current FlowObject. If it isn't set explicitly, 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.- Parameters:
propId
- The Constants ID of the property whose value is desired.- Returns:
- the Property corresponding to that name
- Throws:
PropertyException
- if there is a problem evaluating the property
-
get
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.- Parameters:
propId
- the property's idbTryInherit
- true for inherited properties, or when the inherited value is neededbTryDefault
- true when the default value may be used as a last resort- Returns:
- the property
- Throws:
PropertyException
- if there is a problem evaluating the property
-
getNearestSpecified
Return the "nearest" specified value for the given property. Implements the from-nearest-specified-value function.- Parameters:
propId
- The ID of the property whose value is desired.- Returns:
- The computed value if the property is explicitly set on some ancestor of the current FO, else the initial value.
- Throws:
PropertyException
- if there an error occurred when getting the property
-
getFromParent
Return the value of this property on the parent of this FO. Implements the from-parent function.- Parameters:
propId
- The Constants ID of the property whose value is desired.- Returns:
- The computed value on the parent or the initial value if this FO is the root or is in a different namespace from its parent.
- Throws:
PropertyException
- ...
-
selectFromWritingMode
public int selectFromWritingMode(int lrtb, int rltb, int tbrl, int tblr) Select a writing mode dependent property ID based on value of writing mode property.- Parameters:
lrtb
- the property ID to return under lrtb writingmode.rltb
- the property ID to return under rltb writingmode.tbrl
- the property ID to return under tbrl writingmode.tblr
- the property ID to return under tblr writingmode.- Returns:
- one of the property IDs, depending on the writing mode.
-
addAttributeToList
private String addAttributeToList(Attributes attributes, String attributeName) throws ValidationException - Throws:
ValidationException
-
addAttributesToList
Adds the attributes, passed in by the parser to the PropertyList.
Note that certain attributes are given priority in terms of order of processing due to conversion dependencies, where the order is as follows:
- writing-mode
- column-number
- number-columns-spanned
- font
- font-size
- all others in order of appearance
- Parameters:
attributes
- Collection of attributes passed to us from the parser.- Throws:
ValidationException
- if there is an attribute that does not map to a property id (strict validation only)
-
isValidPropertyName
Validates a property name.- Parameters:
propertyName
- the property name to check- Returns:
- true if the base property name and the subproperty name (if any) can be correctly mapped to an id
-
getPropertyForAttribute
public Property getPropertyForAttribute(Attributes attributes, String attributeName, String attributeValue) throws FOPException - Throws:
FOPException
-
convertAttributeToProperty
private void convertAttributeToProperty(Attributes attributes, String attributeName, String attributeValue) throws ValidationException - Parameters:
attributes
- Collection of attributesattributeName
- Attribute name to convertattributeValue
- Attribute value to assign to property- Throws:
ValidationException
- in case the property name is invalid for the FO namespace
-
findBaseProperty
private Property findBaseProperty(Attributes attributes, FObj parentFO, int propId, String basePropertyName, PropertyMaker propertyMaker) throws PropertyException - Throws:
PropertyException
-
handleInvalidProperty
protected void handleInvalidProperty(org.apache.xmlgraphics.util.QName attr) throws ValidationException Handles an invalid property.- Parameters:
attr
- the invalid attribute- Throws:
ValidationException
- if an exception needs to be thrown depending on the validation settings
-
findBasePropertyName
Finds the first or base part (up to any period) of an attribute name. For example, if input is "space-before.minimum", should return "space-before".- Parameters:
attributeName
- String to be atomized- Returns:
- the base portion of the attribute
-
findSubPropertyName
Finds the second or sub part (portion past any period) of an attribute name. For example, if input is "space-before.minimum", should return "minimum".- Parameters:
attributeName
- String to be atomized- Returns:
- the sub portion of the attribute
-
getShorthand
- Parameters:
propId
- ID of property- Returns:
- new Property object
- Throws:
PropertyException
- if there's a problem while processing the property
-
makeProperty
- Parameters:
propId
- ID of property- Returns:
- new Property object
- Throws:
PropertyException
- if there's a problem while processing the property
-
isInherited
private boolean isInherited(int propId) - Parameters:
propId
- ID of property- Returns:
- isInherited value from the requested Property.Maker
-
findMaker
- Parameters:
propId
- Id of property- Returns:
- the Property.Maker for this property
-
getBorderPaddingBackgroundProps
Constructs a BorderAndPadding object.- Returns:
- a BorderAndPadding object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getHyphenationProps
Constructs a CommonHyphenation object.- Returns:
- the CommonHyphenation object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getMarginBlockProps
Constructs a CommonMarginBlock object.- Returns:
- the CommonMarginBlock object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getMarginInlineProps
Constructs a CommonMarginInline object.- Returns:
- the CommonMarginInline object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getAuralProps
Constructs a CommonAural object.- Returns:
- the CommonAural object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getRelativePositionProps
Constructs a RelativePositionProps objects.- Returns:
- a RelativePositionProps object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getAbsolutePositionProps
Constructs a CommonAbsolutePosition object.- Returns:
- the CommonAbsolutePosition object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getFontProps
Constructs a CommonFont object.- Returns:
- A CommonFont object
- Throws:
PropertyException
- if there's a problem while processing the properties
-
getTextDecorationProps
Constructs a CommonTextDecoration object.- Returns:
- a CommonTextDecoration object
- Throws:
PropertyException
- if there's a problem while processing the properties
-