]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOPropertyMapping.GetPropertyId() modified to also be able to return
authorGlen Mazza <gmazza@apache.org>
Fri, 2 Jan 2004 23:53:09 +0000 (23:53 +0000)
committerGlen Mazza <gmazza@apache.org>
Fri, 2 Jan 2004 23:53:09 +0000 (23:53 +0000)
(base + compound) ID value for a "base.compound" string; more String->Int
conversions in Leader.java.

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

src/codegen/fo-property-mapping.xsl
src/java/org/apache/fop/fo/flow/Leader.java

index b4acb2c8bb94aa5899d6fb35b02b4aad34136fc5..3c8a504e6d53cdc1064cf8677a8b52163f9801be 100644 (file)
@@ -137,10 +137,27 @@ public class <xsl:value-of select="@family"/>PropertyMapping implements Constant
   }
 
   public static int getPropertyId(String name) {
-       Integer i = (Integer) s_htPropNames.get(name);
-       if (i == null)
-               return -1;
-    return i.intValue();
+    // check to see if base.compound or just base property
+    int sepchar = name.indexOf('.');
+
+    if (sepchar > -1) {
+        Integer baseId = (Integer) s_htPropNames.get(name.substring(0, sepchar));
+        if (baseId == null) {
+            return -1;
+        } else {
+            int cmpdId = getSubPropertyId(name.substring(sepchar + 1));
+            if (cmpdId == -1) {
+                return -1;
+            } else {
+                return baseId.intValue() + cmpdId;
+            }
+        }
+    } else {
+        Integer baseId = (Integer) s_htPropNames.get(name);
+        if (baseId == null)
+            return -1;
+        return baseId.intValue();
+    }
   }
 
   public static int getSubPropertyId(String name) {
index 8711f8ee2a17abaefb2c5af05140042d1aae3ab7..3bb07c739492e49fa03e1525959b7c667d2372e6 100644 (file)
@@ -62,7 +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.FOPropertyMapping;
 import org.apache.fop.fo.properties.LeaderPattern;
 import org.apache.fop.fonts.Font;
 
@@ -166,9 +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();
+        int propId = FOPropertyMapping.getPropertyId(prop);
+        Length maxlength = propertyList.get(propId).getLength();
         if (maxlength instanceof PercentLength) {
             length = (int)(((PercentLength)maxlength).value()
                                       * dim);