[EMAIL PROTECTED] wrote:

I'm working on project using Batik to view GIS info in applet. I'd like to get some info about element clicked by user. Could you give me some advise how to do this. I tried do use java script, but I don’t know how to send info from SVG/script to applet (call procedure in my applet when clicked on element).

The easiest thing to do is to add Java Objects as event handlers on the SVG Elements using 'addEventHandler'. This would totally avoid using JavaScript and have your Java class called directly in response to user actions.


The best for me would be if I could do something like this in SVG:

<svg id="svg1" width='400' height='400' viewBox="00 0 400 400">

<script type="text/ecmascript"> <![CDATA[
function elem_click(info) {
some code to call applet procedure }


I don't know if is got way I'm thinking but I suspect that I have to customize Rhino Interpreter. Am I right?

Rhino has a feature call 'live connect' so you can call methods on Java Objects directly from JavaScript. Probably the easiest way to do this would be to bind a 'host' object into the interpreter. Then you can just call methods on that host object from your script.

     BridgeContext ctx = ...
     Interpreter interp = ctx.getInterpreter("text/ecmascript");
     interp.bindObject("appletHost", hostObj);

From Script:

appletHost.someFunction("Some Text", 10, 20);







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



Reply via email to