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