gmazza      2003/12/21 17:03:31

  Modified:    src/codegen fo-property-mapping.xsl
               src/java/org/apache/fop/fo FObj.java PropertyList.java
  Log:
  Removal of some of the temporary code elements (FO Element lists still pending.)
  
  Revision  Changes    Path
  1.2       +4 -10     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- fo-property-mapping.xsl   20 Dec 2003 17:40:01 -0000      1.1
  +++ fo-property-mapping.xsl   22 Dec 2003 01:03:31 -0000      1.2
  @@ -79,7 +79,6 @@
     <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"/>String.put("<xsl:value-of 
select="$prop/name"/>", <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("<xsl:value-of 
select="$prop/name"/>");
   <xsl:text>    addPropertyName("</xsl:text><xsl:value-of select="$prop/name"/>", 
PR_<xsl:value-of select="$enum"/>);
   </xsl:template>
  @@ -111,7 +110,6 @@
   public class <xsl:value-of select="@family"/>PropertyMapping implements Constants {
   
     private static Property.Maker[] s_htGeneric = new 
Property.Maker[PROPERTY_COUNT+1];
  -  private static HashMap s_htGenericString = new HashMap();     // temporary
     private static HashMap s_htElementStringLists = new HashMap();    // temporary
     private static HashMap s_htElementLists = new HashMap();
     private static HashMap s_htSubPropNames = new HashMap();
  @@ -122,16 +120,12 @@
   
     <xsl:apply-templates/>
   
  -  public static HashMap getGenericStringMappings() {
  -    return s_htGenericString;
  -  }
  -
  -  public static Set getElementStringMappings() {
  +  public static Set getElementStringMappings() { // temporary
       return s_htElementStringLists.keySet();
     }
   
  -  public static HashMap getElementStringMapping(String elemName) {
  -    return (HashMap)s_htElementStringLists.get(elemName);
  +  public static HashMap getElementStringMapping(String elemName) {  // temporary
  +    return (HashMap) s_htElementStringLists.get(elemName);
     }
   
     public static Property.Maker[] getGenericMappings() {
  
  
  
  1.24      +1 -7      xml-fop/src/java/org/apache/fop/fo/FObj.java
  
  Index: FObj.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- FObj.java 20 Dec 2003 17:40:01 -0000      1.23
  +++ FObj.java 22 Dec 2003 01:03:31 -0000      1.24
  @@ -69,7 +69,6 @@
   public class FObj extends FONode {
       private static final String FO_URI = "http://www.w3.org/1999/XSL/Format";;
   
  -    public static HashMap propertyListStringTable = null;  // temporary
       public static HashMap elementStringTable = null;       // temporary
   
       public static Property.Maker[] propertyListTable = null;
  @@ -107,12 +106,7 @@
        */
       public FObj(FONode parent) {
           super(parent);
  -/*      temporary, during conversions to int constants only
  -        if (propertyListStringTable == null) {
  -            propertyListStringTable = new HashMap();
  -            
propertyListStringTable.putAll(FOPropertyMapping.getGenericStringMappings());
  -        }
  -*/        
  +
           if (elementStringTable == null) {
               elementStringTable = new HashMap();
               for (Iterator iter =
  
  
  
  1.6       +60 -45    xml-fop/src/java/org/apache/fop/fo/PropertyList.java
  
  Index: PropertyList.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyList.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PropertyList.java 20 Dec 2003 17:40:01 -0000      1.5
  +++ PropertyList.java 22 Dec 2003 01:03:31 -0000      1.6
  @@ -57,6 +57,7 @@
   // FOP
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.Property.Maker;
  +import org.apache.fop.fo.properties.Constants;
   import org.apache.fop.fo.properties.FOPropertyMapping;
   import org.apache.fop.fo.properties.WritingMode;
   
  @@ -207,7 +208,7 @@
                   return null;
               }
           }
  -        return (Property)super.get(propertyName);
  +        return (Property) super.get(propertyName);
       }
   
       /**
  @@ -483,6 +484,7 @@
                                               String attributeName,
                                               String attributeValue) {
                                                   
  +        Property.Maker propertyMaker = null;
           FObj parentFO = fobj.findNearestAncestorFObj();
           
           HashMap validProperties;
  @@ -492,8 +494,12 @@
           String basePropertyName = findBasePropertyName(attributeName);
           String subPropertyName = findSubPropertyName(attributeName);
   
  -        Property.Maker propertyMaker = findMaker(validProperties, 
  -            basePropertyName);
  +        // convert the string (e.g., "font-size") to its const value (PR_FONT_SIZE).
  +        int propertyId = FOPropertyMapping.getPropertyId(basePropertyName);
  +        if (propertyId != -1) { // -1 w/namespaces (xmlns:fo, xmlns:svg, etc.)
  +            propertyMaker = findMaker(validProperties, propertyId);
  +        }
  +
           if (propertyMaker == null) {
               handleInvalidProperty(attributeName);
               return;
  @@ -532,10 +538,14 @@
           }
           // If it is specified later in this list of Attributes, create it
           String basePropertyValue = attributes.getValue(basePropName);
  +        
           if (basePropertyValue != null) {
  -            baseProperty = propertyMaker.make(this, basePropertyValue,
  +            int propertyId = FOPropertyMapping.getPropertyId(basePropertyValue);
  +            if (propertyId != -1) {
  +                baseProperty = propertyMaker.make(this, basePropertyValue,
                       parentFO);
  -            return baseProperty;
  +                return baseProperty;
  +            }
           }
           // Otherwise it is a compound property ??
           // baseProperty = propertyMaker.makeCompound(propertyList, parentFO);
  @@ -660,46 +670,6 @@
       }
   
       /**
  -     * @param space namespace of element
  -     * @param elementName name of element
  -     * @param propertyName name of property
  -     * @return the Property.Maker for this property
  -     */
  -    protected Property.Maker findMaker(String space, String elementName,
  -                                       String propertyName) {
  -        return findMaker((HashMap) FObj.elementStringTable.get(elementName),
  -                         propertyName);
  -    }
  -
  -    /**
  -     * Convenience function to return the Maker for a given property
  -     * given the HashMap containing properties specific to this element.
  -     * If table is non-null and
  -     * @param elemTable Element-specific properties or null if none.
  -     * @param propertyName Name of property.
  -     * @return A Maker for this property.
  -     */
  -    private Property.Maker findMaker(HashMap elemTable,
  -                                     String propertyName) {
  -        Property.Maker propertyMaker = null;
  -        if (elemTable != null) {
  -            propertyMaker = (Property.Maker) elemTable.get(propertyName);
  -        }
  -        if (propertyMaker == null) {
  -            int propId = FOPropertyMapping.getPropertyId(propertyName);
  -            if (propId != -1) { // -1 w/namespaces (xmlns:fo, xmlns:svg, etc.)
  -                propertyMaker = FObj.propertyListTable[propId];
  -            }
  -            // old string method (retained temporarily for troubleshooting)
  -            // propertyMaker =   
  -            //     (Property.Maker) FObj.propertyListStringTable.get(propertyName);
  -            // System.out.println(propertyName + "= " + propId + " propMaker = "
  -            //     + ((propertyMaker != null) ? (propertyMaker.toString()) : "(is 
null)"));
  -        }
  -        return propertyMaker;
  -    }
  -
  -    /**
        *
        * @param propertyList collection of properties
        * @param space namespace of element
  @@ -750,5 +720,50 @@
           }
           return b;
       }    
  +
  +    /**
  +     * @param space namespace of element
  +     * @param elementName name of element
  +     * @param propertyName name of property
  +     * @return the Property.Maker for this property
  +     */
  +    protected Property.Maker findMaker(String space, String elementName,
  +        String propertyName) {
  +
  +        // convert the string (e.g., "font-size") to its const value (PR_FONT_SIZE).
  +        int propertyId = FOPropertyMapping.getPropertyId(propertyName);
  +        if (propertyId != -1) { // -1 w/namespaces (xmlns:fo, xmlns:svg, etc.)
  +            return findMaker((HashMap) FObj.elementStringTable.get(elementName),
  +                             propertyId);
  +        } else {
  +            return null;
  +        }
  +    }
  +    
  +    /**
  +     * Convenience function to return the Maker for a given property
  +     * given the HashMap containing properties specific to this element.
  +     * If table is non-null and
  +     * @param elemTable Element-specific properties or null if none.
  +     * @param propId int value of property (see property.Constants)
  +     * @return A Maker for this property.
  +     */
  +    private Property.Maker findMaker(HashMap elemTable,
  +                                     int propertyId) {
  +        
  +        if (propertyId < 1 || propertyId > Constants.PROPERTY_COUNT) {
  +            return null;
  +        }
  +        
  +        Property.Maker propertyMaker = null;
  +        if (elemTable != null) {
  +            String propertyName = FOPropertyMapping.getPropertyName(propertyId);
  +            propertyMaker = (Property.Maker) elemTable.get(propertyName);
  +        }
  +        if (propertyMaker == null) {
  +            propertyMaker = FObj.propertyListTable[propertyId];
  +        }
  +        return propertyMaker;
  +    }
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to