You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by cj...@apache.org on 2001/06/21 09:54:34 UTC
cvs commit: xml-batik/sources/org/apache/batik/svggen SVGGeneratorContext.java SVGGraphics2D.java SVGGraphics2DUnitTester.java
cjolif 01/06/21 00:54:34
Modified: sources/org/apache/batik/svggen SVGGeneratorContext.java
SVGGraphics2D.java SVGGraphics2DUnitTester.java
Log:
fix a bug on initialization of SVGGraphics2D reported on batik-dev list
Revision Changes Path
1.9 +6 -2 xml-batik/sources/org/apache/batik/svggen/SVGGeneratorContext.java
Index: SVGGeneratorContext.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGGeneratorContext.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGGeneratorContext.java 2001/05/03 09:48:02 1.8
+++ SVGGeneratorContext.java 2001/06/21 07:54:29 1.9
@@ -18,7 +18,7 @@
*
* @see org.apache.batik.svggen.SVGGraphics2D#SVGGraphics2D(SVGGeneratorContext,boolean)
* @author <a href="mailto:cjolif@ilog.fr>Christophe Jolif</a>
- * @version $Id: SVGGeneratorContext.java,v 1.8 2001/05/03 09:48:02 cjolif Exp $
+ * @version $Id: SVGGeneratorContext.java,v 1.9 2001/06/21 07:54:29 cjolif Exp $
*/
public class SVGGeneratorContext implements ErrorConstants {
// this fields are package access for read-only purpose
@@ -68,10 +68,12 @@
/**
* Builds an instance of <code>SVGGeneratorContext</code> with the given
* <code>domFactory</code> but let the user set later the other contextual
- * information.
+ * information. Please note that none of the parameter below should be <code>null</code>.
* @see #setIDGenerator
* @see #setExtensionHandler
* @see #setImageHandler
+ * @see #setStyleHandler
+ * @see #setErrorHandler
*/
protected SVGGeneratorContext(Document domFactory) {
setDOMFactory(domFactory);
@@ -84,6 +86,8 @@
* @see org.apache.batik.svggen.SVGIDGenerator
* @see org.apache.batik.svggen.DefaultExtensionHandler
* @see org.apache.batik.svggen.ImageHandlerBase64Encoder
+ * @see org.apache.batik.svggen.DefaultStyleHandler
+ * @see org.apache.batik.svggen.DefaultErrorHandler
*/
public static SVGGeneratorContext createDefault(Document domFactory) {
SVGGeneratorContext ctx = new SVGGeneratorContext(domFactory);
1.19 +19 -5 xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java
Index: SVGGraphics2D.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SVGGraphics2D.java 2001/04/26 14:17:22 1.18
+++ SVGGraphics2D.java 2001/06/21 07:54:30 1.19
@@ -44,7 +44,7 @@
*
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: SVGGraphics2D.java,v 1.18 2001/04/26 14:17:22 cjolif Exp $
+ * @version $Id: SVGGraphics2D.java,v 1.19 2001/06/21 07:54:30 cjolif Exp $
* @see org.apache.batik.ext.awt.g2d.GraphicContext
* @see org.apache.batik.svggen.DOMTreeManager
* @see org.apache.batik.svggen.DOMGroupManager
@@ -204,9 +204,17 @@
ImageHandler imageHandler,
ExtensionHandler extensionHandler,
boolean textAsShapes) {
- this(new SVGGeneratorContext(domFactory), textAsShapes);
- generatorCtx.setImageHandler(imageHandler);
+ super(textAsShapes);
+
+ SVGGeneratorContext generatorCtx = new SVGGeneratorContext(domFactory);
+ generatorCtx.setIDGenerator(new SVGIDGenerator());
generatorCtx.setExtensionHandler(extensionHandler);
+ generatorCtx.setImageHandler(imageHandler);
+ generatorCtx.setStyleHandler(new DefaultStyleHandler());
+ generatorCtx.setComment("Generated by the Batik Graphics2D SVG Generator");
+ generatorCtx.setErrorHandler(new DefaultErrorHandler());
+
+ setGeneratorContext(generatorCtx);
}
/**
@@ -222,9 +230,16 @@
super(textAsShapes);
if (generatorCtx == null)
- // not error handler here as we don't have the ctx...
+ // no error handler here as we don't have the ctx...
throw new SVGGraphics2DRuntimeException(ERR_CONTEXT_NULL);
+ setGeneratorContext(generatorCtx);
+ }
+
+ /**
+ * Sets an non null <code>SVGGeneratorContext</code>.
+ */
+ private void setGeneratorContext(SVGGeneratorContext generatorCtx) {
this.generatorCtx = generatorCtx;
this.gc = new GraphicContext(new AffineTransform());
@@ -234,7 +249,6 @@
DEFAULT_MAX_GC_OVERRIDES);
this.domGroupManager = new DOMGroupManager(gc, domTreeManager);
this.domTreeManager.addGroupManager(domGroupManager);
-
}
/**
1.6 +7 -1 xml-batik/sources/org/apache/batik/svggen/SVGGraphics2DUnitTester.java
Index: SVGGraphics2DUnitTester.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGGraphics2DUnitTester.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGGraphics2DUnitTester.java 2001/04/26 14:17:23 1.5
+++ SVGGraphics2DUnitTester.java 2001/06/21 07:54:31 1.6
@@ -31,7 +31,7 @@
*
* @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: SVGGraphics2DUnitTester.java,v 1.5 2001/04/26 14:17:23 cjolif Exp $
+ * @version $Id: SVGGraphics2DUnitTester.java,v 1.6 2001/06/21 07:54:31 cjolif Exp $
*/
public class SVGGraphics2DUnitTester implements SVGConstants {
private String[] args;
@@ -97,6 +97,12 @@
&& m.getParameterTypes().length == 0
&& m.getReturnType().equals(Void.TYPE)
&& Modifier.isPublic(m.getModifiers());
+ }
+
+ public void testCustomization() throws Exception {
+ SVGGraphics2D g2d = new SVGGraphics2D(getDocumentPrototype(),
+ new DefaultImageHandler(),
+ new DefaultExtensionHandler(), false );
}
public void testDOMGroupManager() throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org