You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "K. W. Landry" <kw...@gmail.com> on 2007/01/02 06:10:49 UTC

Unknown Language text/ecmascript

Folks,

I thought the rhino engine was in force by default, but I'm getting the
following error:

java.lang.Exception: Unknown language: text/ecmascript
    at org.apache.batik.bridge.BridgeContext.getInterpreter(
BridgeContext.java:554)
    at org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(
BaseScriptingEnvironment.java:289)
    at org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(
BaseScriptingEnvironment.java:285)
    at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(
BaseScriptingEnvironment.java:590)
    at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent
(BaseScriptingEnvironment.java:549)
    at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(
UpdateManager.java:239)
    at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(
UpdateManager.java:220)
    at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(
SVGLoadEventDispatcher.java:100)


and where it is choking, this will look familiar to some as CartoNet's
dynamic map data example:
    <script type="text/ecmascript"
xlink:href="./arizriver/helper_functions.js"/>
    <script type="text/ecmascript" xlink:href="./arizriver/mapApp.js"/>
    <script type="text/ecmascript" xlink:href="./arizriver/timer.js"/>
    <script type="text/ecmascript" xlink:href="./arizriver/slider.js"/>
    <script type="text/ecmascript" xlink:href="./arizriver/button.js"/>
    <script type="text/ecmascript"
xlink:href="./arizriver/checkbox_and_radiobutton.js"/>
    <script type="text/ecmascript" xlink:href="./arizriver/navigation.js"/>
    <script type="text/ecmascript"><![CDATA[
        //global variables for mapApp and map object
        var myMapApp = new mapApp(false,undefined);
        var myMainMap;

        function init(evt) {


I've made sure js.jar is in the classpath, and have read all I can find on
enabling scripting, including the discussion of disabling scripting support
by setdocumentstate to always.dynamic which I didn't follow as I thought
setting it to always.dynamic made sure scripting was supported. I'm using
the 1.6 release of Batik.

In any case, the svg file works great in ASV, Firefox, and IE, so I'm going
on it's my implementation of JSVGCanvas, I'm thinking somwhere I'm either
not adding scripting support or turning it off somehow.

Any thoughts appreciated,

Thanks,

K. W. Landry

Re: Unknown Language text/ecmascript

Posted by th...@kodak.com.
Hi K.W.

"K. W. Landry" <kw...@gmail.com> wrote on 01/02/2007 12:57:18 AM:

> more to my original point, I thought 
> scripting was supported by default as long as the svg contained 
> type=text/ecmascript and/or setdocumentstate( always.dynamic) was set. 

   I'm guessing that you are missing the contents of our 'resources'
directory in your runtime environment.  The provision of the Rhino
interpreter depends on the availability of the file:
         META-INF/services/org.apache.batik.scrip.InterpreterFactory

   If this isn't found then Rhino won't be added as an interpreter.

Re: Unknown Language text/ecmascript

Posted by "K. W. Landry" <kw...@gmail.com>.
Folks,

The following code provides scripting, the examples I'm using (CartoNet
dynamic mapping and the Solataire example) now run appropriately. I'm not
sure the code is in the best place for  adding scripting support, but, more
to my original point, I thought scripting was supported by default as long
as the svg contained type=text/ecmascript and/or setdocumentstate(
always.dynamic) was set.

            public void gvtRenderingCompleted(GVTTreeRendererEvent e) {

                BridgeContext ctx = svgCanvas.getUpdateManager
().getBridgeContext();
//                ctx.getInterpreterPool();
                InterpreterPool pool = ctx.getInterpreterPool();     //new
org.apache.batik.script.InterpreterPool();
                pool.putInterpreterFactory("text/ecmascript", new
RhinoInterpreterFactory());
//                ctx.setInterpreterPool(pool);

                u.setUM(svgCanvas.getUpdateManager());
                u.setRQ(svgCanvas.getUpdateManager
().getUpdateRunnableQueue());
                u.setBC(svgCanvas.getUpdateManager().getBridgeContext());

                log.info("GVT Rendering Complete\n\n");
            }
            });

