xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Burgin <jbur...@onboard-software.com>
Subject RE: GraphicsNode MouseSupport
Date Wed, 17 Apr 2002 16:10:22 GMT
This sounds reasonable to me, I guess I was using the EventDispatcher
anyhow.

But this prompts another question. (Looking at the last official release:)
SVGAElementBridge adds the following listener:

    /**
     * To handle a click on an anchor.
     */
    protected static class AnchorListener implements EventListener {

        protected UserAgent userAgent;

        public AnchorListener(UserAgent ua) {
            userAgent = ua;
        }

        public void handleEvent(Event evt) {
            SVGAElement elt = null;
            for (Element e = (Element)evt.getTarget();
                 e != null;
                 e = HiddenChildElementSupport.getParentElement(e)) {
                if (e instanceof SVGAElement) {
                    elt = (SVGAElement)e;
                    break;
                }
            }
            Cursor cursor =
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
            userAgent.setSVGCursor(cursor);
            userAgent.openLink(elt);
            evt.stopPropagation();
        }
    }

The problem is with (legal) SVG code like this:
	<text>
		<tspan>
			<a xlink..>my link</a>
		</tspan>
	</text>

This code would not return an event(I *think* the problem is in the
HiddenChildElementSupport, since the <a> is not a direct child of <text>).

Anyhow, to get around this (since I was not permitted to modify the SVG w/o
an act of congress and sacrificing a virgin), I had to listen for clicks and
then check all the runs of the GVTTextNode for one who's
TextAttribute.TEXT_COMPOUND_DELIMITER was an SVGAElement.

This is kinda clunky.  Anyone have a better idea?

-----Original Message-----
From: Vincent Hardy [mailto:vincent.hardy@sun.com]
Sent: Wednesday, April 17, 2002 10:43 AM
To: Batik Users
Subject: Re: GraphicsNode MouseSupport


Hello Jon and Michael,

Thanks for your kind words on Batik! As to the event handling modifs,
here is the story....

I made the modifications to the event dispatching code about 6 weeks 
ago because that code was not consistent. From memory, I remember that 
focus events were defined but not fired, mouse events were going both 
through the EventDispatch and GraphicsNode listeners and key events 
were only dispatched to GraphicsNodes (and not to the EventDispatche 
listeners).

What I did was to remove focus events and make the dispatching go
through the EventDispatcher only. This is enough so that all DOM
listeners can be notified in the end, but it is not enough if you 
want to have listeners on individual GVT nodes. 

If you think it is critical to add listeners on individual
GVT nodes, we could add it back. Thanks for entering an RFE in Bugzilla.

However, I would ask you to consider carefully if you cannot use the 
DOM API rather than hooking into GVT directly for events.

Thanks,
Vincent.

Jon Burgin wrote:
> 
> I would like to second Michael's comments.  I use
GraphcicsNodeMouseEvents.
> It would be a mistake to not consider the effects of removing
functionality
> on
> the batik community as a whole.
> 
> -----Original Message-----
> From: M. van Veen [mailto:michiel@microweb.nl]
> Sent: Wednesday, April 17, 2002 9:07 AM
> To: batik-users@xml.apache.org
> Subject: GraphicsNode MouseSupport
> 
> Hi!
> 
> First of all: Batik rulez! Its great.
> 
> The thing I would like to know is whether the GraphicsNodeMouseEvents
> will be supported again in the (near) future (and in the same way?) as
> in Batik 1.1.1?
> 
> At the moment I'm working on a project to perform edit functions on SVG
> content read and displayed by Batik. Therefor I used the
> GraphicsNodeMouseEvent functions included by batik 1.1.1 for editting
> with use of a mouse. Unfortunately I noticed that the support for
> mouseevents was removed in Batik 1.5b (from AbstractGraphicsNode CVS
> v1.37 and GraphicsNode CVS v1.34, by Vincent Hardy) since it isn't used
> at the moment(?).
> 
> I hope someone can help me with this!
> 
> Kind regards and keep up the (very) good work!
> 
> Michael.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org

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

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


Mime
View raw message