You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2007/11/03 05:52:48 UTC
svn commit: r591551 - in /xmlgraphics/batik/trunk/sources/org/apache/batik:
transcoder/SVGAbstractTranscoder.java util/CleanerThread.java
Author: cam
Date: Fri Nov 2 21:52:47 2007
New Revision: 591551
URL: http://svn.apache.org/viewvc?rev=591551&view=rev
Log:
1. Allow concrete transcoder classes to provide custom bridge classes
for SVG 1.2 documents.
2. Give a name to the CleanerThread.
Thanks Jeremias!
Modified:
xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
xmlgraphics/batik/trunk/sources/org/apache/batik/util/CleanerThread.java
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java?rev=591551&r1=591550&r2=591551&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/transcoder/SVGAbstractTranscoder.java Fri Nov 2 21:52:47 2007
@@ -22,9 +22,9 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
-import java.util.StringTokenizer;
import java.util.LinkedList;
import java.util.List;
+import java.util.StringTokenizer;
import org.apache.batik.bridge.BaseScriptingEnvironment;
import org.apache.batik.bridge.BridgeContext;
@@ -42,8 +42,8 @@
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.apache.batik.dom.svg.SVGOMDocument;
-import org.apache.batik.dom.util.DocumentFactory;
import org.apache.batik.dom.util.DOMUtilities;
+import org.apache.batik.dom.util.DocumentFactory;
import org.apache.batik.gvt.CanvasGraphicsNode;
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
@@ -306,18 +306,36 @@
* Factory method for constructing an configuring a
* BridgeContext so subclasses can insert new/modified
* bridges in the context.
+ * @param doc the SVG document to create the BridgeContext for
+ * @return the newly instantiated BridgeContext
*/
protected BridgeContext createBridgeContext(SVGOMDocument doc) {
- if (doc.isSVG12()) {
- return new SVG12BridgeContext(userAgent);
- }
- // For SVG 1.1/1.0 docs call old signature createBridgeContext
- // method (this allows FOP to register it's bridges).
- return createBridgeContext();
+ return createBridgeContext(doc.isSVG12() ? "1.2" : "1.x");
}
+ /**
+ * Creates the default SVG 1.0/1.1 BridgeContext. Subclass this method to provide
+ * customized bridges. This method is provided for historical reasons. New applications
+ * should use {@link #createBridgeContext(String)} instead.
+ * @return the newly instantiated BridgeContext
+ * @see createBridgeContext(String)
+ */
protected BridgeContext createBridgeContext() {
- return new BridgeContext(userAgent);
+ return createBridgeContext("1.x");
+ }
+
+ /**
+ * Creates the BridgeContext. Subclass this method to provide customized bridges. For example,
+ * Apache FOP uses this method to register special bridges for optimized text painting.
+ * @param svgVersion the SVG version in use (ex. "1.0", "1.x" or "1.2")
+ * @return the newly instantiated BridgeContext
+ */
+ protected BridgeContext createBridgeContext(String svgVersion) {
+ if ("1.2".equals(svgVersion)) {
+ return new SVG12BridgeContext(userAgent);
+ } else {
+ return new BridgeContext(userAgent);
+ }
}
/**
Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/CleanerThread.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/CleanerThread.java?rev=591551&r1=591550&r2=591551&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/CleanerThread.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/CleanerThread.java Fri Nov 2 21:52:47 2007
@@ -93,6 +93,7 @@
}
protected CleanerThread() {
+ super("Batik CleanerThread");
setDaemon(true);
start();
}