]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
----------------------------------------------------------------------
authorGlen Mazza <gmazza@apache.org>
Mon, 22 Dec 2003 03:53:31 +0000 (03:53 +0000)
committerGlen Mazza <gmazza@apache.org>
Mon, 22 Dec 2003 03:53:31 +0000 (03:53 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197047 13f79535-47bb-0310-9956-ffa450edef68

16 files changed:
src/codegen/fo-property-mapping.xsl
src/codegen/properties.xsl
src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java
src/java/org/apache/fop/fo/CharacterProperty.java
src/java/org/apache/fop/fo/ColorTypeProperty.java
src/java/org/apache/fop/fo/CondLengthProperty.java
src/java/org/apache/fop/fo/EnumProperty.java
src/java/org/apache/fop/fo/KeepProperty.java
src/java/org/apache/fop/fo/LengthPairProperty.java
src/java/org/apache/fop/fo/LengthProperty.java
src/java/org/apache/fop/fo/LengthRangeProperty.java
src/java/org/apache/fop/fo/ListProperty.java
src/java/org/apache/fop/fo/NumberProperty.java
src/java/org/apache/fop/fo/Property.java
src/java/org/apache/fop/fo/SpaceProperty.java
src/java/org/apache/fop/fo/StringProperty.java

index ddcba5b1ddc4c4b5fc7a89e696838c0861d3f9b2..33e7e2f91d32aba00a7b12c4e5595cff60c4458c 100644 (file)
@@ -79,7 +79,7 @@ Software Foundation, please see <http://www.apache.org/>.
   <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 @@ public class <xsl:value-of select="@family"/>PropertyMapping implements Constant
     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 &amp; Constants.COMPOUND_MASK) == 0) 
