Hi there,

I'm new to batik and tried to add some custom functions to the Rhino
Interpreter as mentioned in docs/scripting.html. However I found out
that the source example doesn't work.

| org.apache.batik.bridge BridgeContext ctx = ...;

I realized that "..." actually means
"svgCanvas.getUpdateManager().getBridgeContext();", however the
documentations doens't say anything about *where* this code should be
placed. Just after creation of the Canvas and loading the URL
bridgeContext doesn't yet exist, so it would raise
NullPointerException. Putting this code in the gvtBuildCompleted()
method of the GVTTreeBuilderListener() worked for me, is it the right
place?

| org.apache.batik.script.InterpreterPool pool =
|     new org.apache.batik.script.InterpreterPool();
| pool.putInterpreterFactory("text/ecmascript", 
|                            new ExtendedRhinoInterpreterFactory());
| ctx.setInterpreterPool(pool);

This would fail, because setInterpreterPool() is protected. I worked
around this problem by patching batik sources and making this public,
but I guess, this is not what users are supposed to do. Is there a
better solution?

BTW, the example code in the docs contains three typos ("intepreter"
instead of "interpreter").

P.S. Is this a bug or a feature that the line number in script errors is
always relative to the beginning of the script and not the actual line
number in the corresponding SVG file?

-- 
\  /                                       [EMAIL PROTECTED]
 \/lad                                     http://www.hashbang.de 


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

Reply via email to