/** Return object used to calculate base Length
* for percent specifications.
*/
public PercentBase getPercentBase(final FObj fo, final PropertyList propertyList) {
return new LengthBase(fo, propertyList, LengthBase.
);
return new LengthBase(fo, propertyList, LengthBase.CUSTOM_BASE) {
public int getBaseLength() {
return (
);
}
});
}
protected boolean isAutoLengthAllowed() {
return true;
}
public Property checkEnumValues(String value) {
return super.checkEnumValues(value);
}
// Initialize hashtable of keywords
static HashMap s_htKeywords;
static {
s_htKeywords = new HashMap(
);
s_htKeywords.put("
", "
");
}
protected String checkValueKeywords(String keyword) {
String value = (String)s_htKeywords.get(keyword);
if (value == null) {
return super.checkValueKeywords(keyword);
}
else return value;
}
// See if other value types are acceptable
protected Property convertPropertyDatatype(
Property p, PropertyList propertyList, FObj fo) {
= p.get
();
if (
!= null) {
return new
(
);
}
return super.convertPropertyDatatype(p, propertyList, fo);
}
protected String getDefaultFor
() {
return "
";
}
private Property m_defaultProp=null;
public Property make(PropertyList propertyList) throws FOPException {
return make(propertyList, "
", propertyList.getParentFObj());
if (m_defaultProp == null) {
m_defaultProp=make(propertyList, "
", propertyList.getParentFObj());
}
return m_defaultProp;
}
Maker
.Maker
Property.Maker
implements Constants
package org.apache.fop.fo.properties;
import java.util.HashMap;
import org.apache.fop.datatypes.*;
import org.apache.fop.fo.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
public class
extends
{
public interface Enums {
int
= Constants.
;
public interface
{
int
= Constants.
;
}
}
protected final static EnumProperty s_prop
= new EnumProperty(
Enums.
);
Enums
Property.Maker
static private class SP_
Maker extends
implements
.
{
SP_
Maker(int sPropName) {
super(sPropName);
}
protected final static EnumProperty s_prop
= new EnumProperty(
);
}
final private static Property.Maker s_
Maker =
new SP_
Maker(
Constants.PR_
|
Constants.CP_
);
final private static Property.Maker s_
Maker =
new
(
Constants.PR_
|
Constants.CP_
);
static public Property.Maker maker(int propertyId) {
return new
(propertyId);
}
protected
(int propId) {
super(propId);
m_shorthandMaker= getSubpropMaker(Constants.CP_
);
}
Property.Maker m_shorthandMaker;
public Property checkEnumValues(String value) {
return m_shorthandMaker.checkEnumValues(value);
}
protected boolean isCompoundMaker() {
return true;
}
protected Property.Maker getSubpropMaker(int subpropId) {
if (subpropId == Constants.CP_
)
return s_
Maker;
return super.getSubpropMaker(subpropId);
}
protected Property setSubprop(Property baseProp, int subpropId,
Property subProp) {
val = baseProp.get
();
// Do some type checking???
// Check if one of our subproperties???
val.setComponent(subpropId, subProp, false);
return baseProp;
}
public Property getSubpropValue(Property baseProp, int subpropId) {
val = baseProp.get
();
return val.getComponent(subpropId);
}
public Property make(PropertyList propertyList) throws FOPException {
return makeCompound(propertyList, propertyList.getParentFObj());
}
private Property m_defaultProp=null;
public Property make(PropertyList propertyList) throws FOPException {
if (m_defaultProp == null) {
m_defaultProp=makeCompound(
propertyList, propertyList.getParentFObj());
}
return m_defaultProp;
}
protected Property makeCompound(PropertyList pList, FObj fo) throws FOPException {
p = new
();
Property subProp;
// set default for subprop
subProp = getSubpropMaker(Constants.CP_
).make(pList, getDefaultFor
(), fo);
p.setComponent(Constants.CP_
, subProp, true);
return new
(p);
}
protected String getDefaultFor
() {
return "
";
return "
";
return "";
}
/** Set the appropriate components when the "base" property is set. */
public Property convertProperty(Property p, PropertyList pList,FObj fo)
throws FOPException {
if (p instanceof
) return p;
if (! (p instanceof EnumProperty)) {
// delegate to the subprop maker to do conversions
p = m_shorthandMaker.convertProperty(p,pList,fo);
}
if (p != null) {
Property prop = makeCompound(pList, fo);
pval = prop.get
();
pval.setComponent(Constants.CP_
, p, false);
return prop;
}
else return null;
}
public boolean isInherited() {
return
;
}
public boolean inheritsSpecified() {
return true;
}
public Property compute(PropertyList propertyList) {
Property computedProperty = null;
Property correspondingProperty = propertyList.get(Constants.PR_
);
if (correspondingProperty != null) {
int correspondingValue = correspondingProperty.getEnum();
if (correspondingValue == Constants.
)
computedProperty = new EnumProperty(
);
else
;
}
return computedProperty;
}
public boolean isCorrespondingForced(PropertyList propertyList) {
FObj parentFO = propertyList.getParentFObj();
if (propertyList.getExplicit(
) != null)
return true;
return false;
}
public Property compute(PropertyList propertyList) throws FOPException {
FObj parentFO = propertyList.getParentFObj();
Property p=null;
// Make sure the property is set before calculating it!
if (propertyList.getExplicitOrShorthand(
) == null)
return p;
StringBuffer sbExpr=new StringBuffer();
sbExpr.setLength(0);
p = make(propertyList, sbExpr.toString(), propertyList.getParentFObj());
p= propertyList.getExplicitOrShorthand(
);
if (p != null) {
p = convertProperty(p, propertyList, parentFO );
}
else p = makeCompound(propertyList, parentFO);
Property subprop;
subprop = getSubpropMaker("
").
make(propertyList, sbExpr.toString(), parentFO);
subprop = propertyList.getExplicitOrShorthand(
);
if (subprop != null) {
setSubprop(p, Constants.CP_
, subprop);
}
return p;
}
public Property getShorthand(PropertyList propertyList) {
Property p = null;
ListProperty listprop;
if (p == null) {
listprop =
(ListProperty)propertyList.getExplicit(Constants.PR_
);
if (listprop != null) {
// Get a parser for the shorthand to set the individual properties
ShorthandParser shparser =
new
(listprop);
p = shparser.getValueForProperty(
getPropId(), this, propertyList);
}
}
return p;
}
}
sbExpr.append("_fop-property-value(");
sbExpr.append(")");
UNKNOWN
sbExpr.append("
");
parentFO.propertyList
propertyList
.wmMap(Constants.PR_
, Constants.PR_
, Constants.PR_
)
sbExpr.append(propertyList.wmRelToAbs(PropertyList.
));
sbExpr.append(parentFO.propertyList.wmRelToAbs(PropertyList.
));
sbExpr.append(propertyList.wmAbsToRel(PropertyList.
));
Conflict between subproperty datatypes:
!=
if (value.equals("
")) {
return s_prop
;
}