xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: How to send event from embedded Javascript to Java
Date Fri, 09 Nov 2007 13:02:44 GMT
Hi Adam,

> thomas.deweese wrote:
> > 
> > Where do you get BridgeContext from?
> > Are you getting it from the canvas after the document is loaded?

ACE91 <adamlego20@hotmail.com> wrote on 11/09/2007 07:47:57 AM:

> Because I don't know how to get it any other way, and Batik isn't
> well-documented enough for me to find out the right way without scouring 
> Javadoc pages for hours,

   I'm sorry you found this frustrating.  The proper way to
obtain the BridgeContext for the current document is by calling:

        JSVGCanvas canvas = ....;
        BridgeContext bctx = canvas.getUpdateManager().getBridgeContext();

    See the javadoc for getUpdateManager for more information on when
and how you can safely call the method.

> This is all contained in the JApplet's init() method. Note that 
> is the SVGDocument object that contains the scripts that I want to use. 
> document has been loaded from a file when the code is executed, but it 
> not being displayed in the JSVGCanvas at that moment. It is displayed 
> in another method.

   The UpdateManager (and consequently the BridgeContext) only 
becomes available after the first rendering of the document
(the BridgeContext exists earlier but isn't exposed for a
number of reasons).

> So is there another way to get a BridgeContext object? I tried as hard 
as I
> could, but I couldn't find one. If you could point me to a tutorial or
> something, or at least show me how to get the right BridgeContext, that
> would be helpful.

   I don't think such a tutorial exists.  However, contributions to the 
wiki are open to all, so if you wish to contribute to the community it
would be nice to write a Wiki page summarizing what you have learned 
from this e-mail exchange it would be appreciated.

View raw message