]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
More String->int conversions.
authorGlen Mazza <gmazza@apache.org>
Wed, 7 Jan 2004 22:25:43 +0000 (22:25 +0000)
committerGlen Mazza <gmazza@apache.org>
Wed, 7 Jan 2004 22:25:43 +0000 (22:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197146 13f79535-47bb-0310-9956-ffa450edef68

src/codegen/properties.xsl
src/java/org/apache/fop/fo/Property.java

index 5a4970963fbe144c1c3ef96b9fb1a13cd50fa728..a787e93e245cbc5586a92dc6a53b502d81042845 100644 (file)
@@ -523,10 +523,12 @@ public class </xsl:text>
         super(propId);</xsl:text>
       <xsl:if test="compound">
         <xsl:text>
-        m_shorthandMaker= getSubpropMaker("</xsl:text>
-        <xsl:value-of select=
-            'compound/subproperty[@set-by-shorthand="true"]/name'/>
-        <xsl:text>");</xsl:text>
+        m_shorthandMaker= getSubpropMaker(Constants.CP_</xsl:text>
+        <xsl:call-template name="makeEnumConstant">
+          <xsl:with-param name="propstr" select=
+                       'compound/subproperty[@set-by-shorthand="true"]/name'/>
+        </xsl:call-template>
+        <xsl:text>);</xsl:text>
       </xsl:if>
       <xsl:text>
     }
@@ -544,7 +546,7 @@ public class </xsl:text>
         return true;
     }
 
-    protected Property.Maker getSubpropMaker(String subprop) {</xsl:text>
+    protected Property.Maker getSubpropMaker(int subpropId) {</xsl:text>
         <xsl:for-each select="compound/subproperty">
           <xsl:variable name="spname">
             <xsl:call-template name="makeClassName">
@@ -552,15 +554,17 @@ public class </xsl:text>
             </xsl:call-template>
           </xsl:variable>
           <xsl:text>
-        if (subprop.equals("</xsl:text>
-          <xsl:value-of select='name'/>
-          <xsl:text>"))
+        if (subpropId == Constants.CP_</xsl:text>
+          <xsl:call-template name="makeEnumConstant">
+            <xsl:with-param name="propstr" select="name"/>
+          </xsl:call-template>
+          <xsl:text>)
             return s_</xsl:text>
           <xsl:value-of select="$spname"/>
           <xsl:text>Maker;</xsl:text>
         </xsl:for-each>
         <xsl:text>
-        return super.getSubpropMaker(subprop);
+        return super.getSubpropMaker(subpropId);
     }
 
     protected Property setSubprop(Property baseProp, int subpropId,
@@ -624,9 +628,11 @@ public class </xsl:text>
        // set default for subprop </xsl:text>
         <xsl:value-of select="."/>
         <xsl:text>
-          subProp = getSubpropMaker("</xsl:text>
-        <xsl:value-of select='.'/>
-        <xsl:text>").make(pList, getDefaultFor</xsl:text>
+       subProp = getSubpropMaker(Constants.CP_</xsl:text>
+        <xsl:call-template name="makeEnumConstant">
+          <xsl:with-param name="propstr" select="."/>
+        </xsl:call-template>
+        <xsl:text>).make(pList, getDefaultFor</xsl:text>
         <xsl:value-of select='$spname'/>
         <xsl:text>(), fo);
        p.setComponent(Constants.CP_</xsl:text>
index febf164a060e36b32e5751968232a49648041d74..6559ffe6d7cd85104cf4ea486212384c21ecd648 100644 (file)
@@ -141,12 +141,12 @@ public class Property {
          * of compound property types, such as "space".
          * Overridden by property maker subclasses which handle
          * compound properties.
-         * @param subprop The name of the component for which a Maker is to
-         * returned, for example "optimum", if the FO attribute is
+         * @param subprop The Constants ID of the component for which a Maker is to
+         * returned, for example CP_OPTIMUM, if the FO attribute is
          * space.optimum='10pt'.
          * @return the Maker object specified
          */
-        protected Maker getSubpropMaker(String subprop) {
+        protected Maker getSubpropMaker(int subpropId) {
             return null;
         }
 
@@ -188,11 +188,11 @@ public class Property {
             if (baseProp == null) {
                 baseProp = makeCompound(propertyList, fo);
             }
-            Maker spMaker = getSubpropMaker(partName);
+            int partId = FOPropertyMapping.getSubPropertyId(partName);
+            Maker spMaker = getSubpropMaker(partId);
             if (spMaker != null) {
                 Property p = spMaker.make(propertyList, value, fo);
                 if (p != null) {
-                    int partId = FOPropertyMapping.getSubPropertyId(partName);
                     return setSubprop(baseProp, partId, p);
                 }
             } else {