gmazza 2003/12/21 19:53:31 Modified: src/codegen fo-property-mapping.xsl properties.xsl src/java/org/apache/fop/datatypes ToBeImplementedProperty.java src/java/org/apache/fop/fo CharacterProperty.java ColorTypeProperty.java CondLengthProperty.java EnumProperty.java KeepProperty.java LengthPairProperty.java LengthProperty.java LengthRangeProperty.java ListProperty.java NumberProperty.java Property.java SpaceProperty.java StringProperty.java Log: ---------------------------------------------------------------------- More of conversion of strings to integers: Makers now being created via int constants in fo.properties.Constants class. Temporary string-int conversions currently in Property.java and PropertyList.java, which converts strings from callers into ints for subsequent use. Revision Changes Path 1.3 +11 -3 xml-fop/src/codegen/fo-property-mapping.xsl Index: fo-property-mapping.xsl =================================================================== RCS file: /home/cvs/xml-fop/src/codegen/fo-property-mapping.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- fo-property-mapping.xsl 22 Dec 2003 01:03:31 -0000 1.2 +++ fo-property-mapping.xsl 22 Dec 2003 03:53:31 -0000 1.3 @@ -79,7 +79,7 @@ <xsl:variable name="lcletters" select="'abcdefghijklmnopqrstuvwxyz-:'" /> <xsl:variable name="ucletters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ__'" /> <xsl:variable name="enum" select="translate($prop/name, $lcletters, $ucletters)"/> -<xsl:text> </xsl:text><xsl:value-of select="$htname"/>[PR_<xsl:value-of select="$enum"/>] =<xsl:value-of select="$makerclass"/>.maker("<xsl:value-of select="$prop/name"/>"); +<xsl:text> </xsl:text><xsl:value-of select="$htname"/>[PR_<xsl:value-of select="$enum"/>] =<xsl:value-of select="$makerclass"/>.maker(PR_<xsl:value-of select="$enum"/>); <xsl:text> addPropertyName("</xsl:text><xsl:value-of select="$prop/name"/>", PR_<xsl:value-of select="$enum"/>); </xsl:template> @@ -154,8 +154,16 @@ return i.intValue(); } + // returns a property, compound, or property.compound name public static String getPropertyName(int id) { - return (String) s_htPropIds.get(new Integer(id)); + if (((id & Constants.COMPOUND_MASK) == 0) + || ((id & Constants.PROPERTY_MASK) == 0)) { + return (String) s_htPropIds.get(new Integer(id)); + } else { + return (String) s_htPropIds.get(new Integer( + id & Constants.PROPERTY_MASK)) + "." + s_htPropIds.get( + new Integer(id & Constants.COMPOUND_MASK)); + } } static { 1.22 +32 -16 xml-fop/src/codegen/properties.xsl Index: properties.xsl =================================================================== RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- properties.xsl 20 Dec 2003 06:53:22 -0000 1.21 +++ properties.xsl 22 Dec 2003 03:53:31 -0000 1.22 @@ -444,7 +444,7 @@ <xsl:text> { SP_</xsl:text> <xsl:value-of select="$spname"/> - <xsl:text>Maker(String sPropName) { + <xsl:text>Maker(int sPropName) { super(sPropName); }</xsl:text> <xsl:for-each select="enumeration/value"> @@ -466,11 +466,19 @@ <xsl:value-of select="$spname"/> <xsl:text>Maker = new SP_</xsl:text><xsl:value-of select="$spname"/> - <xsl:text>Maker("</xsl:text> - <xsl:value-of select='../../name'/> - <xsl:text>.</xsl:text> - <xsl:value-of select='name'/> - <xsl:text>");</xsl:text> + <xsl:text>Maker(</xsl:text> + <xsl:if test="not(../../@type = 'generic')"> + <xsl:text>Constants.PR_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="../../name"/> + </xsl:call-template> + <xsl:text> | </xsl:text> + </xsl:if> + <xsl:text>Constants.CP_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="name"/> + </xsl:call-template> + <xsl:text>);</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> @@ -478,11 +486,19 @@ <xsl:value-of select="$spname"/> <xsl:text>Maker = new </xsl:text><xsl:value-of select="$sp_superclass"/> - <xsl:text>("</xsl:text> - <xsl:value-of select='../../name'/> - <xsl:text>.</xsl:text> - <xsl:value-of select='name'/> - <xsl:text>");</xsl:text> + <xsl:text>(</xsl:text> + <xsl:if test="not(../../@type = 'generic')"> + <xsl:text>Constants.PR_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="../../name"/> + </xsl:call-template> + <xsl:text> | </xsl:text> + </xsl:if> + <xsl:text>Constants.CP_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="name"/> + </xsl:call-template> + <xsl:text>);</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:for-each> @@ -490,16 +506,16 @@ <xsl:text> - static public Property.Maker maker(String propName) { + static public Property.Maker maker(int propertyId) { return new </xsl:text> <xsl:value-of select="$classname"/> - <xsl:text>(propName); + <xsl:text>(propertyId); } protected </xsl:text> <xsl:value-of select="$classname"/> - <xsl:text>(String name) { - super(name);</xsl:text> + <xsl:text>(int propId) { + super(propId);</xsl:text> <xsl:if test="compound"> <xsl:text> m_shorthandMaker= getSubpropMaker("</xsl:text> 1.3 +2 -2 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ToBeImplementedProperty.java 6 Jul 2003 22:38:44 -0000 1.2 +++ ToBeImplementedProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -58,8 +58,8 @@ public static class Maker extends Property.Maker { - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } public Property convertProperty(Property p, 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/CharacterProperty.java Index: CharacterProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/CharacterProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CharacterProperty.java 17 Jul 2003 17:31:28 -0000 1.2 +++ CharacterProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -63,8 +63,8 @@ /** * @param propName name of property for which a Maker should be created */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } public Property make(PropertyList propertyList, String value, 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/ColorTypeProperty.java Index: ColorTypeProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/ColorTypeProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ColorTypeProperty.java 17 Jul 2003 17:31:28 -0000 1.2 +++ ColorTypeProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -65,8 +65,8 @@ /** * @param propName name of property for which a Maker should be created */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } public Property convertProperty(Property p, 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/CondLengthProperty.java Index: CondLengthProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/CondLengthProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CondLengthProperty.java 17 Jul 2003 17:31:28 -0000 1.2 +++ CondLengthProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -66,8 +66,8 @@ /** * @param name of property for which a Maker should be created */ - public Maker(String name) { - super(name); + public Maker(int propId) { + super(propId); } } 1.4 +2 -2 xml-fop/src/java/org/apache/fop/fo/EnumProperty.java Index: EnumProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/EnumProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- EnumProperty.java 27 Sep 2003 20:57:48 -0000 1.3 +++ EnumProperty.java 22 Dec 2003 03:53:31 -0000 1.4 @@ -65,8 +65,8 @@ /** * @param propName name of property for which a Maker should be created */ - protected Maker(String propName) { - super(propName); + protected Maker(int propId) { + super(propId); } /** 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/KeepProperty.java Index: KeepProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/KeepProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- KeepProperty.java 17 Jul 2003 16:38:17 -0000 1.2 +++ KeepProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -65,8 +65,8 @@ /** * @param name name of property for which Maker should be created */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/LengthPairProperty.java Index: LengthPairProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/LengthPairProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- LengthPairProperty.java 17 Jul 2003 07:21:08 -0000 1.2 +++ LengthPairProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -65,8 +65,8 @@ /** * @param name name of property for which this Maker should be created */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } 1.4 +2 -2 xml-fop/src/java/org/apache/fop/fo/LengthProperty.java Index: LengthProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/LengthProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- LengthProperty.java 26 Jul 2003 06:14:24 -0000 1.3 +++ LengthProperty.java 22 Dec 2003 03:53:31 -0000 1.4 @@ -68,8 +68,8 @@ /** * @param name name of property for which Maker should be created */ - public /* protected */ Maker(String name) { - super(name); + public Maker(int propId) { + super(propId); } /** 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/LengthRangeProperty.java Index: LengthRangeProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/LengthRangeProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- LengthRangeProperty.java 17 Jul 2003 07:21:08 -0000 1.2 +++ LengthRangeProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -65,8 +65,8 @@ /** * @param name name of property for which to create Maker */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } 1.4 +2 -2 xml-fop/src/java/org/apache/fop/fo/ListProperty.java Index: ListProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/ListProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ListProperty.java 26 Jul 2003 06:14:24 -0000 1.3 +++ ListProperty.java 22 Dec 2003 03:53:31 -0000 1.4 @@ -65,8 +65,8 @@ /** * @param name name of property for which Maker should be created */ - public Maker(String name) { - super(name); + public Maker(int propId) { + super(propId); } /** 1.4 +2 -2 xml-fop/src/java/org/apache/fop/fo/NumberProperty.java Index: NumberProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/NumberProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NumberProperty.java 26 Jul 2003 06:14:24 -0000 1.3 +++ NumberProperty.java 22 Dec 2003 03:53:31 -0000 1.4 @@ -67,8 +67,8 @@ * Constructor for NumberProperty.Maker * @param propName the name of the property */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } /** 1.4 +11 -9 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Property.java 16 Jul 2003 19:50:31 -0000 1.3 +++ Property.java 22 Dec 2003 03:53:31 -0000 1.4 @@ -61,6 +61,8 @@ import org.apache.fop.fo.expr.Numeric; import org.apache.fop.fo.expr.PropertyParser; import org.apache.fop.fo.expr.PropertyInfo; +import org.apache.fop.fo.properties.Constants; +import org.apache.fop.fo.properties.FOPropertyMapping; import org.apache.fop.apps.FOPException; import java.util.Vector; @@ -75,22 +77,21 @@ * @author unascribed */ public static class Maker { - private static final String UNKNOWN = "UNKNOWN"; - private String propName; + private int propId; /** * @return the name of the property for this Maker */ protected String getPropName() { - return propName; + return FOPropertyMapping.getPropertyName(this.propId); } /** * Construct an instance of a Property.Maker for the given property. - * @param propName The name of the property to be made. + * @param propId The Constant ID of the property to be made. */ - protected Maker(String propName) { - this.propName = propName; + protected Maker(int propId) { + this.propId = propId; } /** @@ -98,7 +99,7 @@ * Note: the property name is set to "UNKNOWN". */ protected Maker() { - this.propName = UNKNOWN; + this.propId = 0; } @@ -252,7 +253,8 @@ } return pret; } catch (org.apache.fop.fo.expr.PropertyException propEx) { - throw new FOPException("Error in " + propName + String propName = FOPropertyMapping.getPropertyName(this.propId); + throw new FOPException("Error in " + propName + " property value '" + value + "': " + propEx); } @@ -416,7 +418,7 @@ if (inheritsSpecified()) { // recalculate based on last specified value // Climb up propertylist and find last spec'd value - // NEED PROPNAME!!! get from Maker + String propName = FOPropertyMapping.getPropertyName(this.propId); Property specProp = propertyList.getNearestSpecified(propName); if (specProp != null) { 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/SpaceProperty.java Index: SpaceProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/SpaceProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SpaceProperty.java 15 Jul 2003 16:18:50 -0000 1.2 +++ SpaceProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -68,8 +68,8 @@ /** * @param name name of the property whose Maker is to be created */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } 1.3 +2 -2 xml-fop/src/java/org/apache/fop/fo/StringProperty.java Index: StringProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/StringProperty.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StringProperty.java 15 Jul 2003 16:18:50 -0000 1.2 +++ StringProperty.java 22 Dec 2003 03:53:31 -0000 1.3 @@ -64,8 +64,8 @@ /** * @param propName name of property for which to create a Maker */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]