xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helder Magalhães <helder.magalh...@gmail.com>
Subject Re: Batik and XmlHttpRequest / accessing Batik objects from javascript in svg
Date Fri, 08 Oct 2010 05:19:54 GMT
> Hi there,

Hi Roland,


> The difficulty is WHEN to bind the object. First try was to simply call it
> in the init()-Method of the Applet after using canvas.setURI(…). However,
> this method is async, so my bind-method will not yet find even a
> bridgeContext (it is null). Therefore, I thought it would be best to bind
> the object AFTER the document is loaded (via setURI) by using something
> like:
<snippet/>
> Currently, this should bind the canvas (later it should be the applet) to
> the name “parentapplet” in the interpreter and I should be able to use this
> name as a global variable in my ecmascript, e.g. like alert(parentapplet);
> Correct?  However, an exception is thrown when binding the object:
>
> ### Document loaded
>
> ### Binding Object
> test.MySVGCanvas[,0,36,1000x964,alignmentX=0.0,alignmentY=0.0,border=,flags=288,maximumSize=,minimumSize=java.awt.Dimension[width=100,height=100],preferredSize=java.awt.Dimension[width=200,height=200]]
> to interpreter.
>
> java.lang.RuntimeException: Unknown document
>
>             at
> org.apache.batik.bridge.BridgeContext.getInterpreter(BridgeContext.java:558)
[...]
> Any suggestions what I’m doing wrong here?

I haven't quite understood your "document onload" mechanism but there
are a few good examples using "addSVGLoadEventDispatcherListener" and
"addEventListener" with "SVGLoad" [1]. You may also try running that
once the document is already "executing", using a runnable thread [2].


> Many thanks again,
>
> Roland

Hope this helps,
 Helder


[1] http://xmlgraphics.apache.org/batik/using/scripting/java.html#Swing
[2] http://xmlgraphics.apache.org/batik/using/scripting/java.html#Threads

---------------------------------------------------------------------
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