diff options
author | Glen Mazza <gmazza@apache.org> | 2003-12-20 17:40:01 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2003-12-20 17:40:01 +0000 |
commit | a93ddf92d90ee5ef8a4995488dc330b289bcdde8 (patch) | |
tree | d3b6a6a33e95a546e8332209612f82eeafaaa4fe /src/java | |
parent | 0223653f86057291343b9d52d6414ebfd869cb6a (diff) | |
download | xmlgraphics-fop-a93ddf92d90ee5ef8a4995488dc330b289bcdde8.tar.gz xmlgraphics-fop-a93ddf92d90ee5ef8a4995488dc330b289bcdde8.zip |
Property Makers now being activated via int constants. (Maker classes themselves, as well as code referencing the properties, still need conversion to int's. Also, HashMaps for String and Integer in FOPropertyMapping and FObj temporarily being retained for troubleshooting purposes.) Contribution mainly from Finn Bock (Bug #25480).
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197043 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/fop/fo/FObj.java | 35 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/PropertyList.java | 17 |
2 files changed, 35 insertions, 17 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 7693fef74..9e65217bc 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -59,6 +59,7 @@ import java.util.Set; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.flow.Marker; +import org.apache.fop.fo.properties.Constants; import org.apache.fop.fo.properties.FOPropertyMapping; import org.xml.sax.Attributes; @@ -68,9 +69,11 @@ 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 propertyListTable = null; - public static HashMap elementTable = null; + public static HashMap propertyListStringTable = null; // temporary + public static HashMap elementStringTable = null; // temporary + public static Property.Maker[] propertyListTable = null; + /** * Formatting properties for this fo element. */ @@ -104,22 +107,30 @@ public class FObj extends FONode { */ public FObj(FONode parent) { super(parent); - - if (propertyListTable == null) { - propertyListTable = new HashMap(); - propertyListTable.putAll(FOPropertyMapping.getGenericMappings()); +/* temporary, during conversions to int constants only + if (propertyListStringTable == null) { + propertyListStringTable = new HashMap(); + propertyListStringTable.putAll(FOPropertyMapping.getGenericStringMappings()); } - - if (elementTable == null) { - elementTable = new HashMap(); +*/ + if (elementStringTable == null) { + elementStringTable = new HashMap(); for (Iterator iter = - FOPropertyMapping.getElementMappings().iterator(); + FOPropertyMapping.getElementStringMappings().iterator(); iter.hasNext();) { String elem = (String) iter.next(); - elementTable.put(elem, FOPropertyMapping.getElementMapping(elem)); + elementStringTable.put(elem, FOPropertyMapping.getElementStringMapping(elem)); } } - + + if (propertyListTable == null) { + propertyListTable = new Property.Maker[Constants.PROPERTY_COUNT+1]; + Property.Maker[] list = FOPropertyMapping.getGenericMappings(); + for (int i = 1; i < list.length; i++) { + if (list[i] != null) + propertyListTable[i] = list[i]; + } + } } /** Marks input file containing this object **/ diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java index ca2d3775b..fc302897c 100644 --- a/src/java/org/apache/fop/fo/PropertyList.java +++ b/src/java/org/apache/fop/fo/PropertyList.java @@ -52,12 +52,12 @@ package org.apache.fop.fo; // Java import java.util.HashMap; -import java.util.Iterator; import org.xml.sax.Attributes; // FOP import org.apache.fop.apps.FOPException; import org.apache.fop.fo.Property.Maker; +import org.apache.fop.fo.properties.FOPropertyMapping; import org.apache.fop.fo.properties.WritingMode; @@ -486,7 +486,7 @@ public class PropertyList extends HashMap { FObj parentFO = fobj.findNearestAncestorFObj(); HashMap validProperties; - validProperties = (HashMap) fobj.elementTable.get(element); + validProperties = (HashMap) FObj.elementStringTable.get(element); /* Handle "compound" properties, ex. space-before.minimum */ String basePropertyName = findBasePropertyName(attributeName); @@ -667,7 +667,7 @@ public class PropertyList extends HashMap { */ protected Property.Maker findMaker(String space, String elementName, String propertyName) { - return findMaker((HashMap) fobj.elementTable.get(elementName), + return findMaker((HashMap) FObj.elementStringTable.get(elementName), propertyName); } @@ -686,8 +686,15 @@ public class PropertyList extends HashMap { propertyMaker = (Property.Maker) elemTable.get(propertyName); } if (propertyMaker == null) { - propertyMaker = - (Property.Maker) fobj.propertyListTable.get(propertyName); + 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; } |