K. W. Landry

On 1/2/07, K. W. Landry <kw...@gmail.com> wrote:
>
> Hi Chandra & Tonny,
>
> Tonny Kohar wrote:
>
> >> or is there a way i can disable scripting on the svg
> >> document before doing the drap and drop and later enable
> >> scripting after the drop.
>
> >
> > I am not sure if this work, but you can set the
> > JSVGCanvas.setDocumentState() to ALWAYS_DYNAMIC, STATIC, DYNAMIC.
>
>     This will turn off scripting for then entire document permanently
> (and must be done before the document is associated with the canvas).
>
>
>     What you could do is suspend the UpdateManager.  The only problem
> is that this will turn off _all_ scripting in the SVG (including
> probably your Java Scripting that is doing the DnD operation).  So
> this probably isn't what you want really.
>
>
>     The next suggestion would be to add a 'glass pane' to the SVG
> document to capture all mouse events.  This can be done by
> adding a very large rectangle as the last element in the document
> (document.getRootElement
> ().appendchild(glassPane)).  This is a very
> good technique for just moving elements around the canvas as it
> solves the pointer falling off the element problem at the same
> time.
>
>     The only problem with this solution is if you need to know
>
> what elements are 'under' the pointer (which is likely to be
> needed for a Drag and Drop operation).  So, the other possible
> solution would be to add an event listener to the root SVG element
> on the 'capture' phase.  Then you can call 'stopPropagation'
>
> on the DOMEvent object and thus keep the event from reaching any other
> event listeners.
>
>     I hope one of these helps you!
>
>
>
> ---------- Forwarded message ----------
> From: K. W. Landry <kw...@gmail.com>
> Date: Jan 2, 2007 12:10 AM
> Subject: Unknown Language text/ecmascript
> To: batik-users@xmlgraphics.apache.org
>
> Folks,
>
> I thought the rhino engine was in force by default, but I'm getting the
> following error:
>
> java.lang.Exception: Unknown language: text/ecmascript
>     at org.apache.batik.bridge.BridgeContext.getInterpreter (
> BridgeContext.java:554)
>     at org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(
> BaseScriptingEnvironment.java:289)
>     at org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(
> BaseScriptingEnvironment.java :285)
>     at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(
> BaseScriptingEnvironment.java:590)
>     at
> org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(
> BaseScriptingEnvironment.java :549)
>     at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(
> UpdateManager.java:239)
>     at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(
> UpdateManager.java:220)
>     at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run (
> SVGLoadEventDispatcher.java:100)
>
>
> and where it is choking, this will look familiar to some as CartoNet's
> dynamic map data example:
>     <script type="text/ecmascript"
> xlink:href="./arizriver/helper_functions.js"/>
>     <script type="text/ecmascript" xlink:href="./arizriver/mapApp.js"/>
>     <script type="text/ecmascript" xlink:href="./arizriver/timer.js"/>
>     <script type="text/ecmascript" xlink:href="./arizriver/slider.js"/>
>     <script type="text/ecmascript" xlink:href="./arizriver/button.js"/>
>     <script type="text/ecmascript"
> xlink:href="./arizriver/checkbox_and_radiobutton.js"/>
>     <script type="text/ecmascript"
> xlink:href="./arizriver/navigation.js"/>
>     <script type="text/ecmascript"><![CDATA[
>         //global variables for mapApp and map object
>         var myMapApp = new mapApp(false,undefined);
>         var myMainMap;
>
>         function init(evt) {
>
>
> I've made sure js.jar is in the classpath, and have read all I can find on
> enabling scripting, including the discussion of disabling scripting support
> by setdocumentstate to always.dynamic which I didn't follow as I thought
> setting it to always.dynamic made sure scripting was supported. I'm using
> the 1.6 release of Batik.
>
> In any case, the svg file works great in ASV, Firefox, and IE, so I'm
> going on it's my implementation of JSVGCanvas, I'm thinking somwhere I'm
> either not adding scripting support or turning it off somehow.
>
> Any thoughts appreciated,
>
> Thanks,
>
> K. W. Landry
>