java.lang.Cloneable
CharacterProperty.Maker
, ColorProperty.Maker
, CompoundPropertyMaker
, EnumProperty.Maker
, FontFamilyProperty.Maker
, FontShorthandProperty.Maker
, LengthProperty.Maker
, ListProperty.Maker
, NumberProperty.Maker
, NumberProperty.PositiveIntegerMaker
, StringProperty.Maker
, TableFObj.ColumnNumberPropertyMaker
, ToBeImplementedProperty.Maker
, URIProperty.Maker
public class PropertyMaker
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
contextDep |
Indicates whether the property is context-dependant and therefore can't be cached.
|
protected CorrespondingPropertyMaker |
corresponding |
Maker for 'corresponding' properties
|
protected Property |
defaultProperty |
default property
|
protected java.lang.String |
defaultValue |
the default value for the maker
|
protected int |
propId |
the property ID
|
protected boolean |
setByShorthand |
Indicates whether the property is set through a shorthand.
|
Constructor | Description |
---|---|
PropertyMaker(int propId) |
Construct an instance of a Property.Maker for the given property.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addEnum(java.lang.String constant,
Property value) |
Add a enum constant.
|
void |
addKeyword(java.lang.String keyword,
java.lang.String value) |
Add a keyword-equiv to the maker.
|
void |
addShorthand(PropertyMaker shorthand) |
Add a shorthand to this maker.
|
void |
addSubpropMaker(PropertyMaker subproperty) |
Add a subproperty to this maker.
|
protected Property |
checkEnumValues(java.lang.String value) |
For properties that contain enumerated values.
|
protected java.lang.String |
checkValueKeywords(java.lang.String keyword) |
Return a String to be parsed if the passed value corresponds to
a keyword which can be parsed and used to initialize the property.
|
java.lang.Object |
clone() |
Return a clone of the makers.
|
protected Property |
compute(PropertyList propertyList) |
Return a Property object representing the value of this property,
based on other property values for this FO.
|
protected Property |
convertProperty(Property p,
PropertyList propertyList,
FObj fo) |
Return a Property object based on the passed Property object.
|
protected Property |
convertPropertyDatatype(Property p,
PropertyList propertyList,
FObj fo) |
For properties that have more than one legal way to be specified,
this routine should be overridden to attempt to set them based upon
the other methods.
|
Property |
convertShorthandProperty(PropertyList propertyList,
Property prop,
FObj fo) |
Converts a shorthand property
|
Property |
findProperty(PropertyList propertyList,
boolean tryInherit) |
If the property is a relative property with a corresponding absolute
value specified, the absolute value is used.
|
Property |
get(int subpropertyId,
PropertyList propertyList,
boolean tryInherit,
boolean tryDefault) |
Return the property on the current FlowObject.
|
java.lang.String |
getName() |
|
PercentBase |
getPercentBase(PropertyList pl) |
This is used to handle properties specified as a percentage of
some "base length", such as the content width of their containing
box.
|
int |
getPropId() |
|
Property |
getShorthand(PropertyList propertyList) |
For properties that can be set by shorthand properties, this method
should return the Property, if any, that is parsed from any
shorthand properties that affect this property.
|
Property |
getSubprop(Property p,
int subpropertyId) |
Return a property value for the given component of a compound
property.
|
PropertyMaker |
getSubpropMaker(int subpropertyId) |
Return a subproperty maker for the subpropertyId.
|
boolean |
isInherited() |
Default implementation of isInherited.
|
Property |
make(Property baseProperty,
int subpropertyId,
PropertyList propertyList,
java.lang.String value,
FObj fo) |
Make a property value for a compound property.
|
Property |
make(PropertyList propertyList) |
Return the default value.
|
Property |
make(PropertyList propertyList,
java.lang.String value,
FObj fo) |
Create a Property object from an attribute specification.
|
Property |
makeNewProperty() |
Create a new empty property.
|
void |
setByShorthand(boolean setByShorthand) |
Set the setByShorthand flag which only is applicable for subproperty
makers.
|
void |
setCorresponding(CorrespondingPropertyMaker corresponding) |
Set the correspoding property information.
|
void |
setDatatypeParser(ShorthandParser parser) |
Set the shorthand datatype parser.
|
void |
setDefault(java.lang.String defaultValue) |
Set the default value for this maker.
|
void |
setDefault(java.lang.String defaultValue,
boolean contextDep) |
Set the default value for this maker.
|
void |
setInherited(boolean inherited) |
Set the inherited flag.
|
void |
setPercentBase(int percentBase) |
Set the percent base identifier for this maker.
|
protected Property |
setSubprop(Property baseProperty,
int subpropertyId,
Property subproperty) |
Set a component in a compound property and return the modified
compound property object.
|
void |
useGeneric(PropertyMaker generic) |
Copy all the values from the generic maker to this maker.
|
protected int propId
protected java.lang.String defaultValue
protected boolean contextDep
protected boolean setByShorthand
protected Property defaultProperty
protected CorrespondingPropertyMaker corresponding
public PropertyMaker(int propId)
propId
- The Constant ID of the property to be made.public int getPropId()
public void useGeneric(PropertyMaker generic)
generic
- a generic property maker.public void setInherited(boolean inherited)
inherited
- true if this is an inherited propertypublic void addKeyword(java.lang.String keyword, java.lang.String value)
keyword
- the keywordvalue
- the value to be used when the keyword is specifiedpublic void addEnum(java.lang.String constant, Property value)
constant
- the enum constantvalue
- the Property value to use when the constant is specifiedpublic void addSubpropMaker(PropertyMaker subproperty)
subproperty
- the PropertyMaker for the subpropertypublic PropertyMaker getSubpropMaker(int subpropertyId)
subpropertyId
- The subpropertyId of the maker.public void addShorthand(PropertyMaker shorthand)
shorthand
- a property maker thar is that is checked for
shorthand values.public void setDatatypeParser(ShorthandParser parser)
parser
- the shorthand parserpublic void setDefault(java.lang.String defaultValue)
defaultValue
- the default value.public void setDefault(java.lang.String defaultValue, boolean contextDep)
defaultValue
- the default valuecontextDep
- true when the value context dependent and
must not be cached.public void setPercentBase(int percentBase)
percentBase
- the percent base (ex. LengthBase.FONTSIZE)public void setByShorthand(boolean setByShorthand)
setByShorthand
- true if this subproperty must be set when the base property is setpublic void setCorresponding(CorrespondingPropertyMaker corresponding)
corresponding
- a corresponding maker where the
isForcedCorresponding and compute methods are delegated to.public Property makeNewProperty()
public Property findProperty(PropertyList propertyList, boolean tryInherit) throws PropertyException
propertyList
- the applicable property listtryInherit
- true if inherited properties should be examined.PropertyException
- if there is a problem evaluating the propertypublic Property get(int subpropertyId, PropertyList propertyList, boolean tryInherit, boolean tryDefault) throws PropertyException
subpropertyId
- The subproperty id of the property being retrieved.
Is 0 when retrieving 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.PropertyException
- if there is a problem evaluating the propertypublic boolean isInherited()
public PercentBase getPercentBase(PropertyList pl) throws PropertyException
pl
- the PropertyList containing the property. (TODO: explain
what this is used for, or remove it from the signature.)PropertyException
- if there is a problem while evaluating the base propertypublic Property getSubprop(Property p, int subpropertyId)
p
- A property value for a compound property type such as
SpaceProperty.subpropertyId
- the id of the component whose value is to be
returned.
NOTE: this is only to ease porting when calls are made to
PropertyList.get() using a component name of a compound property,
such as get("space.optimum"). The recommended technique is:
get("space").getOptimum().
Overridden by property maker subclasses which handle
compound properties.protected Property setSubprop(Property baseProperty, int subpropertyId, Property subproperty)
baseProperty
- The Property object representing the compound property,
such as SpaceProperty.subpropertyId
- The ID of the component whose value is specified.subproperty
- A Property object holding the specified value of the
component to be set.public Property make(PropertyList propertyList) throws PropertyException
propertyList
- The PropertyList object being built for this FO.PropertyException
- for invalid or inconsisten FO inputpublic Property make(PropertyList propertyList, java.lang.String value, FObj fo) throws PropertyException
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.PropertyException
- for invalid or inconsistent FO inputpublic Property make(Property baseProperty, int subpropertyId, PropertyList propertyList, java.lang.String value, FObj fo) throws PropertyException
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.fo
- The parent FO for the FO whose property is being made.value
- the value of thePropertyException
- for invalid or inconsistent FO inputpublic Property convertShorthandProperty(PropertyList propertyList, Property prop, FObj fo) throws PropertyException
propertyList
- the propertyList for which to convertprop
- the shorthand propertyfo
- ...PropertyException
- ...protected Property checkEnumValues(java.lang.String value)
value
- the string containing the property valueprotected java.lang.String checkValueKeywords(java.lang.String keyword)
keyword
- the string value of property attribute.protected Property convertProperty(Property p, PropertyList propertyList, FObj fo) throws PropertyException
p
- The Property object return by the expression parserpropertyList
- The PropertyList object being built for this FO.fo
- The parent FO for the FO whose property is being made.PropertyException
- for invalid or inconsistent FO inputprotected Property convertPropertyDatatype(Property p, PropertyList propertyList, FObj fo) throws PropertyException
p
- property whose datatype should be convertedpropertyList
- collection of properties. (TODO: explain why
this is needed, or remove it from the signature.)fo
- The parent FO for the FO whose property is being made.
why this is needed, or remove it from the signature).PropertyException
- for invalid or inconsistent inputprotected Property compute(PropertyList propertyList) throws PropertyException
propertyList
- The PropertyList for the FO.PropertyException
- for invalid or inconsistent FO inputpublic Property getShorthand(PropertyList propertyList) throws PropertyException
propertyList
- the collection of properties to be consideredPropertyException
- if there is a problem while evaluating the shorthandpublic java.lang.String getName()
public java.lang.Object clone()
clone
in class java.lang.Object
Copyright 1999-2016 The Apache Software Foundation. All Rights Reserved.