xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: BridgeContext.getElement returns null
Date Thu, 16 Jun 2005 12:21:47 GMT
Hi Ted,

    Sorry to be slow, I've been very busy and not feeling well :(

Ted.Clement@apcc.com wrote:
> The GVTTree is built once here:

>       public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
>                  UserAgentAdapter userAgent = new UserAgentAdapter();
>                  GVTBuilder builder         = new GVTBuilder();
>                  BridgeContext ctx          = new BridgeContext(userAgent);
>                  ctx.setDynamic(true);
>                  builder.build(ctx, theDocument); 
>                  theSVGModel.setBridgeContext(ctx); 
>                  // Now the tree is ready
>                  treeWalker = new GVTTreeWalker(e.getGVTRoot());
>                  theSVGModel.setGVTTreeWalker(treeWalker);

    It looks to me like the GVTTree is built twice.  Once by
the JSVGCanvas which is calling your gvtBuildCompleted listener
(as evidenced by the e.getGVTRoot()), and once by your code.
This assumes that 'theDocument' is the same document as was given
to the Canvas in the first place.

    Aside from the fact that Batik will not support two GVT tree's
attached to one DOM you have the issue that you are registering
the BridgeContext from the build of your local tree (ctx) with
your Model but the tree walker is operating on the GVT tree from
the Canvas.

   I think you just want something like:
        public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
           // Now the tree is ready


           treeWalker = new GVTTreeWalker(e.getGVTRoot());

> * * Thanks for your patience, I hope this makes more sense. I am starting
> to think that I will need to abandon this approach,
>  and iterate throught the DOM elements, comparing X,Y coordinates...
> uggh...

    No what you are doing should work, but I think you got a bit lost
trying to get a usable BridgeContext.

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

View raw message