Hi Michael,

        You might just try using 'scheduleGVTRendering' to implement your 
refresh.
This should trigger a repaint of the entire visible canvas with the 
current settings.

"Scott Ruffner" <[EMAIL PROTECTED]> wrote on 02/09/2006 11:51:23 AM:

> hi, michael --
> 
> i'm not sure about the exception you are getting, but 
> it may have to do with the multithreaded machinery 
> of Batik.  do you call setRenderingTransform() in 
> your GVTTreeRendererAdapter.gvtRenderingCompleted() 
> method?  JSVGComponent (superclass of JSVGCanvas)
> also has a GVTTreeRendererListener, and its 
> gvtRenderingCompleted() method does some important 
> cleanup stuff.  If your listener gets called first, maybe 
> that's the problem....
> 
> underneath the hood of JSVGCanvas, the rendering 
> transform ultimately gets reset by a call to 
> JSVGComponent.setGraphicsNode(), which is invoked 
> after the GVT tree build phase is done, and immediately 
> before scheduling the render phase.  This happens in 
> JSVGComponent.SVGListener.gvtBuildCompleted():
>    JSVGComponent.this.setGraphicsNode(...)
>    scheduleGVTRendering() ==> calls renderGVTTree().
> 
> if it is not too difficult, and if the batik experts out 
> there think it is a reasonable solution, you might 
> try subclassing JSVGCanvas like so:
> 
> class MyCanvas extends JSVGCanvas 
> {
>    AffineTransform preservedRenderXfm = null;
>    boolean usePreservedRenderXfm = false;
>    ....
>    public void refreshCanvas( SVGDocument theCurrentSVGDoc )
>    {
>        preservedRenderXfm = new AffineTransform( getRenderingTransform() 
);
>        usePreservedRenderXfm = true;
>        setSVGDocument( theCurrentSVGDoc );
>    }
>    ....
>    protected void renderGVTTree()
>    {
>        if( usePreservedRenderXfm )
>       {
>           usePreservedRenderXfm = false;
>           setRenderingTransform( preservedRenderXfm, false );
>        }
>        super.renderGVTTree();
>    }
> }
> 
> This is simplified because there are multithreading issues to 
> worry about (what if the user clicks "Refresh" button in rapid 
> succession?).  I do something like this in my Batik-based app, 
> and it works for me.  Doing it this way avoids having to go 
> through two render phases, by the way.
> 
> good luck!
> 
> scott
> -- 
> Scott A. Ruffner, Scientific Programmer/Analyst
> Lisberger Lab
> W.M. Keck Foundation Center for Integrative Neuroscience
> University of California -- San Francisco
> 513 Parnassus Avenue, Box 0444, S871
> San Francisco, CA  94143-0444
> 415-502-7897
> 
> ---------------------------------------------------------------------
> 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]
> 
> 
> ---------------------------------------------------------------------
> 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