xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gorka Garay" <go...@sistemasjudo.com>
Subject Calling java methods from ECMASCRIPT (not solved at the list)
Date Tue, 15 Jun 2004 11:40:21 GMT
Hello everybody,


I´m working on a java application where I use xml files to create SVG documents shown on
a JSVGCanvas (well, MyJSVGCanvas extending JSVGCanvas but I guess it is the same). The SVGDocument
I put on the JSVGCanvas contains some ECMAScript functions in order to move some SVG elements
(circles) by the user all over the available space (working really fine). The JSVGCanvas is
part of a TabbedPane and now I need to change to another TabbedPane when a SVG element is
clicked on.

Ok, the thing is to call a Java method from the ECMAScript. I have searched the list and found
out some examples that helped me to make this work:

importPackage(Packages.myPackage);
var myvar = (new MyObject()).myMethod(ECMAScript_vble1); // non-static method from "MyObject"
var myvar2 = MyClass.myMethod(ECMAScript_vble2); // static method from "MyClass"
alert(myvar+" - "+myvar2);

As shown, I can call static methods from any class I hava and non-static methods if I create
a new Object. I can give ECMAScript variables to them and get the returning values perfectly.

But what I want is to access the TabbedPane to make it change to another TabbedPane to show
some information related to the SVG element that was clicked on. I cannot call it statically
because the method "setSelectedIndex(int)" is not static and I cannot call it by creating
a new object, I need to call the method of the previously created object where the JSVGCanvas,
and the ECMAScript, are inserted.

I hope anybody of you can help me, any answer would be really appreciated.


Thanks in advance,

gorka garay



P.D: I would like to make a special mention to Thomas DeWeese, who I have realized makes a
great job at this list. I hope he can help me as much as he has helped so much people.

P.D.2: Excuse me for my awfull english, I guess it is a little bit rusty... :S
Mime
View raw message