I have a similar, but slightly different question -

In my case, I'm using the JSVGCanvas in a swing applet, so I don't want to call an external .jar file, I want to call a method/class that is in my swing applet (which is of course currently being used to display the SVG).  There must be a way to do this, any pointers?

Ken

mo wrote:
Hi,
 
As a newcomer to Batik/SVG development I am having some trouble with the following:
 
How do you call Java code from a SVG document using Batik as opposed to using "embedded" Scripting Elements? 
 
----------------------------------------------------------
 
My dev. enviroment is as follows:(batik 1.5)
 
1) I have a basic SVG which is rendered by BATIK in a  JSVGCanvas.
 
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "
http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="500" height="500">
 
<script type="application/java-archive" xlink:href=""> </script>
 
<rect x="109" y="159" width="224" height="95" style="fill:rgb(192,192,192);stroke:rgb(0,0,0);stroke-width:1"/>
</svg>
 
 
2) I have a JAVA class named SvgInteractor  which implements org.w3c.dom.svg.EventListenerInitializer
 
It has one method

initializeEventListeners(SVGDocument doc)

(It makes a system.out.print() line)

3) I have created a jar file called svgg.jar containing SvgInteractor.Class file.
 
The manifest of the Jar file contains the following:
 
Manifest-Version: 1.0
SVG-Handler-Class: SvgInteractor
 
-------------------------------------------------
 
When I click on the rectangle I get the following Error:
 

ReferenceError: "SvgInteractor" is not defined. (<SVG>; line 1)at org.mozilla._javascript_.NativeGlobal.constructError(NativeGlobal.java:597) at org.mozilla._javascript_.NativeGlobal.constructError(NativeGlobal.java:557) at org.mozilla._javascript_.ScriptRuntime.name(ScriptRuntime.java:1076)at org.mozilla._javascript_.gen.c1.call(<SVG>:1)

at org.mozilla._javascript_.gen.c1.exec(<SVG>)

 at org.apache.batik.script.rhino.RhinoInterpreter.evaluate(Unknown Source) at org.apache.batik.bridge.ScriptingEnvironment.runEventHandler(Unknown Source)

at org.apache.batik.bridge.ScriptingEnvironment$ScriptingEventListener.handleEvent(Unknown Source)

at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)

 at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)

 at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)

 at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown Source)

 at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown Source)

 at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseClicked(Unknown Source)

 at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown Source)

 at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown Source)

 at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)

 at org.apache.batik.gvt.event.AWTEventDispatcher.mouseClicked(Unknown Source)

 at org.apache.batik.swing.svg.JSVGComponent$22.run(Unknown Source)

 at org.apache.batik.util.RunnableQueue.run(Unknown Source)

 at java.lang.Thread.run(Unknown Source)

--------------------------------------------------------------------------------------------

 
What is the correct way to call the SvgInteractor Class?
 
how to pass the correct parameters from an SVG document?
 
Any help or Ideas would be greatly appreciated!
 
 
 
 
 

 
 



____________________________________________________
  IncrediMail - Email has finally evolved - Click Here

<<image/gif>>

Reply via email to