gmazza 2003/12/30 17:41:46 Modified: src/codegen properties.xsl src/java/org/apache/fop/fo Property.java PropertyList.java src/java/org/apache/fop/fo/expr FopPropValFunction.java src/java/org/apache/fop/fo/flow Leader.java TableRow.java src/java/org/apache/fop/fo/pagination Region.java Log: More String->Int conversions, primarily from patch from Finn Bock. Revision Changes Path 1.24 +6 -4 xml-fop/src/codegen/properties.xsl Index: properties.xsl =================================================================== RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- properties.xsl 22 Dec 2003 21:37:43 -0000 1.23 +++ properties.xsl 31 Dec 2003 01:41:46 -0000 1.24 @@ -735,9 +735,11 @@ <xsl:text> public Property compute(PropertyList propertyList) { Property computedProperty = null; - Property correspondingProperty = propertyList.get("</xsl:text> - <xsl:value-of select="derive/@from"/> - <xsl:text>"); + Property correspondingProperty = propertyList.get(Constants.PR_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="derive/@from"/> + </xsl:call-template> + <xsl:text>); if (correspondingProperty != null) { int correspondingValue = correspondingProperty.getEnum();</xsl:text> <xsl:for-each select="derive/if"> 1.8 +1 -1 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Property.java 26 Dec 2003 23:41:47 -0000 1.7 +++ Property.java 31 Dec 2003 01:41:46 -0000 1.8 @@ -95,7 +95,7 @@ /** * Construct an instance of a Property.Maker. - * Note: the property name is set to "UNKNOWN". + * Note: the property ID is set to zero */ protected Maker() { this.propId = 0; 1.13 +0 -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.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- PropertyList.java 29 Dec 2003 23:28:47 -0000 1.12 +++ PropertyList.java 31 Dec 2003 01:41:46 -0000 1.13 @@ -285,7 +285,6 @@ return get(propertyName, false, false); } - /** * 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 1.4 +4 -2 xml-fop/src/java/org/apache/fop/fo/expr/FopPropValFunction.java Index: FopPropValFunction.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/expr/FopPropValFunction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FopPropValFunction.java 16 Jul 2003 01:52:26 -0000 1.3 +++ FopPropValFunction.java 31 Dec 2003 01:41:46 -0000 1.4 @@ -51,6 +51,7 @@ package org.apache.fop.fo.expr; import org.apache.fop.fo.Property; +import org.apache.fop.fo.properties.FOPropertyMapping; /** @@ -80,8 +81,9 @@ if (propName == null) { throw new PropertyException("Incorrect parameter to _int-property-value function"); } - // System.err.println("Get property-value for " + propName); - return pInfo.getPropertyList().get(propName); + + int propId = FOPropertyMapping.getPropertyId(propName); + return pInfo.getPropertyList().get(propId); } } 1.18 +3 -0 xml-fop/src/java/org/apache/fop/fo/flow/Leader.java Index: Leader.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Leader.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Leader.java 28 Dec 2003 17:10:17 -0000 1.17 +++ Leader.java 31 Dec 2003 01:41:46 -0000 1.18 @@ -62,6 +62,7 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonMarginInline; import org.apache.fop.fo.properties.CommonRelativePosition; +//import org.apache.fop.fo.properties.FOPropertyMapping; import org.apache.fop.fo.properties.LeaderPattern; import org.apache.fop.fonts.Font; @@ -165,6 +166,8 @@ public int getLength(String prop, int dim) { int length; +// int propId = FOPropertyMapping.getPropertyId(prop); +// System.out.println("prop/propID = " + prop + " " + propId); Length maxlength = propertyList.get(prop).getLength(); if (maxlength instanceof PercentLength) { length = (int)(((PercentLength)maxlength).value() 1.11 +3 -1 xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java Index: TableRow.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- TableRow.java 29 Dec 2003 23:28:47 -0000 1.10 +++ TableRow.java 31 Dec 2003 01:41:46 -0000 1.11 @@ -68,6 +68,7 @@ import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.FOPropertyMapping; /** * Class modelling the fo:table-row object. See Sec. 6.7.9 of the XSL-FO @@ -142,7 +143,8 @@ } private KeepValue getKeepValue(String sPropName) { - Property p = this.propertyList.get(sPropName); + int propId = FOPropertyMapping.getPropertyId(sPropName); + Property p = this.propertyList.get(propId); Number n = p.getNumber(); if (n != null) { return new KeepValue(KeepValue.KEEP_WITH_VALUE, n.intValue()); 1.16 +4 -6 xml-fop/src/java/org/apache/fop/fo/pagination/Region.java Index: Region.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Region.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- Region.java 28 Dec 2003 17:10:17 -0000 1.15 +++ Region.java 31 Dec 2003 01:41:46 -0000 1.16 @@ -64,8 +64,6 @@ */ public abstract class Region extends FObj { - private static final String PROP_REGION_NAME = "region-name"; - /** Key for before regions */ public static final String BEFORE = "before"; /** Key for start regions */ @@ -111,16 +109,16 @@ super.handleAttrs(attlist); // regions may have name, or default - if (null == this.propertyList.get(PROP_REGION_NAME)) { + if (null == this.propertyList.get(PR_REGION_NAME)) { setRegionName(getDefaultRegionName()); - } else if (this.propertyList.get(PROP_REGION_NAME).getString().equals("")) { + } else if (this.propertyList.get(PR_REGION_NAME).getString().equals("")) { setRegionName(getDefaultRegionName()); } else { - setRegionName(this.propertyList.get(PROP_REGION_NAME).getString()); + setRegionName(this.propertyList.get(PR_REGION_NAME).getString()); // check that name is OK. Not very pretty. if (isReserved(getRegionName()) && !getRegionName().equals(getDefaultRegionName())) { - throw new FOPException(PROP_REGION_NAME + " '" + regionName + throw new FOPException("region-name '" + regionName + "' for " + this.name + " not permitted."); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]