keiron 01/09/24 02:17:12
Modified: src/codegen propmap.xsl
src/org/apache/fop/extensions ExtensionElementMapping.java
src/org/apache/fop/fo DirectPropertyListBuilder.java
FOTreeBuilder.java PropertyListBuilder.java
StandardElementMapping.java TreeBuilder.java
src/org/apache/fop/render/pdf PDFRenderer.java
src/org/apache/fop/svg SVGElementMapping.java
src/org/apache/fop/tools TestConverter.java
Log:
updated to use HashMap so that when using threads reading data
is not synchronized and therefore slower
Revision Changes Path
1.2 +12 -12 xml-fop/src/codegen/propmap.xsl
Index: propmap.xsl
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/propmap.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- propmap.xsl 2000/11/10 21:51:24 1.1
+++ propmap.xsl 2001/09/24 09:17:12 1.2
@@ -35,29 +35,29 @@
<xsl:template match="property-list">
package org.apache.fop.fo.properties;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import org.apache.fop.svg.*;
+import java.util.HashMap;
+import java.util.Set;
+//import org.apache.fop.svg.*;
public class <xsl:value-of select="@family"/>PropertyMapping {
- private static Hashtable s_htGeneric = new Hashtable(200);
- private static Hashtable s_htElementLists = new Hashtable(10);
+ private static HashMap s_htGeneric = new HashMap();
+ private static HashMap s_htElementLists = new HashMap();
<xsl:for-each select="element-property-list">
- private static Hashtable s_ht<xsl:value-of select="localname[1]"/>;</xsl:for-each>
+ private static HashMap s_ht<xsl:value-of select="localname[1]"/>;</xsl:for-each>
<xsl:apply-templates/>
- public static Hashtable getGenericMappings() {
+ public static HashMap getGenericMappings() {
return s_htGeneric;
}
- public static Enumeration getElementMappings() {
- return s_htElementLists.keys();
+ public static Set getElementMappings() {
+ return s_htElementLists.keySet();
}
- public static Hashtable getElementMapping(String elemName) {
- return (Hashtable)s_htElementLists.get(elemName);
+ public static HashMap getElementMapping(String elemName) {
+ return (HashMap)s_htElementLists.get(elemName);
}
}
</xsl:template>
@@ -74,7 +74,7 @@
<xsl:template match="element-property-list">
<xsl:variable name="ename" select="localname[1]"/>
static {
- s_ht<xsl:value-of select="$ename"/> = new Hashtable();
+ s_ht<xsl:value-of select="$ename"/> = new HashMap();
<xsl:for-each select="localname">
s_htElementLists.put("<xsl:value-of select='.'/>", s_ht<xsl:value-of
select='$ename'/>);
</xsl:for-each>
1.4 +15 -8
xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java
Index: ExtensionElementMapping.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExtensionElementMapping.java 2001/07/30 20:29:19 1.3
+++ ExtensionElementMapping.java 2001/09/24 09:17:12 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: ExtensionElementMapping.java,v 1.3 2001/07/30 20:29:19 tore Exp $
+ * $Id: ExtensionElementMapping.java,v 1.4 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -12,23 +12,30 @@
import org.apache.fop.fo.TreeBuilder;
import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Iterator;
public class ExtensionElementMapping implements ElementMapping {
public static final String URI = "http://xml.apache.org/fop/extensions";
- public void addToBuilder(TreeBuilder builder) {
- builder.addMapping(URI, "outline", Outline.maker());
- builder.addMapping(URI, "label", Label.maker());
+ private static HashMap foObjs = null;
+ public synchronized void addToBuilder(TreeBuilder builder) {
+ if(foObjs == null) {
+ foObjs = new HashMap();
+ foObjs.put("outline", Outline.maker());
+ foObjs.put("label", Label.maker());
+ }
+ builder.addMapping(URI, foObjs);
+
builder.addPropertyList(ExtensionElementMapping.URI,
ExtensionPropertyMapping.getGenericMappings());
/* Add any element mappings */
- for (Enumeration e = ExtensionPropertyMapping.getElementMappings();
- e.hasMoreElements(); ) {
- String elem = (String)e.nextElement();
+ for (Iterator iter =
ExtensionPropertyMapping.getElementMappings().iterator();
+ iter.hasNext(); ) {
+ String elem = (String)iter.next();
builder.addElementPropertyList(ExtensionElementMapping.URI, elem,
ExtensionPropertyMapping.getElementMapping(elem));
}
1.3 +2 -2 xml-fop/src/org/apache/fop/fo/DirectPropertyListBuilder.java
Index: DirectPropertyListBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/DirectPropertyListBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DirectPropertyListBuilder.java 2001/09/13 07:49:32 1.2
+++ DirectPropertyListBuilder.java 2001/09/24 09:17:12 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: DirectPropertyListBuilder.java,v 1.2 2001/09/13 07:49:32 keiron Exp $
+ * $Id: DirectPropertyListBuilder.java,v 1.3 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -28,7 +28,7 @@
public DirectPropertyListBuilder() {
}
- public PropertyList makeList(String elementName, Attributes attributes,
+ public PropertyList makeList(String uri, String elementName, Attributes
attributes,
PropertyList parentPropertyList,
FObj parentFO) throws FOPException {
AttrPropertyList ret = new AttrPropertyList(attributes);
1.29 +14 -13 xml-fop/src/org/apache/fop/fo/FOTreeBuilder.java
Index: FOTreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOTreeBuilder.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- FOTreeBuilder.java 2001/09/13 07:49:32 1.28
+++ FOTreeBuilder.java 2001/09/24 09:17:12 1.29
@@ -1,5 +1,5 @@
/*
- * $Id: FOTreeBuilder.java,v 1.28 2001/09/13 07:49:32 keiron Exp $
+ * $Id: FOTreeBuilder.java,v 1.29 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -25,7 +25,7 @@
import org.xml.sax.Attributes;
// Java
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.Stack;
import java.util.Vector;
import java.io.IOException;
@@ -47,14 +47,14 @@
* table mapping element names to the makers of objects
* representing formatting objects
*/
- protected Hashtable fobjTable = new Hashtable();
+ protected HashMap fobjTable = new HashMap();
protected Vector namespaces = new Vector();
/**
* class that builds a property list for each formatting object
*/
- protected Hashtable propertylistTable = new Hashtable();
+ protected HashMap propertylistTable = new HashMap();
/**
* current formatting object being handled
@@ -71,7 +71,7 @@
/**
* set of names of formatting objects encountered but unknown
*/
- protected Hashtable unknownFOs = new Hashtable();
+ protected HashMap unknownFOs = new HashMap();
/**
*
@@ -99,9 +99,8 @@
* @param localName local name of formatting object element
* @param maker Maker for class representing formatting object
*/
- public void addMapping(String namespaceURI, String localName,
- FObj.Maker maker) {
- this.fobjTable.put(namespaceURI + "^" + localName, maker);
+ public void addMapping(String namespaceURI, HashMap table) {
+ this.fobjTable.put(namespaceURI, table);
this.namespaces.addElement(namespaceURI.intern());
}
@@ -112,7 +111,7 @@
* @param localName local name of formatting object element
* @param maker Maker for class representing formatting object
*/
- public void addPropertyList(String namespaceURI, Hashtable list) {
+ public void addPropertyList(String namespaceURI, HashMap list) {
PropertyListBuilder plb;
plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
if (plb == null) {
@@ -132,7 +131,7 @@
* @param maker Maker for class representing formatting object
*/
public void addElementPropertyList(String namespaceURI, String localName,
- Hashtable list) {
+ HashMap list) {
PropertyListBuilder plb;
plb = (PropertyListBuilder)this.propertylistTable.get(namespaceURI);
if (plb == null) {
@@ -214,13 +213,15 @@
FObj.Maker fobjMaker;
// String fullName = mapName(rawName);
- String fullName = uri + "^" + localName;
- fobjMaker = (FObj.Maker)fobjTable.get(fullName);
+ //String fullName = uri + "^" + localName;
+ HashMap table = (HashMap)fobjTable.get(uri);
+ fobjMaker = (FObj.Maker)table.get(localName);
PropertyListBuilder currentListBuilder =
(PropertyListBuilder)this.propertylistTable.get(uri);
boolean foreignXML = false;
if (fobjMaker == null) {
+ String fullName = uri + "^" + localName;
if (!this.unknownFOs.containsKey(fullName)) {
this.unknownFOs.put(fullName, "");
log.error("Unknown formatting object "
@@ -239,7 +240,7 @@
PropertyList list = null;
if (currentListBuilder != null) {
list =
- currentListBuilder.makeList(fullName, attlist,
+ currentListBuilder.makeList(uri, localName, attlist,
(currentFObj == null) ? null
: currentFObj.properties,
currentFObj);
} else if(foreignXML) {
1.32 +18 -20 xml-fop/src/org/apache/fop/fo/PropertyListBuilder.java
Index: PropertyListBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyListBuilder.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- PropertyListBuilder.java 2001/09/11 10:04:24 1.31
+++ PropertyListBuilder.java 2001/09/24 09:17:12 1.32
@@ -1,5 +1,5 @@
/*
- * $Id: PropertyListBuilder.java,v 1.31 2001/09/11 10:04:24 keiron Exp $
+ * $Id: PropertyListBuilder.java,v 1.32 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -16,7 +16,7 @@
import org.xml.sax.Attributes;
-import java.util.Hashtable;
+import java.util.HashMap;
public class PropertyListBuilder {
@@ -25,19 +25,19 @@
*/
private static final String FONTSIZEATTR = "font-size";
- private Hashtable propertyListTable;
- private Hashtable elementTable;
+ private HashMap propertyListTable;
+ private HashMap elementTable;
public PropertyListBuilder() {
- this.propertyListTable = new Hashtable();
- this.elementTable = new Hashtable();
+ this.propertyListTable = new HashMap();
+ this.elementTable = new HashMap();
}
- public void addList(Hashtable list) {
- propertyListTable = list; // should add all
+ public void addList(HashMap list) {
+ propertyListTable.putAll(list);
}
- public void addElementList(String element, Hashtable list) {
+ public void addElementList(String element, HashMap list) {
elementTable.put(element, list);
}
@@ -78,13 +78,12 @@
return b;
}
- public PropertyList makeList(String elementName, Attributes attributes,
+ public PropertyList makeList(String ns, String elementName, Attributes
attributes,
PropertyList parentPropertyList,
FObj parentFO) throws FOPException {
- int index = elementName.indexOf("^");
String space = "http://www.w3.org/TR/1999/XSL/Format";
- if (index != -1) {
- space = elementName.substring(0, index);
+ if (ns != null) {
+ space = ns;
}
PropertyList par = null;
@@ -92,12 +91,11 @@
&& space.equals(parentPropertyList.getNameSpace())) {
par = parentPropertyList;
}
- // System.out.println(elementName.substring(index + 1));
PropertyList p = new PropertyList(par, space,
- elementName.substring(index + 1));
+ elementName);
p.setBuilder(this);
- Hashtable table;
- table = (Hashtable)elementTable.get(elementName.substring(index + 1));
+ HashMap table;
+ table = (HashMap)elementTable.get(elementName);
/* Store names of properties already set. */
StringBuffer propsDone = new StringBuffer(256);
@@ -235,19 +233,19 @@
protected Property.Maker findMaker(String space, String elementName,
String propertyName) {
- return findMaker((Hashtable)elementTable.get(elementName),
+ return findMaker((HashMap)elementTable.get(elementName),
propertyName);
}
/**
* Convenience function to return the Maker for a given property
- * given the Hashtable containing properties specific to this element.
+ * 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(Hashtable elemTable,
+ private Property.Maker findMaker(HashMap elemTable,
String propertyName) {
Property.Maker propertyMaker = null;
if (elemTable != null) {
1.26 +82 -75 xml-fop/src/org/apache/fop/fo/StandardElementMapping.java
Index: StandardElementMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/StandardElementMapping.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- StandardElementMapping.java 2001/07/30 20:29:20 1.25
+++ StandardElementMapping.java 2001/09/24 09:17:12 1.26
@@ -1,5 +1,5 @@
/*
- * $Id: StandardElementMapping.java,v 1.25 2001/07/30 20:29:20 tore Exp $
+ * $Id: StandardElementMapping.java,v 1.26 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,107 +8,114 @@
package org.apache.fop.fo;
import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Iterator;
import org.apache.fop.fo.properties.FOPropertyMapping;
import org.apache.fop.fo.flow.*;
import org.apache.fop.fo.pagination.*;
public class StandardElementMapping implements ElementMapping {
+ private static HashMap foObjs = null;
- public void addToBuilder(TreeBuilder builder) {
+ public synchronized void addToBuilder(TreeBuilder builder) {
- String uri = "http://www.w3.org/1999/XSL/Format";
+ if(foObjs == null) {
+ foObjs = new HashMap();
- // Declarations and Pagination and Layout Formatting Objects
- builder.addMapping(uri, "root", Root.maker());
- builder.addMapping(uri, "declarations", Declarations.maker());
- builder.addMapping(uri, "color-profile", ColorProfile.maker());
- builder.addMapping(uri, "page-sequence", PageSequence.maker());
- builder.addMapping(uri, "layout-master-set", LayoutMasterSet.maker());
- builder.addMapping(uri, "page-sequence-master",
+ // Declarations and Pagination and Layout Formatting Objects
+ foObjs.put("root", Root.maker());
+ foObjs.put("declarations", Declarations.maker());
+ foObjs.put("color-profile", ColorProfile.maker());
+ foObjs.put("page-sequence", PageSequence.maker());
+ foObjs.put("layout-master-set", LayoutMasterSet.maker());
+ foObjs.put("page-sequence-master",
PageSequenceMaster.maker());
- builder.addMapping(uri, "single-page-master-reference",
+ foObjs.put("single-page-master-reference",
SinglePageMasterReference.maker());
- builder.addMapping(uri, "repeatable-page-master-reference",
+ foObjs.put("repeatable-page-master-reference",
RepeatablePageMasterReference.maker());
- builder.addMapping(uri, "repeatable-page-master-alternatives",
+ foObjs.put("repeatable-page-master-alternatives",
RepeatablePageMasterAlternatives.maker());
- builder.addMapping(uri, "conditional-page-master-reference",
+ foObjs.put("conditional-page-master-reference",
ConditionalPageMasterReference.maker());
- builder.addMapping(uri, "simple-page-master",
+ foObjs.put("simple-page-master",
SimplePageMaster.maker());
- builder.addMapping(uri, "region-body", RegionBody.maker());
- builder.addMapping(uri, "region-before", RegionBefore.maker());
- builder.addMapping(uri, "region-after", RegionAfter.maker());
- builder.addMapping(uri, "region-start", RegionStart.maker());
- builder.addMapping(uri, "region-end", RegionEnd.maker());
- builder.addMapping(uri, "flow", Flow.maker());
- builder.addMapping(uri, "static-content", StaticContent.maker());
- builder.addMapping(uri, "title", Title.maker());
-
- // Block-level Formatting Objects
- builder.addMapping(uri, "block", Block.maker());
- builder.addMapping(uri, "block-container", BlockContainer.maker());
-
- // Inline-level Formatting Objects
- builder.addMapping(uri, "bidi-override", BidiOverride.maker());
- builder.addMapping(uri, "character",
+ foObjs.put("region-body", RegionBody.maker());
+ foObjs.put("region-before", RegionBefore.maker());
+ foObjs.put("region-after", RegionAfter.maker());
+ foObjs.put("region-start", RegionStart.maker());
+ foObjs.put("region-end", RegionEnd.maker());
+ foObjs.put("flow", Flow.maker());
+ foObjs.put("static-content", StaticContent.maker());
+ foObjs.put("title", Title.maker());
+
+ // Block-level Formatting Objects
+ foObjs.put("block", Block.maker());
+ foObjs.put("block-container", BlockContainer.maker());
+
+ // Inline-level Formatting Objects
+ foObjs.put("bidi-override", BidiOverride.maker());
+ foObjs.put("character",
org.apache.fop.fo.flow.Character.maker());
- builder.addMapping(uri, "initial-property-set",
+ foObjs.put("initial-property-set",
InitialPropertySet.maker());
- builder.addMapping(uri, "external-graphic", ExternalGraphic.maker());
- builder.addMapping(uri, "instream-foreign-object",
+ foObjs.put("external-graphic", ExternalGraphic.maker());
+ foObjs.put("instream-foreign-object",
InstreamForeignObject.maker());
- builder.addMapping(uri, "inline", Inline.maker());
- builder.addMapping(uri, "inline-container", InlineContainer.maker());
- builder.addMapping(uri, "leader", Leader.maker());
- builder.addMapping(uri, "page-number", PageNumber.maker());
- builder.addMapping(uri, "page-number-citation",
+ foObjs.put("inline", Inline.maker());
+ foObjs.put("inline-container", InlineContainer.maker());
+ foObjs.put("leader", Leader.maker());
+ foObjs.put("page-number", PageNumber.maker());
+ foObjs.put("page-number-citation",
PageNumberCitation.maker());
- // Formatting Objects for Tables
- builder.addMapping(uri, "table-and-caption", TableAndCaption.maker());
- builder.addMapping(uri, "table", Table.maker());
- builder.addMapping(uri, "table-column", TableColumn.maker());
- builder.addMapping(uri, "table-caption", TableCaption.maker());
- builder.addMapping(uri, "table-header", TableHeader.maker());
- builder.addMapping(uri, "table-footer", TableFooter.maker());
- builder.addMapping(uri, "table-body", TableBody.maker());
- builder.addMapping(uri, "table-row", TableRow.maker());
- builder.addMapping(uri, "table-cell", TableCell.maker());
-
- // Formatting Objects for Lists
- builder.addMapping(uri, "list-block", ListBlock.maker());
- builder.addMapping(uri, "list-item", ListItem.maker());
- builder.addMapping(uri, "list-item-body", ListItemBody.maker());
- builder.addMapping(uri, "list-item-label", ListItemLabel.maker());
-
- // Dynamic Effects: Link and Multi Formatting Objects
- builder.addMapping(uri, "basic-link", BasicLink.maker());
- builder.addMapping(uri, "multi-switch", MultiSwitch.maker());
- builder.addMapping(uri, "multi-case", MultiCase.maker());
- builder.addMapping(uri, "multi-toggle", MultiToggle.maker());
- builder.addMapping(uri, "multi-properties", MultiProperties.maker());
- builder.addMapping(uri, "multi-property-set",
+ // Formatting Objects for Tables
+ foObjs.put("table-and-caption", TableAndCaption.maker());
+ foObjs.put("table", Table.maker());
+ foObjs.put("table-column", TableColumn.maker());
+ foObjs.put("table-caption", TableCaption.maker());
+ foObjs.put("table-header", TableHeader.maker());
+ foObjs.put("table-footer", TableFooter.maker());
+ foObjs.put("table-body", TableBody.maker());
+ foObjs.put("table-row", TableRow.maker());
+ foObjs.put("table-cell", TableCell.maker());
+
+ // Formatting Objects for Lists
+ foObjs.put("list-block", ListBlock.maker());
+ foObjs.put("list-item", ListItem.maker());
+ foObjs.put("list-item-body", ListItemBody.maker());
+ foObjs.put("list-item-label", ListItemLabel.maker());
+
+ // Dynamic Effects: Link and Multi Formatting Objects
+ foObjs.put("basic-link", BasicLink.maker());
+ foObjs.put("multi-switch", MultiSwitch.maker());
+ foObjs.put("multi-case", MultiCase.maker());
+ foObjs.put("multi-toggle", MultiToggle.maker());
+ foObjs.put("multi-properties", MultiProperties.maker());
+ foObjs.put("multi-property-set",
MultiPropertySet.maker());
- // Out-of-Line Formatting Objects
- builder.addMapping(uri, "float",
+ // Out-of-Line Formatting Objects
+ foObjs.put("float",
org.apache.fop.fo.flow.Float.maker());
- builder.addMapping(uri, "footnote", Footnote.maker());
- builder.addMapping(uri, "footnote-body", FootnoteBody.maker());
+ foObjs.put("footnote", Footnote.maker());
+ foObjs.put("footnote-body", FootnoteBody.maker());
+
+ // Other Formatting Objects
+ foObjs.put("wrapper", Wrapper.maker());
+ foObjs.put("marker", Marker.maker());
+ foObjs.put("retrieve-marker", RetrieveMarker.maker());
+ }
- // Other Formatting Objects
- builder.addMapping(uri, "wrapper", Wrapper.maker());
- builder.addMapping(uri, "marker", Marker.maker());
- builder.addMapping(uri, "retrieve-marker", RetrieveMarker.maker());
+ String uri = "http://www.w3.org/1999/XSL/Format";
+ builder.addMapping(uri, foObjs);
builder.addPropertyList(uri, FOPropertyMapping.getGenericMappings());
/* Add any element mappings */
- for (Enumeration e = FOPropertyMapping.getElementMappings();
- e.hasMoreElements(); ) {
- String elem = (String)e.nextElement();
+ for (Iterator iter = FOPropertyMapping.getElementMappings().iterator();
+ iter.hasNext(); ) {
+ String elem = (String)iter.next();
builder.addElementPropertyList(uri, elem,
FOPropertyMapping.getElementMapping(elem));
}
1.5 +5 -6 xml-fop/src/org/apache/fop/fo/TreeBuilder.java
Index: TreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/TreeBuilder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TreeBuilder.java 2001/09/12 09:28:13 1.4
+++ TreeBuilder.java 2001/09/24 09:17:12 1.5
@@ -1,5 +1,5 @@
/*
- * $Id: TreeBuilder.java,v 1.4 2001/09/12 09:28:13 keiron Exp $
+ * $Id: TreeBuilder.java,v 1.5 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,7 +8,7 @@
package org.apache.fop.fo;
// Java
-import java.util.Hashtable;
+import java.util.HashMap;
/**
*/
@@ -22,8 +22,7 @@
* @param localName local name of formatting object element
* @param maker Maker for class representing formatting object
*/
- public void addMapping(String namespaceURI, String localName,
- FObj.Maker maker);
+ public void addMapping(String namespaceURI, HashMap table);
/**
* add a mapping from element name to maker.
@@ -32,7 +31,7 @@
* @param localName local name of formatting object element
* @param maker Maker for class representing formatting object
*/
- public void addPropertyList(String namespaceURI, Hashtable list);
+ public void addPropertyList(String namespaceURI, HashMap list);
public void addPropertyListBuilder(String namespaceURI, PropertyListBuilder
list);
@@ -44,6 +43,6 @@
* @param maker Maker for class representing formatting object
*/
public void addElementPropertyList(String namespaceURI, String localName,
- Hashtable list);
+ HashMap list);
}
1.90 +1 -5 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- PDFRenderer.java 2001/09/24 07:31:52 1.89
+++ PDFRenderer.java 2001/09/24 09:17:12 1.90
@@ -1,5 +1,5 @@
/*
- * $Id: PDFRenderer.java,v 1.89 2001/09/24 07:31:52 keiron Exp $
+ * $Id: PDFRenderer.java,v 1.90 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -622,8 +622,6 @@
}
}
-
-
/**
* Convert a char to a multibyte hex representation
*/
@@ -657,7 +655,6 @@
}
-
/**
* Checks to see if we have some text rendering commands open
* still and writes out the TJ command to the stream if we do
@@ -813,7 +810,6 @@
}
}
}
-
}
private void renderOutline(Outline outline) {
1.16 +63 -54 xml-fop/src/org/apache/fop/svg/SVGElementMapping.java
Index: SVGElementMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGElementMapping.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SVGElementMapping.java 2001/09/12 09:28:13 1.15
+++ SVGElementMapping.java 2001/09/24 09:17:12 1.16
@@ -1,5 +1,5 @@
/*
- * $Id: SVGElementMapping.java,v 1.15 2001/09/12 09:28:13 keiron Exp $
+ * $Id: SVGElementMapping.java,v 1.16 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,6 +8,7 @@
package org.apache.fop.svg;
import java.util.Enumeration;
+import java.util.HashMap;
import org.apache.fop.fo.DirectPropertyListBuilder;
import org.apache.fop.fo.TreeBuilder;
@@ -16,60 +17,68 @@
public class SVGElementMapping implements ElementMapping {
- public void addToBuilder(TreeBuilder builder) {
+ private static HashMap foObjs = null;
+
+ public synchronized void addToBuilder(TreeBuilder builder) {
+
+ if(foObjs == null) {
+ foObjs = new HashMap();
+ foObjs.put("svg", SVGElement.maker());
+ foObjs.put("rect", SVGObj.maker("rect"));
+ foObjs.put("line", SVGObj.maker("line"));
+ foObjs.put("text", SVGObj.maker("text"));
+
+ foObjs.put("desc", SVGObj.maker("desc"));
+ foObjs.put("title", SVGObj.maker("title"));
+ foObjs.put("circle", SVGObj.maker("circle"));
+ foObjs.put("ellipse", SVGObj.maker("ellipse"));
+ foObjs.put("g", SVGObj.maker("g"));
+ foObjs.put("polyline", SVGObj.maker("polyline"));
+ foObjs.put("polygon", SVGObj.maker("polygon"));
+ foObjs.put("defs", SVGObj.maker("defs"));
+ foObjs.put("path", SVGObj.maker("path"));
+ foObjs.put("use", SVGObj.maker("use"));
+ foObjs.put("tspan", SVGObj.maker("tspan"));
+ foObjs.put("tref", SVGObj.maker("tref"));
+ foObjs.put("image", SVGObj.maker("image"));
+ foObjs.put("style", SVGObj.maker("style"));
+
+ foObjs.put("textPath", SVGObj.maker("textPath"));
+ foObjs.put("clipPath", SVGObj.maker("clipPath"));
+ foObjs.put("mask", SVGObj.maker("mask"));
+ foObjs.put("linearGradient", SVGObj.maker("linearGradient"));
+ foObjs.put("radialGradient", SVGObj.maker("radialGradient"));
+ foObjs.put("stop", SVGObj.maker("stop"));
+ foObjs.put("a", SVGObj.maker("a"));
+ foObjs.put("switch", SVGObj.maker("switch"));
+ foObjs.put("symbol", SVGObj.maker("symbol"));
+
+ foObjs.put("pattern", SVGObj.maker("pattern"));
+
+ foObjs.put("marker", SVGObj.maker("marker"));
+ foObjs.put("animate", SVGObj.maker("animate"));
+ foObjs.put("altGlyph", SVGObj.maker("altGlyph"));
+ foObjs.put("font", SVGObj.maker("font"));
+ foObjs.put("glyph", SVGObj.maker("glyph"));
+ foObjs.put("missing-glyph", SVGObj.maker("missing-glyph"));
+ foObjs.put("hkern", SVGObj.maker("hkern"));
+ foObjs.put("vkern", SVGObj.maker("vkern"));
+ foObjs.put("set", SVGObj.maker("set"));
+ foObjs.put("animateMotion", SVGObj.maker("animateMotion"));
+ foObjs.put("animateColor", SVGObj.maker("animateColor"));
+ foObjs.put("animateTransform", SVGObj.maker("animateTransform"));
+ foObjs.put("cursor", SVGObj.maker("cursor"));
+ foObjs.put("filter", SVGObj.maker("filter"));
+
+ foObjs.put("feFlood", SVGObj.maker("feFlood"));
+ foObjs.put("feGaussianBlur", SVGObj.maker("feGaussianBlur"));
+ foObjs.put("feOffset", SVGObj.maker("feOffset"));
+ foObjs.put("feMerge", SVGObj.maker("feMerge"));
+ foObjs.put("feMergeNode", SVGObj.maker("feMergeNode"));
+ }
+
String uri = "http://www.w3.org/2000/svg";
- builder.addMapping(uri, "svg", SVGElement.maker());
- builder.addMapping(uri, "rect", SVGObj.maker("rect"));
- builder.addMapping(uri, "line", SVGObj.maker("line"));
- builder.addMapping(uri, "text", SVGObj.maker("text"));
-
- builder.addMapping(uri, "desc", SVGObj.maker("desc"));
- builder.addMapping(uri, "title", SVGObj.maker("title"));
- builder.addMapping(uri, "circle", SVGObj.maker("circle"));
- builder.addMapping(uri, "ellipse", SVGObj.maker("ellipse"));
- builder.addMapping(uri, "g", SVGObj.maker("g"));
- builder.addMapping(uri, "polyline", SVGObj.maker("polyline"));
- builder.addMapping(uri, "polygon", SVGObj.maker("polygon"));
- builder.addMapping(uri, "defs", SVGObj.maker("defs"));
- builder.addMapping(uri, "path", SVGObj.maker("path"));
- builder.addMapping(uri, "use", SVGObj.maker("use"));
- builder.addMapping(uri, "tspan", SVGObj.maker("tspan"));
- builder.addMapping(uri, "tref", SVGObj.maker("tref"));
- builder.addMapping(uri, "image", SVGObj.maker("image"));
- builder.addMapping(uri, "style", SVGObj.maker("style"));
-
- builder.addMapping(uri, "textPath", SVGObj.maker("textPath"));
- builder.addMapping(uri, "clipPath", SVGObj.maker("clipPath"));
- builder.addMapping(uri, "mask", SVGObj.maker("mask"));
- builder.addMapping(uri, "linearGradient", SVGObj.maker("linearGradient"));
- builder.addMapping(uri, "radialGradient", SVGObj.maker("radialGradient"));
- builder.addMapping(uri, "stop", SVGObj.maker("stop"));
- builder.addMapping(uri, "a", SVGObj.maker("a"));
- builder.addMapping(uri, "switch", SVGObj.maker("switch"));
- builder.addMapping(uri, "symbol", SVGObj.maker("symbol"));
-
- builder.addMapping(uri, "pattern", SVGObj.maker("pattern"));
-
- builder.addMapping(uri, "marker", SVGObj.maker("marker"));
- builder.addMapping(uri, "animate", SVGObj.maker("animate"));
- builder.addMapping(uri, "altGlyph", SVGObj.maker("altGlyph"));
- builder.addMapping(uri, "font", SVGObj.maker("font"));
- builder.addMapping(uri, "glyph", SVGObj.maker("glyph"));
- builder.addMapping(uri, "missing-glyph", SVGObj.maker("missing-glyph"));
- builder.addMapping(uri, "hkern", SVGObj.maker("hkern"));
- builder.addMapping(uri, "vkern", SVGObj.maker("vkern"));
- builder.addMapping(uri, "set", SVGObj.maker("set"));
- builder.addMapping(uri, "animateMotion", SVGObj.maker("animateMotion"));
- builder.addMapping(uri, "animateColor", SVGObj.maker("animateColor"));
- builder.addMapping(uri, "animateTransform",
SVGObj.maker("animateTransform"));
- builder.addMapping(uri, "cursor", SVGObj.maker("cursor"));
- builder.addMapping(uri, "filter", SVGObj.maker("filter"));
-
- builder.addMapping(uri, "feFlood", SVGObj.maker("feFlood"));
- builder.addMapping(uri, "feGaussianBlur", SVGObj.maker("feGaussianBlur"));
- builder.addMapping(uri, "feOffset", SVGObj.maker("feOffset"));
- builder.addMapping(uri, "feMerge", SVGObj.maker("feMerge"));
- builder.addMapping(uri, "feMergeNode", SVGObj.maker("feMergeNode"));
+ builder.addMapping(uri, foObjs);
builder.addPropertyListBuilder(uri, new DirectPropertyListBuilder());
}
1.15 +4 -3 xml-fop/src/org/apache/fop/tools/TestConverter.java
Index: TestConverter.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/tools/TestConverter.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestConverter.java 2001/09/11 10:04:25 1.14
+++ TestConverter.java 2001/09/24 09:17:12 1.15
@@ -1,5 +1,5 @@
/*
- * $Id: TestConverter.java,v 1.14 2001/09/11 10:04:25 keiron Exp $
+ * $Id: TestConverter.java,v 1.15 2001/09/24 09:17:12 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -256,8 +256,9 @@
if (outname.endsWith(".xml")) {
outname = outname.substring(0, outname.length() - 4);
}
- driver.setOutputStream(new FileOutputStream(new File(destdir,
- outname + (outputPDF ? ".pdf" : ".at.xml"))));
+ driver.setOutputStream(new BufferedOutputStream(
+ new FileOutputStream(new File(destdir,
+ outname + (outputPDF ? ".pdf" :
".at.xml")))));
log.debug("ddir:" + destdir + " on:" + outname + ".pdf");
driver.render(parser, inputHandler.getInputSource());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]