You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2004/01/03 00:53:09 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Leader.java

gmazza      2004/01/02 15:53:09

  Modified:    src/codegen fo-property-mapping.xsl
               src/java/org/apache/fop/fo/flow Leader.java
  Log:
  FOPropertyMapping.GetPropertyId() modified to also be able to return
  (base + compound) ID value for a "base.compound" string; more String->Int
  conversions in Leader.java.
  
  Revision  Changes    Path
  1.7       +22 -5     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- fo-property-mapping.xsl	24 Dec 2003 00:06:13 -0000	1.6
  +++ fo-property-mapping.xsl	2 Jan 2004 23:53:09 -0000	1.7
  @@ -137,10 +137,27 @@
     }
   
     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) {
  
  
  
  1.19      +3 -4      xml-fop/src/java/org/apache/fop/fo/flow/Leader.java
  
  Index: Leader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Leader.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Leader.java	31 Dec 2003 01:41:46 -0000	1.18
  +++ Leader.java	2 Jan 2004 23:53:09 -0000	1.19
  @@ -62,7 +62,7 @@
   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 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);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org