}
}
+ /**
+ * @return the namespace of this element
+ */
+ public String getNameSpace() {
+ return namespace;
+ }
+
+ /**
+ * @return element name for this
+ */
+ public String getElement() {
+ return elementName;
+ }
+
/**
* Return the value explicitly specified on this FO.
* @param propertyName The name of the property whose value is desired.
*/
public Property getExplicitOrShorthand(String propertyName) {
/* Handle request for one part of a compound property */
+ int propId = FOPropertyMapping.getPropertyId(propertyName);
+
int sepchar = propertyName.indexOf('.');
String baseName;
if (sepchar > -1) {
p = getShorthand(namespace, elementName, baseName);
}
if (p != null && sepchar > -1) {
- return getSubpropValue(namespace, elementName, baseName, p,
- propertyName.substring(sepchar
- + 1));
+ return getSubpropValue(namespace, elementName, p, propId);
}
return p;
}
* @return The value if the property is explicitly set, otherwise null.
*/
public Property getExplicit(String propertyName) {
+ int propId = FOPropertyMapping.getPropertyId(propertyName);
+
/* Handle request for one part of a compound property */
int sepchar = propertyName.indexOf('.');
if (sepchar > -1) {
String baseName = propertyName.substring(0, sepchar);
Property p = getExplicitBaseProp(baseName);
if (p != null) {
- return getSubpropValue(namespace, elementName, baseName, p,
- propertyName.substring(sepchar + 1));
+ return getSubpropValue(namespace, elementName, p, propId);
} else {
return null;
}
* @return The inherited value, otherwise null.
*/
public Property getInherited(String propertyName) {
+ int propId = FOPropertyMapping.getPropertyId(propertyName);
+
if (parentPropertyList != null
&& isInherited(namespace, elementName, propertyName)) {
- int propertyId = FOPropertyMapping.getPropertyId(propertyName);
- return parentPropertyList.get(propertyId);
+ return parentPropertyList.get(propId);
} else {
// return the "initial" value
try {
- return makeProperty(namespace, elementName, propertyName);
+ return makeProperty(namespace, elementName, propId);
} catch (org.apache.fop.apps.FOPException e) {
//log.error("Exception in getInherited(): property="
// + propertyName + " : " + e);
return null; // Exception in makeProperty!
}
- /*
- * If the property is a relative property with a corresponding absolute
- * value specified, the absolute value is used. This is also true of
- * the inheritance priority (I think...)
- * If the property is an "absolute" property and it isn't specified, then
- * we try to compute it from the corresponding relative property: this
- * happends in computeProperty.
- */
- private Property findProperty(String propertyName, boolean bTryInherit) {
- Property p = null;
- if (isCorrespondingForced(namespace, elementName, propertyName)) {
- p = computeProperty(namespace, elementName, propertyName);
- } else {
- p = getExplicitBaseProp(propertyName);
- if (p == null) {
- p = this.computeProperty(namespace, elementName, propertyName);
- }
- if (p == null) { // check for shorthand specification
- p = getShorthand(namespace, elementName, propertyName);
- }
- if (p == null && bTryInherit) {
- // else inherit (if has parent and is inheritable)
- if (this.parentPropertyList != null
- && isInherited(namespace, elementName, propertyName)) {
- p = parentPropertyList.findProperty(propertyName, true);
- }
- }
- }
- return p;
- }
-
/**
* 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
* @return the Property corresponding to that name
*/
public Property get(int propId) {
- String propertyName = FOPropertyMapping.getPropertyName(propId);
- return get(propertyName, true, true);
+ return get(propId, true, true);
}
/**
* inheritable, to return the inherited value. If all else fails, it returns
* the default value.
*/
- private Property get(String propertyName, boolean bTryInherit,
+ private Property get(int propId, boolean bTryInherit,
boolean bTryDefault) {
- /* Handle request for one part of a compound property */
- int sepchar = propertyName.indexOf('.');
- String subpropName = null;
- if (sepchar > -1) {
- subpropName = propertyName.substring(sepchar + 1);
- propertyName = propertyName.substring(0, sepchar);
- }
-
- Property p = findProperty(propertyName, bTryInherit);
+ Property p = findProperty(propId & Constants.PROPERTY_MASK,
+ bTryInherit);
if (p == null && bTryDefault) { // default value for this FO!
try {
- p = makeProperty(namespace, elementName, propertyName);
+ p = makeProperty(namespace, elementName,
+ propId & Constants.PROPERTY_MASK);
} catch (FOPException e) {
// don't know what to do here
}
// parent
if (p != null && "inherit".equals(p.getSpecifiedValue())) {
if (this.parentPropertyList != null) {
- p = parentPropertyList.get(propertyName, true, false);
+ p = parentPropertyList.get(propId, true, false);
}
}
- if (subpropName != null && p != null) {
- return getSubpropValue(namespace, elementName, propertyName, p,
- subpropName);
+ if ((propId & Constants.COMPOUND_MASK) != 0 && p != null) {
+ return getSubpropValue(namespace, elementName, p,
+ propId);
} else {
return p;
}
}
- /**
- * @return the namespace of this element
+ /*
+ * If the property is a relative property with a corresponding absolute
+ * value specified, the absolute value is used. This is also true of
+ * the inheritance priority (I think...)
+ * If the property is an "absolute" property and it isn't specified, then
+ * we try to compute it from the corresponding relative property: this
+ * happends in computeProperty.
*/
- public String getNameSpace() {
- return namespace;
- }
+ private Property findProperty(int propId, boolean bTryInherit) {
- /**
- * @return element name for this
- */
- public String getElement() {
- return elementName;
+ String propertyName = FOPropertyMapping.getPropertyName(propId);
+
+ Property p = null;
+ if (isCorrespondingForced(namespace, elementName, propertyName)) {
+ p = computeProperty(namespace, elementName, propertyName);
+ } else {
+ p = getExplicitBaseProp(propertyName);
+ if (p == null) {
+ p = this.computeProperty(namespace, elementName, propertyName);
+ }
+ if (p == null) { // check for shorthand specification
+ p = getShorthand(namespace, elementName, propertyName);
+ }
+ if (p == null && bTryInherit) {
+ // else inherit (if has parent and is inheritable)
+ if (this.parentPropertyList != null
+ && isInherited(namespace, elementName, propertyName)) {
+ p = parentPropertyList.findProperty(propId, true);
+ }
+ }
+ }
+ return p;
}
/**
* ancestor of the current FO, else the initial value.
*/
public Property getNearestSpecified(String propertyName) {
+ int propId = FOPropertyMapping.getPropertyId(propertyName);
+
Property p = null;
for (PropertyList plist = this; p == null && plist != null;
plist = plist.parentPropertyList) {
if (p == null) {
// If no explicit setting found, return initial (default) value.
try {
- p = makeProperty(namespace, elementName, propertyName);
+ p = makeProperty(namespace, elementName, propId);
} catch (FOPException e) {
//log.error("Exception in getNearestSpecified(): property="
// + propertyName + " : " + e);
return parentPropertyList.get(propId);
} else {
try {
- return makeProperty(namespace, elementName, propertyName);
+ return makeProperty(namespace, elementName, propId);
} catch (org.apache.fop.apps.FOPException e) {
//log.error("Exception in getFromParent(): property="
// + propertyName + " : " + e);
* @return the sub-property
*/
public Property getSubpropValue(String space, String element,
- String propertyName, Property p,
- String subpropName) {
+ Property p, int propId) {
+
+ String propertyName = FOPropertyMapping.getPropertyName(propId &
+ Constants.PROPERTY_MASK);
+
+ String subpropName = FOPropertyMapping.getPropertyName(propId &
+ Constants.COMPOUND_MASK);
+
Property.Maker maker = findMaker(space, element, propertyName);
if (maker != null) {
return maker.getSubpropValue(p, subpropName);
* @throws FOPException for errors in the input
*/
public Property makeProperty(String space, String element,
- String propertyName) throws FOPException {
+ int propId) throws FOPException {
+ String propertyName = FOPropertyMapping.getPropertyName(propId);
Property p = null;
Property.Maker propertyMaker = findMaker(space, element,
/**
*
- * @param propertyList collection of properties
* @param space namespace of element
* @param element name of element
* @param propertyName name of property