On Thursday 12 July 2001 00:16, Peter Armstrong wrote:

> > If you just want to size of the document, you can ask to the
> > bridge context
> > to give that size in pixels with bridgeContext.getDocumentSize() method.
>
> Yes, this does.  However, since I need to determine the size of the
> document when I construct my subclass of JSVGComponent, when I call the
> JSVGComponent's getSVGDocumentSize() method, it calls the getDocumentSize()
> method of its bridgeContext, but this method returns null since (as its
> JavaDoc says) the document has not been built yet.
>
> So now I'm stuck figuring out how to wait() until the document has been
> built, unless there's some method I can call which will do this for me and
> block until the document has been built.
>
> So what do I do?  Do I make a class which implements
> SVGDocumentLoaderListener, add it to the LinkedList of listeners, and have
> my real work done in its documentLoadingCompleted(SVGDocumentLoaderEvent e)
> method, or is there a better way?  (Actually, I'm not even sure if what I
> just said would work--it's just the first thought that I had about how to
> try to do it...)


Not exactly. You have to wait until we build our internal data structure (aka 
GVT) before asking for the size of the document. The 
SVGDocumentLoaderListener is dedicated to the conversion between the XML file 
and the SVG DOM tree (nothing more has been done except creating the DOM).

Use the GVTTreeBuilderListener. The method gvtBuildCompleted will be called 
once the SVG DOM tree has been analysed and the GVT tree built. The only 
thing which is missing is painting.

Just in case your are interested in painting events later, you can have a 
look at the swing.gvt.GVTTreeRendererListener interface.

For futher details, you can also read the SVGCanvas tutorial (see the 
frame.pack() called in the listener - used to resize the window once the size 
of the document is know).

Regards,
Thierry.



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

Reply via email to