I have been using the ASV3 viewer and am currently revising the ecmascript code to get it to work in Batik/Rhino. I realise that Adobe have implemented a number of non-standard features. However one feature that I use extensively is the addEventListener(eventType, listener, useCapture) method of registering event listeners on a particular node.
 
The argument I typically pass to the listener parameter is 'this'. Then I implement a handleEvent method for the prototype. I have used this method to define generic event handlers on objects quite successfully. I have included a file demonstrating this. Note that although this works fine in ASV3, I am getting the following error in Batik.
 
org.mozilla._javascript_.EvaluatorException: Cannot convert [object Object] to org.w3c.dom.events.EventListener
 at org.mozilla._javascript_.DefaultErrorReporter.runtimeError(Unknown Source)
 at org.mozilla._javascript_.Context.reportRuntimeError(Unknown Source)
 at org.mozilla._javascript_.Context.reportRuntimeError(Unknown Source)
 at org.mozilla._javascript_.Context.reportRuntimeError2(Unknown Source)
 at org.mozilla._javascript_.NativeJavaObject.reportConversionError(Unknown Source)
 at org.mozilla._javascript_.NativeJavaObject.coerceType(Unknown Source)
 at org.mozilla._javascript_.NativeJavaMethod.call(Unknown Source)
 at org.apache.batik.script.rhino.EventTargetWrapper$RhinoNativeJavaMethod.call(Unknown Source)
 at org.mozilla._javascript_.ScriptRuntime.call(Unknown Source)
 at org.mozilla._javascript_.gen.c167.call(<SVG>:9)
 at org.mozilla._javascript_.ScriptRuntime.call(Unknown Source)
 at org.mozilla._javascript_.gen.c166.call(<SVG>:5)
 at org.mozilla._javascript_.BaseFunction.construct(Unknown Source)
 at org.mozilla._javascript_.ScriptRuntime.newObject(Unknown Source)
 at org.mozilla._javascript_.gen.c171.call(<SVG>:1)
 at org.mozilla._javascript_.gen.c171.exec(<SVG>)
 at org.mozilla._javascript_.Context.evaluateReader(Unknown Source)
 at org.apache.batik.script.rhino.RhinoInterpreter.evaluate(Unknown Source)
 at org.apache.batik.bridge.BaseScriptingEnvironment$1.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.BaseScriptingEnvironment.dispatchSVGLoad(Unknown Source)
 at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(Unknown Source)
 at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(Unknown Source)
 at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown Source)
 at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
 at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
 
I think the key line here is:
 
 at org.apache.batik.bridge.BaseScriptingEnvironment$1.handleEvent(Unknown Source)
 
Why is this? Were should I look for further information about Rhino DOM bindings.
 

<<attachment: DOMEventListenerTest.svg>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to