]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
More String->Int conversions, primarily from patch from Finn Bock.
authorGlen Mazza <gmazza@apache.org>
Wed, 31 Dec 2003 01:41:46 +0000 (01:41 +0000)
committerGlen Mazza <gmazza@apache.org>
Wed, 31 Dec 2003 01:41:46 +0000 (01:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197079 13f79535-47bb-0310-9956-ffa450edef68

src/codegen/properties.xsl
src/java/org/apache/fop/fo/Property.java
src/java/org/apache/fop/fo/PropertyList.java
src/java/org/apache/fop/fo/expr/FopPropValFunction.java
src/java/org/apache/fop/fo/flow/Leader.java
src/java/org/apache/fop/fo/flow/TableRow.java
src/java/org/apache/fop/fo/pagination/Region.java

index 83969ee91e8d1dae50406bdb7295e93372500b7e..afe8af966ccb8bee219e2bdf1db4fac5a97d265b 100644 (file)
@@ -735,9 +735,11 @@ public class </xsl:text>
         <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">
index 804a4b890f771b451f441c260de2e36d17e4d8fe..a21480f9a0780250586f06bc703febaa850a0a06 100644 (file)
@@ -95,7 +95,7 @@ public class Property {
 
         /**
          * 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;
index 9c4a092617d9600272721bb38030a75c3c94982c..adb88617f320d06c3c321af8f09012e0a6928ca4 100644 (file)
@@ -285,7 +285,6 @@ public class PropertyList extends HashMap {
         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
index da4c1fdae68c1bd0fab8a92b4f00667a68ae230d..64986858509cbf6ff62c1160cb42e0c544dffbe5 100644 (file)
@@ -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 @@ public class FopPropValFunction extends FunctionBase {
         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);
     }
 
 }
index 538cea7b1423b256867469032da0dc52c8a96415..8711f8ee2a17abaefb2c5af05140042d1aae3ab7 100644 (file)
@@ -62,6 +62,7 @@ import org.apache.fop.fo.properties.CommonBackground;
 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 class Leader extends FObjMixed {
 
     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()
index 272262da6512ba49dddc23f243566941e1f430ae..2225ac94c34ffa1edded5964ac3f6c3f614fb08a 100644 (file)
@@ -68,6 +68,7 @@ import org.apache.fop.fo.properties.CommonAural;
 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 @@ public class TableRow extends FObj {
     }
 
     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());
index 6b97bb5b11fb7ae25e72bbc1fc7256e03076dd88..55a7c6306d16c4bf17bce4b6b899b740686e7e81 100644 (file)
@@ -64,8 +64,6 @@ import org.xml.sax.Attributes;
  */
 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 @@ public abstract class Region extends FObj {
         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.");
             }