gmazza 2003/12/23 16:06:14 Modified: src/codegen fo-property-mapping.xsl src/java/org/apache/fop/fo FObj.java PropertyList.java Log: Removed the elementStringTable HashMap references (never used; was meant to define element-specific makers for a particular property, instead of the default make for the property) from fo.FObj and fo.PropertyList. Revision Changes Path 1.6 +5 -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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- fo-property-mapping.xsl 22 Dec 2003 21:50:58 -0000 1.5 +++ fo-property-mapping.xsl 24 Dec 2003 00:06:13 -0000 1.6 @@ -111,7 +111,10 @@ 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_htElementStringLists = new HashMap(); // temporary + /* s_htElementLists not currently used; apparently for specifying element-specific + * property makers (instead of the default maker for a particular property); see + * former org.apache.fop.fo.PropertyListBuilder + */ private static HashMap s_htElementLists = new HashMap(); private static HashMap s_htSubPropNames = new HashMap(); private static HashMap s_htPropNames = new HashMap(); @@ -120,14 +123,6 @@ private static HashMap s_ht<xsl:value-of select="localname[1]"/>;</xsl:for-each> <xsl:apply-templates/> - - public static Set getElementStringMappings() { // temporary - return s_htElementStringLists.keySet(); - } - - public static HashMap getElementStringMapping(String elemName) { // temporary - return (HashMap) s_htElementStringLists.get(elemName); - } public static Property.Maker[] getGenericMappings() { return s_htGeneric; 1.27 +0 -13 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.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- FObj.java 22 Dec 2003 23:23:05 -0000 1.26 +++ FObj.java 24 Dec 2003 00:06:13 -0000 1.27 @@ -67,9 +67,6 @@ */ public class FObj extends FONode { private static final String FO_URI = "http://www.w3.org/1999/XSL/Format"; - - public static HashMap elementStringTable = null; // temporary - public static Property.Maker[] propertyListTable = null; /** @@ -105,16 +102,6 @@ */ public FObj(FONode parent) { super(parent); - - if (elementStringTable == null) { - elementStringTable = new HashMap(); - for (Iterator iter = - FOPropertyMapping.getElementStringMappings().iterator(); - iter.hasNext();) { - String elem = (String) iter.next(); - elementStringTable.put(elem, FOPropertyMapping.getElementStringMapping(elem)); - } - } if (propertyListTable == null) { propertyListTable = new Property.Maker[Constants.PROPERTY_COUNT+1]; 1.9 +23 -56 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- PropertyList.java 22 Dec 2003 23:23:05 -0000 1.8 +++ PropertyList.java 24 Dec 2003 00:06:14 -0000 1.9 @@ -124,7 +124,7 @@ private PropertyList parentPropertyList = null; private String namespace = ""; - private String element = ""; + private String elementName = ""; private FObj fobj = null; /** @@ -132,14 +132,14 @@ * @param parentPropertyList the PropertyList belonging to the new objects * parent * @param space name of namespace - * @param el name of element + * @param elementName name of element */ public PropertyList(FObj fObjToAttach, PropertyList parentPropertyList, String space, String elementName) { this.fobj = fObjToAttach; this.parentPropertyList = parentPropertyList; this.namespace = space; - this.element = elementName; + this.elementName = elementName; } /** @@ -178,10 +178,10 @@ } Property p = getExplicitBaseProp(baseName); if (p == null) { - p = getShorthand(namespace, element, baseName); + p = getShorthand(namespace, elementName, baseName); } if (p != null && sepchar > -1) { - return getSubpropValue(namespace, element, baseName, p, + return getSubpropValue(namespace, elementName, baseName, p, propertyName.substring(sepchar + 1)); } @@ -201,7 +201,7 @@ String baseName = propertyName.substring(0, sepchar); Property p = getExplicitBaseProp(baseName); if (p != null) { - return getSubpropValue(namespace, element, baseName, p, + return getSubpropValue(namespace, elementName, baseName, p, propertyName.substring(sepchar + 1)); } else { return null; @@ -228,12 +228,12 @@ */ public Property getInherited(String propertyName) { if (parentPropertyList != null - && isInherited(namespace, element, propertyName)) { + && isInherited(namespace, elementName, propertyName)) { return parentPropertyList.get(propertyName); } else { // return the "initial" value try { - return makeProperty(namespace, element, propertyName); + return makeProperty(namespace, elementName, propertyName); } catch (org.apache.fop.apps.FOPException e) { //log.error("Exception in getInherited(): property=" // + propertyName + " : " + e); @@ -252,20 +252,20 @@ */ private Property findProperty(String propertyName, boolean bTryInherit) { Property p = null; - if (isCorrespondingForced(namespace, element, propertyName)) { - p = computeProperty(namespace, element, propertyName); + if (isCorrespondingForced(namespace, elementName, propertyName)) { + p = computeProperty(namespace, elementName, propertyName); } else { p = getExplicitBaseProp(propertyName); if (p == null) { - p = this.computeProperty(namespace, element, propertyName); + p = this.computeProperty(namespace, elementName, propertyName); } if (p == null) { // check for shorthand specification - p = getShorthand(namespace, element, propertyName); + p = getShorthand(namespace, elementName, propertyName); } if (p == null && bTryInherit) { // else inherit (if has parent and is inheritable) if (this.parentPropertyList != null - && isInherited(namespace, element, propertyName)) { + && isInherited(namespace, elementName, propertyName)) { p = parentPropertyList.findProperty(propertyName, true); } } @@ -317,7 +317,7 @@ Property p = findProperty(propertyName, bTryInherit); if (p == null && bTryDefault) { // default value for this FO! try { - p = makeProperty(namespace, element, propertyName); + p = makeProperty(namespace, elementName, propertyName); } catch (FOPException e) { // don't know what to do here } @@ -332,7 +332,7 @@ } if (subpropName != null && p != null) { - return getSubpropValue(namespace, element, propertyName, p, + return getSubpropValue(namespace, elementName, propertyName, p, subpropName); } else { return p; @@ -350,7 +350,7 @@ * @return element name for this */ public String getElement() { - return element; + return elementName; } /** @@ -369,7 +369,7 @@ if (p == null) { // If no explicit setting found, return initial (default) value. try { - p = makeProperty(namespace, element, propertyName); + p = makeProperty(namespace, elementName, propertyName); } catch (FOPException e) { //log.error("Exception in getNearestSpecified(): property=" // + propertyName + " : " + e); @@ -390,7 +390,7 @@ return parentPropertyList.get(propertyName); } else { try { - return makeProperty(namespace, element, propertyName); + return makeProperty(namespace, elementName, propertyName); } catch (org.apache.fop.apps.FOPException e) { //log.error("Exception in getFromParent(): property=" // + propertyName + " : " + e); @@ -486,19 +486,11 @@ Property.Maker propertyMaker = null; FObj parentFO = fobj.findNearestAncestorFObj(); - HashMap validProperties; - validProperties = (HashMap) FObj.elementStringTable.get(element); - /* Handle "compound" properties, ex. space-before.minimum */ String basePropertyName = findBasePropertyName(attributeName); String subPropertyName = findSubPropertyName(attributeName); - // 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); - } - + propertyMaker = findMaker(namespace, elementName, basePropertyName); if (propertyMaker == null) { handleInvalidProperty(attributeName); return; @@ -731,38 +723,13 @@ // 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; + } else { + return FObj.propertyListTable[propertyId]; } - - 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]