Hello All,
I am tring to use a function of user defined class in my SVG ECMAScript and
then view it in my Baitk 1.6 SVG Squiggle browser.
However when I do that I get a exception
****************************************************
InterpExcept: org.apache.batik.script.InterpreterException: Function
importClass must be called with a class; had "[JavaPackage
com.tietronix.common.Utility]" instead. (Inline <script>
file:/C:/test_java/5_350_pretzel_14Apr2006.svg:487; line 3)
org.mozilla.javascript.EvaluatorException: Function importClass must be called
with a class; had "[JavaPackage com.tietronix.common.Utility]" instead. (Inline
<script> file:/C:/test_java/5_350_pretzel_14Apr2006.svg:487; line 3)
at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:76)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:591)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:630)
at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:606)
at
org.mozilla.javascript.ImporterTopLevel.importClass(ImporterTopLevel.java:146)
at inv2.invoke()
at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:498)
at
org.mozilla.javascript.FunctionObject.callVarargs(FunctionObject.java:513)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:378)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c37.call(Inline <script>
file:/C:/test_java/5_350_pretzel_14Apr2006.svg:487:3)
at org.mozilla.javascript.gen.c37.exec(Inline <script>
file:/C:/test_java/5_350_pretzel_14Apr2006.svg:487)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at
org.apache.batik.script.rhino.RhinoInterpreter.evaluate(RhinoInterpreter.java:237)
at
org.apache.batik.bridge.BaseScriptingEnvironment.loadScripts(BaseScriptingEnvironment.java:467)
at
org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(UpdateManager.java:151)
at
org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(SVGLoadEventDispatcher.java:99)
**********************************************************
My SVG has the ecma script as follows:
<script type="text/ecmascript"><![CDATA[
importPackage(Packages.javax.swing);
importClass(Packages.com.tietronix.common.Utility);
function doit() {
var util = new Packages.Utility();
var b =
util.getActiveState("/PPhase1:Running/Component:Running/TAssociatedDataBuffer",
null);
alert(b);
var frame = new JFrame("My test frame");
var label = new JLabel("Hello from Java objects created in ECMAScript!");
label.setHorizontalAlignment(SwingConstants.CENTER);
frame.getContentPane().add(label);
frame.setSize(400, 100);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
doit();
]]></script>
The java class com.tietronix.common.Utility is in a SVGApplication.jar file
which is in the same location as the SVG is and in the same location where
batik-squiggle.jar is. I believe it is an issue of batik-squiggle not finding
the class com.tietronix.common.Utility.
Is there anybody who can give me some pointers on how to solve this issue?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]