+        || ((id &amp; Constants.PROPERTY_MASK) == 0)) {
+        return (String) s_htPropIds.get(new Integer(id));
+    } else {
+        return (String) s_htPropIds.get(new Integer(
+            id &amp; Constants.PROPERTY_MASK)) + "." + s_htPropIds.get(
+            new Integer(id &amp; Constants.COMPOUND_MASK));
+    }
   }
 
   static {
index 1ff4cbb9f59d53089161d8ad150fdcc0ef3d3998..c0edfa00dc1d223125fd4fb903425a1a7bcb2b7b 100644 (file)
@@ -444,7 +444,7 @@ public class </xsl:text>
               <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 @@ public class </xsl:text>
               <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 @@ public class </xsl:text>
               <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 @@ public class </xsl:text>
 
       <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>
index 4ce30868cc37c396a14a7f8785a9ff30084b6288..ed44aeba5167886c18d39734cf3b6d30611601fc 100644 (file)
@@ -58,8 +58,8 @@ public class ToBeImplementedProperty extends Property {
 
     public static class Maker extends Property.Maker {
 
-        public Maker(String propName) {
-            super(propName);
+        public Maker(int propId) {
+            super(propId);
         }
 
         public Property convertProperty(Property p,
index 102fd33f532933ffd407ac7a1250f30a31dbf53c..d2f670b066cb88d2ef91b3e9b2f27771285bfa40 100644 (file)
@@ -63,8 +63,8 @@ public class CharacterProperty extends Property {
         /**
          * @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,
index 3eaa6fc29006fe1e81bdbed1ac23a9046837c026..4cfaeb6abad89b5b9193dbe467ca58e53ceb1140 100644 (file)
@@ -65,8 +65,8 @@ public class ColorTypeProperty extends Property {
         /**
          * @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,
index 85ebf4e85f97f2f8f65e7bc048ed09393d6fb028..5cfbe469a2a3c96dfea8dbfcf953942de3802037 100644 (file)
@@ -66,8 +66,8 @@ public class CondLengthProperty extends Property {
         /**
          * @param name of property for which a Maker should be created
          */
-        public Maker(String name) {
-            super(name);
+        public Maker(int propId) {
+            super(propId);
         }
 
     }
index b23c8ec5a4449cd3545945e470a36193d3459002..155f41dc00368ba50f3591ccced89c887bae9b18 100644 (file)
@@ -65,8 +65,8 @@ public class EnumProperty extends Property {
         /**
          * @param propName name of property for which a Maker should be created
          */
-        protected Maker(String propName) {
-            super(propName);
+        protected Maker(int propId) {
+            super(propId);
         }
 
         /**
index 9d5e43f779b27c9837a1ef50e5476490b540b9de..bab7c321ffdb4509ee20a1632d5abd76d802801b 100644 (file)
@@ -65,8 +65,8 @@ public class KeepProperty extends Property {
         /**
          * @param name name of property for which Maker should be created
          */
-        protected Maker(String name) {
-            super(name);
+        protected Maker(int propId) {
+            super(propId);
         }
 
     }
index 3098813dc02675bb073b5ccc9d268903314af197..415880e8e9273df2f1b2bbd583bfcb13ebf2b1e1 100644 (file)
@@ -65,8 +65,8 @@ public class LengthPairProperty extends Property {
         /**
          * @param name name of property for which this Maker should be created
          */
-        protected Maker(String name) {
-            super(name);
+        protected Maker(int propId) {
+            super(propId);
         }
 
     }
index ec0f32ca6a92223fb2e0115df1bd7635cbcb346e..09ba76a91f207b720527e2f195c6652da9793c4b 100644 (file)
@@ -68,8 +68,8 @@ public class LengthProperty extends Property {
         /**
          * @param name name of property for which Maker should be created
          */
-        public /* protected */ Maker(String name) {
-            super(name);
+        public Maker(int propId) {
+            super(propId);
         }
 
         /**
index 401040dd835ea81be0764607bb4a0c2f0c66e66b..b2a647a6c662fd051c0d5edbf128aa64cd9c6a7f 100644 (file)
@@ -65,8 +65,8 @@ public class LengthRangeProperty extends Property {
         /**
          * @param name name of property for which to create Maker
          */
-        protected Maker(String name) {
-            super(name);
+        protected Maker(int propId) {
+            super(propId);
         }
 
     }
index c7b2c48fd0f2e1faeac90bbec3c074d6c90e6c24..33a6fcf91b43169b538b9483a120f3d1d2e92fb4 100644 (file)
@@ -65,8 +65,8 @@ public class ListProperty extends Property {
         /**
          * @param name name of property for which Maker should be created
          */
-        public Maker(String name) {
-            super(name);
+        public Maker(int propId) {
+            super(propId);
         }
 
         /**
index 62d55789612227e1110f76760e03cdff65cbc8ce..6e046615cdd2696cc51bc22f9ca405b9eb8ee308 100644 (file)
@@ -67,8 +67,8 @@ public class NumberProperty extends Property {
          * Constructor for NumberProperty.Maker
          * @param propName the name of the property
          */
-        public Maker(String propName) {
-            super(propName);
+        public Maker(int propId) {
+            super(propId);
         }
 
         /**
index 0884e94600c5e8f84a0499dec264fe9f926d038d..8f922efa67894324ffe6f67bc7c5090a248a0b00 100644 (file)
@@ -61,6 +61,8 @@ import org.apache.fop.datatypes.Space;
 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 @@ public class Property {
      * @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 @@ public class Property {
          * Note: the property name is set to "UNKNOWN".
          */
         protected Maker() {
-            this.propName = UNKNOWN;
+            this.propId = 0;
         }
 
 
@@ -252,7 +253,8 @@ public class Property {
                 }
                 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 @@ public class Property {
             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) {
index fde4e6a8c018c03feb015ee6d5a8c6b8e5bb9e47..6439e5eb22e7cbce7bd0775c656fa05923fad383 100644 (file)
@@ -68,8 +68,8 @@ public class SpaceProperty extends Property {
         /**
          * @param name name of the property whose Maker is to be created
          */
-        protected Maker(String name) {
-            super(name);
+        protected Maker(int propId) {
+            super(propId);
         }
 
     }
index 2986e7ca56483cf277d9a5d87d32bb159e5469d3..a2d93d07035959541ab2513be7226a91e79863d0 100644 (file)
@@ -64,8 +64,8 @@ public class StringProperty extends Property {
         /**
          * @param propName name of property for which to create a Maker
          */
-        public Maker(String propName) {
-            super(propName);
+        public Maker(int propId) {
+            super(propId);
         }
 
         /**