Hi Cameron,

In addition to the HTML and Applet interaction, I was looking at having the 
ECMAScript within the SVG interact with the applet.

For example,

<svg>
        <script>
                function Test() 
                {
                        //Call the applet's appletTestMethod() here
                }
        </script>
...
</svg>
----------
// This is the applet hosting the canvas in which the svg content is loaded.
import java.applet.Applet;
public class Something extends Applet {
...
        public void appletTestMethod()
        {
                ...
        }
}

Also, vice versa, if possible.
It was in this context that I was wondering if a change in the Batik code would 
be warranted.
Thanks for the other information though.

Praveen

-----Original Message-----
From: Cameron McCormack [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 21, 2007 8:56 AM
To: [email protected]
Subject: Re: Applet, Batik, ECMAscript and HTML

Hi Praveen.

Praveen Nayak:
> Using Adobe viewer we could have the same ECMAscript handle both HTML
> and SVG file.
> 
> In Batik, it was pointed out to me that SVG can be manipulated from an
> external ECMAScript by accessing the applet and having the applet
> manipulate the SVG file.
> The following Batik example shows that:
> 
> http://xmlgraphics.apache.org/batik/demo.html
> 
> Is it possible for the Javascript that is a part of the SVG, loaded
> inside the scope of Batik to interact with the Applet hosting the
> canvas?
> 
> For example, how can I have a Java method of the applet call a
> ECMAScript function that is inside the SVG content, and/or vice versa?
> 
> I would like to complete the circle of interaction - outside javascript
> accessing the applet which in turn accesses the inner ECMAScript, and
> the inner ECMAScript accessing the applet, and the applet talking to the
> outside javascript.
> 
> If it would require small changes in the Batik code, I can do that too
> with my local copy - if someone can tell me it's possible and show me
> the right direction.

Yes it is possible, and it shouldn’t need any modifications to Batik.
The method for interacting with the script in the HTML containing the
applet is called LiveConnect.  Here’s an example:

  import java.applet.Applet;
  import netscape.javascript.JSObject;

  public class Something extends Applet {
      public void start() {
          JSObject win = JSObject.getWindow(this);
          win.call("someFunction", new Object[] { new Integer(1),
                                                  "blah",
                                                  new Boolean(false) });
      }
  }

This calls a script function called someFunction with three arguments:
1, "blah", false.

See:

  http://java.sun.com/products/plugin/1.3/docs/jsobject.html
  http://docs.rinet.ru/HTMLnya/ch47.htm

Note that this doesn’t work in Internet Explorer, though.  If you need
this in IE you can use an ActiveX control that implements the
LiveConnect interfaces:

  http://www.mozilla.org/projects/plugins/plugin-host-control.html

HTH,

Cameorn

-- 
Cameron McCormack, http://mcc.id.au/
        xmpp:[EMAIL PROTECTED]  ▪  ICQ 26955922  ▪  MSN [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] 
--------------------------------------------------------------------------------
Telelogic Lifecycle Solutions:
Helping You Define, Design & Deliver Advanced Systems & Software
Learn More at www.telelogic.com


Praveen Nayak
Software Engineer
Telelogic India Pvt Ltd
39/2, 2nd Floor, Sagar Complex
Bannerghatta Road,
560 029 Bangalore
India

Phone: +91 (80) 419 95800 x194
Fax: 
Mobile phone: 

[EMAIL PROTECTED]
http://www.telelogic.com


Telelogic - Requirements-Driven Innovation!
-------------------------------------------------------------



The information contained in this e-mail, including any attachment or 
enclosure, is intended only for the person or entity to which it is addressed 
and may contain confidential material. Any unauthorized use, review, 
retransmissions, dissemination, copying or other use of this information by 
persons or entities other than the intended recipient is prohibited.


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

Reply via email to