From: Glen Mazza Date: Wed, 24 Dec 2003 00:06:14 +0000 (+0000) Subject: Removed the elementStringTable HashMap references (never used; was X-Git-Tag: Root_Temp_KnuthStylePageBreaking~966 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=51b606aa9153e0d4d0bf43055625beaf5a079a9b;p=xmlgraphics-fop.git 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. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197053 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/codegen/fo-property-mapping.xsl b/src/codegen/fo-property-mapping.xsl index ad2262645..b4acb2c8b 100644 --- a/src/codegen/fo-property-mapping.xsl +++ b/src/codegen/fo-property-mapping.xsl @@ -111,7 +111,10 @@ import org.apache.fop.fo.Property; public class 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(); @@ -121,14 +124,6 @@ public class PropertyMapping implements Constant - 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; } diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index ea0cf09d6..79a6fdcd0 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -67,9 +67,6 @@ import org.xml.sax.Attributes; */ 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; /** @@ -106,16 +103,6 @@ public class FObj extends FONode { 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]; Property.Maker[] list = FOPropertyMapping.getGenericMappings(); diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index 2ceac6681..558ed70eb 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -124,7 +124,7 @@ public class PropertyList extends HashMap { private PropertyList parentPropertyList = null; private String namespace = ""; - private String element = ""; + private String elementName = ""; private FObj fobj = null; /** @@ -132,14 +132,14 @@ public class PropertyList extends HashMap { * @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 @@ public class PropertyList extends HashMap { } 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 @@ public class PropertyList extends HashMap { 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 class PropertyList extends HashMap { */ 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 @@ public class PropertyList extends HashMap { */ 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 @@ public class PropertyList extends HashMap { 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 @@ public class PropertyList extends HashMap { } 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 @@ public class PropertyList extends HashMap { * @return element name for this */ public String getElement() { - return element; + return elementName; } /** @@ -369,7 +369,7 @@ public class PropertyList extends HashMap { 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 @@ public class PropertyList extends HashMap { 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 @@ public class PropertyList extends HashMap { 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 @@ public class PropertyList extends HashMap { // 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; } + }