Hi Nathan, You can take a look at test-sources/org/apache/batik/swing/JSVGCanvasHandler.java In particular the following code both binds a Java object into the interpreter and calls code from the script:
public static final String REGARD_TEST_INSTANCE = "regardTestInstance"; public static final String REGARD_START_SCRIPT = "try { regardStart(); } catch (er) {}"; --- UpdateManager um = updateManager; public void run() { ScriptingEnvironment scriptEnv; scriptEnv = um.getScriptingEnvironment(); Interpreter interp; interp = scriptEnv.getInterpreter(); interp.bindObject(REGARD_TEST_INSTANCE, host); try { interp.evaluate(REGARD_START_SCRIPT); } catch (InterpreterException ie) { // Could not wait if no start script. } svg-developers@yahoogroups.com wrote on 10/19/2005 12:46:07 PM: > Thomas DeWeese, > > I tried to look in to 'bindObject' method on the > batik.script.Interpreter, but I could not understand how to bind any > java object from this 'bindObject' method. Can you please provide any > links that explains how to do it. > > Also this is what I did with RhinoInterpreter.java and > RhinoClassShutter.java: > > In RhinoInterpreter.java for the enterContext class we commented out > ctx.setClassShutter(new RhinoClassShutter()); > additionally, we added "org.apache.batik.apps.svgbrowser" to the > TO_BE_IMPORTED array as this is where the GPS class resides that we > are trying to access the variable. This was done with the assumption > that it would make the classes within > org.apache.batik.apps.svgbrowser visiable to javascript within the > SVG document. > > In the RhinoClassShutter.java we commented out the if statements for > visibleToScripts so it only returns true. I assume that this doesn't > make a difference since we commented out > ctx.setClassShutter(new RhinoClassShutter()); in RhinoInterpreter.java > > When trying to access org.apache.batik.apps.svgbrowser from > javascript in SVG we get a message stating there is no public > interface or method > Example in javascript inside a SVG doc we have the following line: > var f = Packages.org.apache.batik.apps.svgbrowser.ReadGPS.gpgga; > We get the following error: > SVG Error: Java class "org.pache.batik.apps.svgbrowser.ReadGPS" > has no public interface or method named "gpgga". (Inline.....) > The same error happens when trying to access the method that reurns > the variable as a string getGPGGA() > > Any input is greatly apprectiated. > > Thanks > Nathan. > > > > > > > > > > > > ----- > To unsubscribe send a message to: [EMAIL PROTECTED] > -or- > visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" > ---- > Yahoo! Groups Links > > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/