gmazza 2004/01/05 16:49:40 Modified: src/codegen properties.xsl src/java/org/apache/fop/datatypes CompoundDatatype.java CondLength.java Keep.java LengthPair.java LengthRange.java Space.java Log: More String->Int conversions. Revision Changes Path 1.27 +14 -10 xml-fop/src/codegen/properties.xsl Index: properties.xsl =================================================================== RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- properties.xsl 5 Jan 2004 00:44:59 -0000 1.26 +++ properties.xsl 6 Jan 2004 00:49:40 -0000 1.27 @@ -566,24 +566,24 @@ protected Property setSubprop(Property baseProp, int subpropId, Property subProp) { </xsl:text> - String subpropName = FOPropertyMapping.getPropertyName(subpropId); <xsl:value-of select="datatype"/> <xsl:text> val = baseProp.get</xsl:text> <xsl:value-of select="datatype"/> <xsl:text>(); // Do some type checking??? // Check if one of our subproperties??? - val.setComponent(subpropName, subProp, false); + val.setComponent(subpropId, subProp, false); return baseProp; } public Property getSubpropValue(Property baseProp, String subpropName) { + int subpropId = org.apache.fop.fo.properties.FOPropertyMapping.getSubPropertyId(subpropName); </xsl:text> <xsl:value-of select="datatype"/> <xsl:text> val = baseProp.get</xsl:text> <xsl:value-of select="datatype"/> <xsl:text>(); - return val.getComponent(subpropName); + return val.getComponent(subpropId); } </xsl:text> <xsl:choose> @@ -630,9 +630,11 @@ <xsl:text>").make(pList, getDefaultFor</xsl:text> <xsl:value-of select='$spname'/> <xsl:text>(), fo); - p.setComponent("</xsl:text> - <xsl:value-of select='.'/> - <xsl:text>", subProp, true);</xsl:text> + p.setComponent(Constants.CP_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="."/> + </xsl:call-template> + <xsl:text>, subProp, true);</xsl:text> </xsl:for-each> <xsl:text> return new </xsl:text> @@ -695,9 +697,11 @@ <xsl:text>();</xsl:text> <xsl:for-each select="compound/[EMAIL PROTECTED]'true']"> <xsl:text> - pval.setComponent("</xsl:text> - <xsl:value-of select='name'/> - <xsl:text>", p, false);</xsl:text> + pval.setComponent(Constants.CP_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="name"/> + </xsl:call-template> + <xsl:text>, p, false);</xsl:text> </xsl:for-each> <xsl:text> return prop; 1.2 +4 -4 xml-fop/src/java/org/apache/fop/datatypes/CompoundDatatype.java Index: CompoundDatatype.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/CompoundDatatype.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CompoundDatatype.java 11 Mar 2003 13:05:36 -0000 1.1 +++ CompoundDatatype.java 6 Jan 2004 00:49:40 -0000 1.2 @@ -59,16 +59,16 @@ /** * Sets a component of the compound datatype. - * @param sCmpnName name of the component + * @param Constants ID of the component * @param cmpnValue value of the component * @param bIsDefault Indicates if it's the default value */ - void setComponent(String sCmpnName, Property cmpnValue, boolean bIsDefault); + void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault); /** * Returns a component of the compound datatype. - * @param sCmpnName name of the component + * @param Constants ID of the component * @return the value of the component */ - Property getComponent(String sCmpnName); + Property getComponent(int cmpId); } 1.4 +8 -8 xml-fop/src/java/org/apache/fop/datatypes/CondLength.java Index: CondLength.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/CondLength.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CondLength.java 31 Dec 2003 00:40:14 -0000 1.3 +++ CondLength.java 6 Jan 2004 00:49:40 -0000 1.4 @@ -63,24 +63,24 @@ private Property conditionality; /** - * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(String, Property, boolean) + * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean) */ - public void setComponent(String sCmpnName, Property cmpnValue, + public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { - if (sCmpnName.equals("length")) { + if (cmpId == Constants.CP_LENGTH) { length = cmpnValue; - } else if (sCmpnName.equals("conditionality")) { + } else if (cmpId == Constants.CP_CONDITIONALITY) { conditionality = cmpnValue; } } /** - * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(String) + * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ - public Property getComponent(String sCmpnName) { - if (sCmpnName.equals("length")) { + public Property getComponent(int cmpId) { + if (cmpId == Constants.CP_LENGTH) { return length; - } else if (sCmpnName.equals("conditionality")) { + } else if (cmpId == Constants.CP_CONDITIONALITY) { return conditionality; } else { return null; 1.5 +11 -15 xml-fop/src/java/org/apache/fop/datatypes/Keep.java Index: Keep.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/Keep.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Keep.java 31 Dec 2003 00:40:14 -0000 1.4 +++ Keep.java 6 Jan 2004 00:49:40 -0000 1.5 @@ -51,6 +51,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; +import org.apache.fop.fo.Constants; /** * XSL FO Keep Property datatype (keep-together, etc) @@ -68,33 +69,28 @@ /** - * From CompoundDatatype - * @param sCmpnName name of compound property to set - * @param cmpnValue property containing value to be set - * @param bIsDefault not used (??) + * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean) */ - public void setComponent(String sCmpnName, Property cmpnValue, + public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { - if (sCmpnName.equals("within-line")) { + if (cmpId == Constants.CP_WITHIN_LINE) { setWithinLine(cmpnValue, bIsDefault); - } else if (sCmpnName.equals("within-column")) { + } else if (cmpId == Constants.CP_WITHIN_COLUMN) { setWithinColumn(cmpnValue, bIsDefault); - } else if (sCmpnName.equals("within-page")) { + } else if (cmpId == Constants.CP_WITHIN_PAGE) { setWithinPage(cmpnValue, bIsDefault); } } /** - * From CompoundDatatype - * @param sCmpnName compound property name - * @return property corresponding to compound property string + * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ - public Property getComponent(String sCmpnName) { - if (sCmpnName.equals("within-line")) { + public Property getComponent(int cmpId) { + if (cmpId == Constants.CP_WITHIN_LINE) { return getWithinLine(); - } else if (sCmpnName.equals("within-column")) { + } else if (cmpId == Constants.CP_WITHIN_COLUMN) { return getWithinColumn(); - } else if (sCmpnName.equals("within-page")) { + } else if (cmpId == Constants.CP_WITHIN_PAGE) { return getWithinPage(); } else { return null; 1.4 +9 -15 xml-fop/src/java/org/apache/fop/datatypes/LengthPair.java Index: LengthPair.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/LengthPair.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- LengthPair.java 31 Dec 2003 00:40:14 -0000 1.3 +++ LengthPair.java 6 Jan 2004 00:49:40 -0000 1.4 @@ -51,6 +51,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; +import org.apache.fop.fo.Constants; /** * Models a pair of lengths, one specifiying the dimensions for the @@ -63,31 +64,24 @@ private Property bpd; /** - * From CompoundDatatype - * @param sCmpnName component name ("block-progression-direction" or - * "inline-progression-direction") which is being set - * @param cmpnValue Property containing the value to be set - * @param bIsDefault true if this is the default property (??) + * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean) */ - public void setComponent(String sCmpnName, Property cmpnValue, + public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { - if (sCmpnName.equals("block-progression-direction")) { + if (cmpId == Constants.CP_BLOCK_PROGRESSION_DIRECTION) { bpd = cmpnValue; - } else if (sCmpnName.equals("inline-progression-direction")) { + } else if (cmpId == Constants.CP_INLINE_PROGRESSION_DIRECTION) { ipd = cmpnValue; } } /** - * From CompoundDatatype - * @param sCmpnName component name ("block-progression-direction" or - * "inline-progression-direction") for which the length is sought - * @return Property containing the length sought + * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ - public Property getComponent(String sCmpnName) { - if (sCmpnName.equals("block-progression-direction")) { + public Property getComponent(int cmpId) { + if (cmpId == Constants.CP_BLOCK_PROGRESSION_DIRECTION) { return getBPD(); - } else if (sCmpnName.equals("inline-progression-direction")) { + } else if (cmpId == Constants.CP_INLINE_PROGRESSION_DIRECTION) { return getIPD(); } else { return null; // SHOULDN'T HAPPEN 1.5 +11 -17 xml-fop/src/java/org/apache/fop/datatypes/LengthRange.java Index: LengthRange.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/LengthRange.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- LengthRange.java 31 Dec 2003 00:40:14 -0000 1.4 +++ LengthRange.java 6 Jan 2004 00:49:40 -0000 1.5 @@ -51,6 +51,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; +import org.apache.fop.fo.Constants; /** * A "progression-dimension" quantity. @@ -69,35 +70,28 @@ private boolean bChecked = false; /** - * From CompoundDatatype - * @param sCmpnName component name ("minimum", "maximum", or "optimum") - * which is being set - * @param cmpnValue Property object to be set - * @param bIsDefault true of this is the default value (??) + * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean) */ - public void setComponent(String sCmpnName, Property cmpnValue, + public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { - if (sCmpnName.equals("minimum")) { + if (cmpId == Constants.CP_MINIMUM) { setMinimum(cmpnValue, bIsDefault); - } else if (sCmpnName.equals("optimum")) { + } else if (cmpId == Constants.CP_OPTIMUM) { setOptimum(cmpnValue, bIsDefault); - } else if (sCmpnName.equals("maximum")) { + } else if (cmpId == Constants.CP_MAXIMUM) { setMaximum(cmpnValue, bIsDefault); } } /** - * From CompoundDatatype - * @param sCmpnName component name ("minimum", "maximum", or "optimum") - * for which the length is sought - * @return the requested Property, or null if the component name is invalid + * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ - public Property getComponent(String sCmpnName) { - if (sCmpnName.equals("minimum")) { + public Property getComponent(int cmpId) { + if (cmpId == Constants.CP_MINIMUM) { return getMinimum(); - } else if (sCmpnName.equals("optimum")) { + } else if (cmpId == Constants.CP_OPTIMUM) { return getOptimum(); - } else if (sCmpnName.equals("maximum")) { + } else if (cmpId == Constants.CP_MAXIMUM) { return getMaximum(); } else { return null; // SHOULDN'T HAPPEN 1.4 +11 -15 xml-fop/src/java/org/apache/fop/datatypes/Space.java Index: Space.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/Space.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Space.java 31 Dec 2003 00:40:14 -0000 1.3 +++ Space.java 6 Jan 2004 00:49:40 -0000 1.4 @@ -51,6 +51,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; +import org.apache.fop.fo.Constants; /** * a space quantity in XSL (space-before, space-after) @@ -61,34 +62,29 @@ private Property conditionality; /** - * From CompoundDatatype - * @param sCmpnName name of component - * @param cmpnValue Property object for the component - * @param bIsDefault true if this is the default (??) + * @see org.apache.fop.datatypes.CompoundDatatype#setComponent(int, Property, boolean) */ - public void setComponent(String sCmpnName, Property cmpnValue, + public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { - if (sCmpnName.equals("precedence")) { + if (cmpId == Constants.CP_PRECEDENCE) { setPrecedence(cmpnValue, bIsDefault); - } else if (sCmpnName.equals("conditionality")) { + } else if (cmpId == Constants.CP_CONDITIONALITY) { setConditionality(cmpnValue, bIsDefault); } else { - super.setComponent(sCmpnName, cmpnValue, bIsDefault); + super.setComponent(cmpId, cmpnValue, bIsDefault); } } /** - * From CompoundDatatype - * @param sCmpnName name of component - * @return Property matching the component name + * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ - public Property getComponent(String sCmpnName) { - if (sCmpnName.equals("precedence")) { + public Property getComponent(int cmpId) { + if (cmpId == Constants.CP_PRECEDENCE) { return getPrecedence(); - } else if (sCmpnName.equals("conditionality")) { + } else if (cmpId == Constants.CP_CONDITIONALITY) { return getConditionality(); } else { - return super.getComponent(sCmpnName); + return super.getComponent(cmpId); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]