You can extend the default one : org.apache.batik.bridge.UserAgentAdapter to
be able to catch the errors and display them.

Nicolas


> -----Original Message-----
> From: David Smith [mailto:[EMAIL PROTECTED]]
> Sent: April 3, 2002 11:14 AM
> To: 'Batik Users'
> Subject: RE: Exceptions trying to create inverse transform of an SVG
> file.
> 
> 
> Thanks to everyone for their advice - it is (pretty much) working now.
> 
> Uh, just one more thing, Nicolas,  How do you get hold of a 
> UserAgent (for
> use with the DocumentLoader) without making an instance of a 
> component? 
> 
> Dave
> 
> -----Original Message-----
> From: Nicolas Socheleau [mailto:[EMAIL PROTECTED]]
> Sent: 03 April 2002 16:05
> To: 'Batik Users'
> Subject: RE: Exceptions trying to create inverse transform of an SVG
> file.
> 
> 
> Hi David,
> 
> JSVGCanvas.setURI(...) is calling 
> JSVGComponent.loadSVGDocument(...). Here
> is the note regarding the usage of 'loadSVGDocument' which 
> might answer your
> question :
> 
> Because the loading is multi-threaded, the current SVG document is not
> garanteed to be updated after this method returns. The only way to be
> notified a document has been loaded is to listen to the
> SVGDocumentLoaderEvents.
> 
> Before querying for the document, you should wait for the 
> notification.
> 
> Another way would be to use org.apache.batik.bridge.DocumentLoader.
> 
> Hope this help.
> 
> Nicolas
> 
> > -----Original Message-----
> > From: David Smith [mailto:[EMAIL PROTECTED]]
> > Sent: April 3, 2002 9:47 AM
> > To: 'Batik Users'
> > Subject: RE: Exceptions trying to create inverse transform of an SVG
> > file.
> > 
> > 
> > Thanks,
> > 
> > adding a component.setSize() removed the errors, but 
> > unfortunately now it
> > doesnt load anything.  I still get a null document.
> > 
> > Ive tried this with a couple of other files as well, still 
> > with no luck.
> > 
> > What I really need is a way of loading an SVGDocument direct 
> > from file.  It
> > seems like a really obvious requirement but I cant find the 
> > class anywhere.
> > 
> > Dave
> > 
> > -----Original Message-----
> > From: Michael Gale [mailto:[EMAIL PROTECTED]]
> > Sent: 03 April 2002 15:41
> > To: 'Batik Users'
> > Subject: RE: Exceptions trying to create inverse transform of an SVG
> > file.
> > 
> > 
> > This is sometimes caused by the parent component whose size 
> > has not been
> > set.
> > 
> > Michael
> > 
> > -----Original Message-----
> > From: David Smith [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, April 03, 2002 9:35 AM
> > To: Batik Users
> > Subject: Exceptions trying to create inverse transform of 
> an SVG file.
> > 
> > 
> > Dear All,
> > 
> > I have a component extending the JSVGCanvas class that needs 
> > to render an
> > SVG file from disk.  I am currently calling 
> > canvas.setURI(url.toString())
> > which seems to find and load the file but it then puts up 
> an exception
> > window complaining of zero dererminants when trying to create 
> > an inverse
> > AffineTransform.  
> > 
> > This is the part of code that loads the document..
> > 
> >     // cl is the source of the SVG url
> > 
> >     JSVGCanvas component = new JSVGCanvas();
> >     javax.swing.JOptionPane.showMessageDialog(null, 
> > cl.getURL().toString());
> > 
> >     component.setURI(cl.getURL().toString());
> >     document = component.getSVGDocument();
> > 
> >     javax.swing.JOptionPane.showMessageDialog(null, "Document 
> > loaded into
> > component : " + document);
> > 
> > The final line shows null as the document.  Shortly after I 
> > get the affine
> > transform exceptions.
> >     
> > The svg file is about as simple as it gets:
> > 
> > <svg xmlns="http://www.w3.org/2000/svg";
> > xmlns:xlink="http://www.w3.org/1999/xlink"; width="150" height="150">
> >     <circle style="fill:yellow" cx="200" cy="100" r="90" /> 
> > </svg>
> > 
> > and the exception is:
> > 
> > java.awt.geom.NoninvertibleTransformException: Determinant is 0     
> >     at
> > java.awt.geom.AffineTransform.createInverse(AffineTransform.ja
> > va:1898)    
> >     at
> > 
> org.apache.batik.swing.gvt.JGVTComponent.setRenderingTransform(Unknown
> > Source)     
> >     at
> > org.apache.batik.swing.svg.JSVGComponent.computeRenderingTrans
> > form(Unknown
> > Source)     
> >     at 
> > org.apache.batik.swing.gvt.JGVTComponent.setGraphicsNode(Unknown
> > Source)     
> >     at org.apache.batik.swing.svg.JSVGComponent.access$201(Unknown
> > Source)     
> >     at
> > org.apache.batik.swing.svg.JSVGComponent$SVGListener.gvtBuildC
> > ompleted(Unkno
> > wn Source)  
> >     at 
> > org.apache.batik.swing.svg.GVTTreeBuilder$2.run(Unknown Source)
> > 
> >     at 
> > java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
> > 
> >     at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)       
> >     at
> > java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDis
> > patchThread.ja
> > va:131)     
> >     at
> > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispa
> > tchThread.java
> > :98)        
> >     at
> > 
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)  
> >     at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
> > 
> > Is there a better way to load a document from file?  I dont 
> > really want the
> > canvas at this stage.  I know of the SAXSVGDocumentFactory 
> > class but the
> > constructor needs a classname for a SAX parser, which I cannot find.
> > 
> > Can anyone shed light on this problem?
> > 
> > Thanks,
> > Dave
> > 
> > **************************************************************
> > **********
> > This Internet E-mail is intended solely for the person to whom it is
> > addressed. It may contain confidential or privileged 
> > information. If you
> > have received it in error please notify us immediately by 
> > telephone and
> > destroy the transmission. You must not copy, distribute or 
> > take any action
> > in reliance on it.
> > 
> > Aerosystems International               Phone: +44 (0)1935 443000
> >                                         Fax  : +44 (0)1935 443111
> >                                         Web  : www.aeroint.com
> > **************************************************************
> > **********
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > **************************************************************
> > **********
> > This Internet E-mail is intended solely for the person to 
> > whom it is addressed. It may contain confidential or 
> > privileged information. If you have received it in error 
> > please notify us immediately by telephone and destroy the 
> > transmission. You must not copy, distribute or take any 
> > action in reliance on it.
> > 
> > Aerosystems International               Phone: +44 (0)1935 443000
> >                                         Fax  : +44 (0)1935 443111
> >                                         Web  : www.aeroint.com
> > **************************************************************
> > **********
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> **************************************************************
> **********
> This Internet E-mail is intended solely for the person to 
> whom it is addressed. It may contain confidential or 
> privileged information. If you have received it in error 
> please notify us immediately by telephone and destroy the 
> transmission. You must not copy, distribute or take any 
> action in reliance on it.
> 
> Aerosystems International               Phone: +44 (0)1935 443000
>                                         Fax  : +44 (0)1935 443111
>                                         Web  : www.aeroint.com
> **************************************************************
> **********
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to