On Tuesday 26 June 2001 04:14, Timothy M. Lownie wrote:
> Hi,
> I'm a new user to Batik, and I've been having some trouble capturing mouse
> events despite a day or so of looking at the code. I was wondering if
> someone could point out an obvious error.
>
> I have an SVG document with some rectangles, one called "MyRectangle".
> I have a JGVTComponent for the 'view' and a JSVGDocument for the 'model'.
>
> At some point I call something akin to
>
> JGVTComponent.setGraphicsNode (   JSVGComponent.getGraphicsNode()   );
>
> and render the document. Later I call getElementById() to find the
> "MyRectangle" element and bridgeContext.getGraphicsNode() on the element to
> get the GraphicsNode. I then call addGraphicsNodeMouseListener() with a
> GraphicsNodeMouseAdapter having a mouseClicked() method which simply prints
> out a console message.
>
> Everything renders okay and the MouseListener gets set but I click merrily
> away on the rectangle but the mouseClicked() never get called.
>
> Is there some other setting I have to enable? For example, do I have to
> explicitly set my own eventDispatcher? Thanks.

First of all, sorry for the delay.

Well, that's a difficult question. If you want to be informed when the mouse 
is clicked, the correct way to do that (according to our design) is to add a 
listener on our model (in the MVC paradigm).

So, add an event listener on the DOM tree (the root, the element you are 
interested in or whatever). You will be informed when the user click, press, 
release the mouse.

Otherwise, if you really want to deal with GVT instead, I agree that it's not 
working yet. Basically, the AWT events are captured in the canvas, dispatch 
by a class called AWTEventDispatcher and once the GVT node is identified, its 
appropriate process<EventType> method is called.

The conclusion is that we never call the dispatch method on a particular GVT 
node at this time. It is on my TODO list to fix that (the event stuffs in 
Batik) but I was not able to do that for 1.0.

I could send you an email when it's done if you are interested in.

Regards,
Thierry.


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

Reply via email to