gmazza 2003/12/26 15:41:47 Modified: src/java/org/apache/fop/datatypes ToBeImplementedProperty.java src/java/org/apache/fop/fo BoxPropShorthandParser.java GenericShorthandParser.java Property.java PropertyList.java ShorthandParser.java Log: Property.getPropertyName() switched from returning strings to integer constants (perh. should be renamed to getPropertyId()?); change propagated to classes calling this function. Revision Changes Path 1.4 +2 -1 xml-fop/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java Index: ToBeImplementedProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ToBeImplementedProperty.java 22 Dec 2003 03:53:31 -0000 1.3 +++ ToBeImplementedProperty.java 26 Dec 2003 23:41:47 -0000 1.4 @@ -67,6 +67,7 @@ if (p instanceof ToBeImplementedProperty) { return p; } + ToBeImplementedProperty val = new ToBeImplementedProperty(getPropName()); return val; @@ -77,7 +78,7 @@ * Constructor * @param propName name of Property */ - public ToBeImplementedProperty(String propName) { + public ToBeImplementedProperty(int propId) { //XXX: ([EMAIL PROTECTED]) This is a bit of a kluge, perhaps an //UnimplementedPropertyException or something similar should 1.4 +7 -5 xml-fop/src/java/org/apache/fop/fo/BoxPropShorthandParser.java Index: BoxPropShorthandParser.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/BoxPropShorthandParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- BoxPropShorthandParser.java 17 Jul 2003 17:31:28 -0000 1.3 +++ BoxPropShorthandParser.java 26 Dec 2003 23:41:47 -0000 1.4 @@ -49,6 +49,7 @@ * 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 @@ -69,17 +70,18 @@ * @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 1.3 +9 -7 xml-fop/src/java/org/apache/fop/fo/GenericShorthandParser.java Index: GenericShorthandParser.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/GenericShorthandParser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- GenericShorthandParser.java 1 Sep 2003 18:33:05 -0000 1.2 +++ GenericShorthandParser.java 26 Dec 2003 23:41:47 -0000 1.3 @@ -52,6 +52,7 @@ import java.util.Vector; import java.util.Enumeration; +import org.apache.fop.fo.properties.FOPropertyMapping; public class GenericShorthandParser implements ShorthandParser { @@ -72,7 +73,7 @@ */ protected Property getElement(int index) { if (list.size() > index) { - return (Property)list.elementAt(index); + return (Property) list.elementAt(index); } else { return null; } @@ -87,7 +88,7 @@ // 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; @@ -95,29 +96,30 @@ 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; 1.7 +2 -2 xml-fop/src/java/org/apache/fop/fo/Property.java Index: Property.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Property.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Property.java 22 Dec 2003 23:23:05 -0000 1.6 +++ Property.java 26 Dec 2003 23:41:47 -0000 1.7 @@ -81,8 +81,8 @@ /** * @return the name of the property for this Maker */ - protected String getPropName() { - return FOPropertyMapping.getPropertyName(this.propId); + protected int getPropName() { + return propId; } /** 1.10 +1 -1 xml-fop/src/java/org/apache/fop/fo/PropertyList.java Index: PropertyList.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyList.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- PropertyList.java 24 Dec 2003 00:06:14 -0000 1.9 +++ PropertyList.java 26 Dec 2003 23:41:47 -0000 1.10 @@ -718,7 +718,7 @@ * @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). 1.4 +2 -2 xml-fop/src/java/org/apache/fop/fo/ShorthandParser.java Index: ShorthandParser.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/ShorthandParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ShorthandParser.java 26 Jul 2003 06:14:24 -0000 1.3 +++ ShorthandParser.java 26 Dec 2003 23:41:47 -0000 1.4 @@ -57,12 +57,12 @@ 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); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]