if (p instanceof ToBeImplementedProperty) {
return p;
}
+
ToBeImplementedProperty val =
new ToBeImplementedProperty(getPropName());
return val;
* Constructor
* @param propName name of Property
*/
- public ToBeImplementedProperty(String propName) {
+ public ToBeImplementedProperty(int propId) {
//XXX: (mjg@recalldesign.com) This is a bit of a kluge, perhaps an
//UnimplementedPropertyException or something similar should
* Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.fop.fo;
+import org.apache.fop.fo.properties.FOPropertyMapping;
/**
* Shorthand property parser for Box properties
* @see org.apache.fop.fo.GenericShorthandParser#convertValueForProperty(String,
* Property.Maker, PropertyList)
*/
- protected Property convertValueForProperty(String propName,
+ protected Property convertValueForProperty(int propId,
Property.Maker maker,
PropertyList propertyList) {
+ String name = FOPropertyMapping.getPropertyName(propId);
Property p = null;
- if (propName.indexOf("-top") >= 0) {
+ if (name.indexOf("-top") >= 0) {
p = getElement(0);
- } else if (propName.indexOf("-right") >= 0) {
+ } else if (name.indexOf("-right") >= 0) {
p = getElement(count() > 1 ? 1 : 0);
- } else if (propName.indexOf("-bottom") >= 0) {
+ } else if (name.indexOf("-bottom") >= 0) {
p = getElement(count() > 2 ? 2 : 0);
- } else if (propName.indexOf("-left") >= 0) {
+ } else if (name.indexOf("-left") >= 0) {
p = getElement(count() > 3 ? 3 : (count() > 1 ? 1 : 0));
}
// if p not null, try to convert it to a value of the correct type
import java.util.Vector;
import java.util.Enumeration;
+import org.apache.fop.fo.properties.FOPropertyMapping;
public class GenericShorthandParser implements ShorthandParser {
*/
protected Property getElement(int index) {
if (list.size() > index) {
- return (Property)list.elementAt(index);
+ return (Property) list.elementAt(index);
} else {
return null;
}
// Stores 1 to 3 values for border width, style, color
// Used for: border, border-top, border-right etc
- public Property getValueForProperty(String propName,
+ public Property getValueForProperty(int propId,
Property.Maker maker,
PropertyList propertyList) {
Property prop = null;
if (count() == 1) {
String sval = ((Property)list.elementAt(0)).getString();
if (sval != null && sval.equals("inherit")) {
- return propertyList.getFromParent(propName);
+ String name = FOPropertyMapping.getPropertyName(propId);
+ return propertyList.getFromParent(name);
}
}
- return convertValueForProperty(propName, maker, propertyList);
+ return convertValueForProperty(propId, maker, propertyList);
}
/**
* Converts a property name into a Property
- * @param propName the String containing the property name
+ * @param propId the property ID in the Constants interface
* @param maker the Property.Maker to be used in the conversion
* @param propertyList the PropertyList from which the Property should be
* extracted
* @return the Property matching the parameters, or null if not found
*/
- protected Property convertValueForProperty(String propName,
+ protected Property convertValueForProperty(int propId,
Property.Maker maker,
PropertyList propertyList) {
Property prop = null;
// Try each of the stored values in turn
Enumeration eprop = list.elements();
while (eprop.hasMoreElements() && prop == null) {
- Property p = (Property)eprop.nextElement();
+ Property p = (Property) eprop.nextElement();
prop = maker.convertShorthandProperty(propertyList, p, null);
}
return prop;
/**
* @return the name of the property for this Maker
*/
- protected String getPropName() {
- return FOPropertyMapping.getPropertyName(this.propId);
+ protected int getPropName() {
+ return propId;
}
/**
* @param propertyName name of property
* @return the Property.Maker for this property
*/
- protected Property.Maker findMaker(String space, String elementName,
+ private Property.Maker findMaker(String space, String elementName,
String propertyName) {
// convert the string (e.g., "font-size") to its const value (PR_FONT_SIZE).
public interface ShorthandParser {
/**
- * @param propName name of the Property
+ * @param propId the property ID in the Constants interface
* @param maker Maker object for the Property
* @param propertyList list of properties
* @return Property object corresponding to propName
*/
- Property getValueForProperty(String propName,
+ Property getValueForProperty(int propId,
Property.Maker maker,
PropertyList propertyList);
}