xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Meyer <daniel.me...@pt.lu>
Subject Re: How to send event from embedded Javascript to Java
Date Fri, 09 Nov 2007 13:01:54 GMT
Hello ACE91

basically you do

canvas.getUpdateManager().getBridgeContext()

Note that you have to make sure the document is loaded when you request 
the bridge context. This will do the trick:

canvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
	canvas.getUpdateManager().getBridgeContext();
}
}

Maybe the bridge context is available even before the GVTTree is 
rendered but i'm not 100% sure (anyone?).

In that case you can also call:
canvas.addGVTTreeBuilderListener(new GVTTreeBuilderListenerAdapter() {		
@Override
public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
	canvas.getUpdateManager().getBridgeContext();
}
});

Hope this helps,
Daniel


ACE91 wrote:
> 
> 
> thomas.deweese wrote:
>> Where do you get BridgeContext from?
>> Are you getting it from the canvas after the document is loaded?
>>
> 
> 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 the
> Javadoc pages for hours, I followed the Batik Wiki's BootSvgAndCssDom
> Tutorial. The code that I used is as follows:
> 
> UserAgent      userAgent;
> DocumentLoader loader;
> BridgeContext ctx;
> 
> userAgent = new UserAgentAdapter();
> loader    = new DocumentLoader(userAgent);
> ctx       = new BridgeContext(userAgent, loader);
> ctx.setDynamicState(BridgeContext.DYNAMIC);
> GVTBuilder     builder;
> GraphicsNode   rootGN;
>         
> builder   = new GVTBuilder();
> rootGN    = builder.build(ctx, interfaceDoc);
> 
> This is all contained in the JApplet's init() method. Note that interfaceDoc
> is the SVGDocument object that contains the scripts that I want to use. This
> document has been loaded from a file when the code is executed, but it is
> not being displayed in the JSVGCanvas at that moment. It is displayed later,
> in another method.
> 
> 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.
> 

-- 
Mit freundlichen Grüßen,
Daniel Meyer

Steinstraße 37, 10119 Berlin
Deutschland
Telefon: +49 3031004846

conTour Software und Design GBR
9, rue Kemel, L-9831 Consthum
Luxemburg
Inhaber: Christiane Teuschler, Meyer Daniel
Geschäftsführer: Meyer Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message