org.apache.fop.fo

Class PropertyList

Known Direct Subclasses:
Marker.MarkerPropertyList, StaticPropertyList

public abstract class PropertyList
extends java.lang.Object

Class containing the collection of properties for a given FObj.

Field Summary

protected PropertyList
parentPropertyList
reference to the parent FO's propertyList *

Constructor Summary

PropertyList(FObj fObjToAttach, PropertyList parentPropertyList)
Basic constructor.

Method Summary

void
addAttributesToList(Attributes attributes)
Adds the attributes, passed in by the parser to the PropertyList
protected static String
findBasePropertyName(String attributeName)
Finds the first or base part (up to any period) of an attribute name.
protected static String
findSubPropertyName(String attributeName)
Finds the second or sub part (portion past any period) of an attribute name.
Property
get(int propId)
Return the property on the current FlowObject.
Property
get(int propId, boolean bTryInherit, boolean bTryDefault)
Return the property on the current FlowObject.
CommonAbsolutePosition
getAbsolutePositionProps()
Constructs a CommonAbsolutePosition object.
CommonAccessibility
getAccessibilityProps()
Constructs a CommonAccessibility object.
CommonAural
getAuralProps()
Constructs a CommonAural object.
CommonBorderPaddingBackground
getBorderPaddingBackgroundProps()
Constructs a BorderAndPadding object.
abstract Property
getExplicit(int propId)
Return the value explicitly specified on this FO.
Property
getExplicitOrShorthand(int propId)
Return the value explicitly specified on this FO.
FObj
getFObj()
CommonFont
getFontProps()
Constructs a CommonFont object.
Property
getFromParent(int propId)
Return the value of this property on the parent of this FO.
CommonHyphenation
getHyphenationProps()
Constructs a CommonHyphenation object.
Property
getInherited(int propId)
Return the value of this property inherited by this FO.
CommonMarginBlock
getMarginBlockProps()
Constructs a CommonMarginBlock object.
CommonMarginInline
getMarginInlineProps()
Constructs a CommonMarginInline object.
Property
getNearestSpecified(int propId)
Return the "nearest" specified value for the given property.
FObj
getParentFObj()
PropertyList
getParentPropertyList()
CommonRelativePosition
getRelativePositionProps()
Constructs a RelativePositionProps objects.
CommonTextDecoration
getTextDecorationProps()
Constructs a CommonTextDecoration object.
int
getWritingMode()
Return the "writing-mode" property value.
int
getWritingMode(int lrtb, int rltb, int tbrl)
Uses the stored writingMode.
protected void
handleInvalidProperty(String message, String propName)
protected boolean
isValidPropertyName(String propertyName)
Validates a property name.
abstract void
putExplicit(int propId, Property value)
Set an value defined explicitly on this FO.
void
setWritingMode()
Set writing mode for this FO.

Field Details

parentPropertyList

protected PropertyList parentPropertyList
reference to the parent FO's propertyList *

Constructor Details

PropertyList

public PropertyList(FObj fObjToAttach,
                    PropertyList parentPropertyList)
Basic constructor.
Parameters:
fObjToAttach - the FO this PropertyList should be attached to
parentPropertyList - the PropertyList belonging to the new objects parent

Method Details

addAttributesToList

public void addAttributesToList(Attributes attributes)
            throws ValidationException
Adds the attributes, passed in by the parser to the PropertyList
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)

findBasePropertyName

protected static String findBasePropertyName(String attributeName)
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

protected static String findSubPropertyName(String attributeName)
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

get

public Property get(int propId)
            throws PropertyException
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 - ...

get

public Property get(int propId,
                    boolean bTryInherit,
                    boolean bTryDefault)
            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.
Parameters:
propId - the property's id
bTryInherit - true for inherited properties, or when the inherited value is needed
bTryDefault - true when the default value may be used as a last resort
Returns:
the property
Throws:
PropertyException - ...

getAbsolutePositionProps

public CommonAbsolutePosition getAbsolutePositionProps()
            throws PropertyException
