xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: setRenderingTransform : Listener never thrown back
Date Tue, 02 Aug 2005 09:54:47 GMT
Hi zyrgul,

zyrgul nimp wrote:

> I've a problem when using setRenderingTransform.
> The GVTTreeRendererListener is never thrown back when calling this 
> function.
> This question has already been asked but no answer have been given.
> 
> I've joined the test source code.
> 
> Does anyone know why ? Or how I could solve this problem ?

    If you have an 'interactive' canvas then changes to the
rendering transform are handled through the update manager,
so the batik.bridge.UpdateManagerListener.updateCompleted
method is called.  So you will need to register an
UpdateManagerListener with the canvas's UpdateManager.

> 
> Thank you for your answer.
> 
> Ludovic
> 
> package packEssaiBatik;
> 
> import java.awt.geom.AffineTransform;
> import java.io.File;
> import java.io.IOException;
> import java.net.MalformedURLException;
> 
> import javax.swing.JFrame;
> 
> import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
> import org.apache.batik.swing.JSVGCanvas;
> import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
> import org.apache.batik.swing.gvt.GVTTreeRendererListener;
> import org.apache.batik.util.XMLResourceDescriptor;
> import org.w3c.dom.svg.SVGDocument;
> 
> /**
> *
> * TODO To change the template for this generated type comment go to
> * Window - Preferences - Java - Code Style - Code Templates
> */
> public class Test2 {
> 
>    public static void main(String[] args) {
>        SVGDocument documentSVG = null;
>        File fichierSVG = new File("test.svg");
> 
>        String parser = XMLResourceDescriptor.getXMLParserClassName();
>        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
> 
>        try {
>            documentSVG = (SVGDocument) 
> f.createDocument(fichierSVG.toURL().toString());
>        } catch (MalformedURLException e) {
>            e.printStackTrace();
>        } catch (IOException e) {
>            e.printStackTrace();
>        }
> 
>        JSVGCanvas canvas = new JSVGCanvas();
> 
>        canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
>        canvas.setLocation(0,0);
>        canvas.setSize(100, 100);
> 
>        canvas.addGVTTreeRendererListener(new GVTTreeRendererListener(){
> 
>            public void gvtRenderingPrepare(GVTTreeRendererEvent arg0) {
>                System.out.println("Prepare");
>            }
> 
>            public void gvtRenderingStarted(GVTTreeRendererEvent arg0) {
>                System.out.println("Start");
>            }
> 
>            public void gvtRenderingCompleted(GVTTreeRendererEvent arg0) {
>                System.out.println("Completed");
>            }
> 
>            public void gvtRenderingCancelled(GVTTreeRendererEvent arg0) {
>                System.out.println("Cancelled");
>            }
> 
>            public void gvtRenderingFailed(GVTTreeRendererEvent arg0) {
>                System.out.println("failed");
>            }
> 
>        });
> 
>        JFrame frame = new JFrame();
>        frame.getContentPane().add(canvas);
> 
>        frame.pack();
>        frame.setVisible(true);
> 
>        canvas.setSVGDocument(documentSVG);
> 
>        //to be sure, that rendring is finished when doing setRendering
>        try {
>            Thread.sleep(5000);
>        } catch (InterruptedException e) {
> 
>        }
> 
>        AffineTransform afft = AffineTransform.getTranslateInstance(100, 
> 100);
>        canvas.setRenderingTransform(afft);
> 
>    }
> }
> 
> _________________________________________________________________
> MSN Messenger : personnalisez votre messagerie instantanée ! 
> http://g.msn.fr/FR1001/866
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message