Constructs a CommonAbsolutePosition object.
Returns:
the CommonAbsolutePosition object
Throws:
PropertyException - if there's a problem while processing the properties

getAccessibilityProps

public CommonAccessibility getAccessibilityProps()
            throws PropertyException
Constructs a CommonAccessibility object.
Returns:
the CommonAccessibility object
Throws:
PropertyException - if there's a problem while processing the properties

getAuralProps

public CommonAural getAuralProps()
            throws PropertyException
Constructs a CommonAural object.
Returns:
the CommonAural object
Throws:
PropertyException - if there's a problem while processing the properties

getBorderPaddingBackgroundProps

public CommonBorderPaddingBackground getBorderPaddingBackgroundProps()
            throws PropertyException
Constructs a BorderAndPadding object.
Returns:
a BorderAndPadding object
Throws:
PropertyException - if there's a problem while processing the properties

getExplicit

public abstract Property getExplicit(int propId)
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.

getExplicitOrShorthand

public Property getExplicitOrShorthand(int propId)
            throws PropertyException
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 - ...

getFObj

public FObj getFObj()
Returns:
the FObj object to which this propertyList is attached

getFontProps

public CommonFont getFontProps()
            throws PropertyException
Constructs a CommonFont object.
Returns:
A CommonFont object
Throws:
PropertyException - if there's a problem while processing the properties

getFromParent

public Property getFromParent(int propId)
            throws PropertyException
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 - ...

getHyphenationProps

public CommonHyphenation getHyphenationProps()
            throws PropertyException
Constructs a CommonHyphenation object.
Returns:
the CommonHyphenation object
Throws:
PropertyException - if there's a problem while processing the properties

getInherited

public Property getInherited(int propId)
            throws PropertyException
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 - ...

getMarginBlockProps

public CommonMarginBlock getMarginBlockProps()
            throws PropertyException
Constructs a CommonMarginBlock object.
Returns:
the CommonMarginBlock object
Throws:
PropertyException - if there's a problem while processing the properties

getMarginInlineProps

public CommonMarginInline getMarginInlineProps()
            throws PropertyException
Constructs a CommonMarginInline object.
Returns:
the CommonMarginInline object
Throws:
PropertyException - if there's a problem while processing the properties

getNearestSpecified

public Property getNearestSpecified(int propId)
            throws PropertyException
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 - ...

getParentFObj

public FObj getParentFObj()
Returns:
the FObj object attached to the parentPropertyList

getParentPropertyList

public PropertyList getParentPropertyList()
Returns:
the FObj object attached to the parentPropetyList

getRelativePositionProps

public CommonRelativePosition getRelativePositionProps()
            throws PropertyException
Constructs a RelativePositionProps objects.
Returns:
a RelativePositionProps object
Throws:
PropertyException - if there's a problem while processing the properties

getTextDecorationProps

public CommonTextDecoration getTextDecorationProps()
            throws PropertyException
Constructs a CommonTextDecoration object.
Returns:
a CommonTextDecoration object
Throws:
PropertyException - if there's a problem while processing the properties

getWritingMode

public int getWritingMode()
Return the "writing-mode" property value.
Returns:
the "writing-mode" property value.

getWritingMode

public int getWritingMode(int lrtb,
                          int rltb,
                          int tbrl)
Uses the stored writingMode.
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.
Returns:
one of the property IDs, depending on the writing mode.

handleInvalidProperty

protected void handleInvalidProperty(String message,
                                     String propName)
            throws ValidationException
Parameters:
message - ...
propName - ...
Throws:
ValidationException - ...

isValidPropertyName

protected boolean isValidPropertyName(String propertyName)
            throws ValidationException
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
Throws:
ValidationException - in case the property name is invalid for the FO namespace

putExplicit

public abstract void putExplicit(int propId,
                                 Property value)
Set an value defined explicitly on this FO.
Parameters:
propId - The ID of the property to set.
value - The value of the property.

setWritingMode

public void setWritingMode()
            throws PropertyException
Set writing mode for this FO. Use that from the nearest ancestor, including self, which generates reference areas, or from root FO if no ancestor found.
Throws:
PropertyException - ...

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