Philippe, All the SVG handling is done by batik. I've inserted the JSVGCanvas in the view (still have a flicker problem during drawing, I think it's because the JSVGCanvas is added to an SWT panel which is also redrawn).
Since this morning I've got the following code working. If this is the correct way to do things, I then need to know how to get the DOM Node or Element from the Event! private static final String MOUSE_CLICK= "click"; private static final String MOUSE_MOVE= "mousemove"; private static final String MOUSE_DOWN= "mousedown"; private static final String MOUSE_UP= "mouseup"; private void handleMyEvent(Event event) { EventTarget et= event.getTarget(); setTitleText( " Type = " + event.getType() + " Phase = " + event.getEventPhase() + " Current target = " + et.getClass() + " Timestamp = " + event.getTimeStamp()); } public void createPartControl(final Composite parent) { try { svgCanvas= new JSVGCanvas(new MyUserAgent(), true, true); svgCanvas.setDoubleBuffered(true); svgCanvas.setDoubleBufferedRendering(true); svgCanvas.addSVGLoadEventDispatcherListener(new SVGLoadEventDispatcherListener() { public void svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent arg0) { // setTitleText("svgLoadEventDispatchStarted"); } public void svgLoadEventDispatchCompleted(SVGLoadEventDispatcherEvent arg0) { SVGSVGElement root= svgCanvas.getSVGDocument().getRootElement(); root.addEventListener(MOUSE_CLICK, new EventListener() { public void handleEvent(Event arg0) { handleMyEvent(arg0); } }, true); root.addEventListener(MOUSE_MOVE, new EventListener() { public void handleEvent(Event arg0) { handleMyEvent(arg0); } }, true); root.addEventListener(MOUSE_DOWN, new EventListener() { public void handleEvent(Event arg0) { handleMyEvent(arg0); } }, true); root.addEventListener(MOUSE_UP, new EventListener() { public void handleEvent(Event arg0) { handleMyEvent(arg0); } }, true); } public void svgLoadEventDispatchCancelled(SVGLoadEventDispatcherEvent arg0) { // setTitleText("svgLoadEventDispatchCancelled"); } public void svgLoadEventDispatchFailed(SVGLoadEventDispatcherEvent arg0) { // setTitleText("svgLoadEventDispatchFailed"); } }); awtPanel= SWT_AWT.new_Panel(parent); awtPanel.setLayout(new BorderLayout()); awtPanel.add("Center", svgCanvas); shell= getViewSite().getShell(); createActions(); } catch (Throwable t) { t.printStackTrace(); } getViewSite().getPage().addSelectionListener(this); } Paul. ----- Original Message ----- From: "Philippe GIL" <[EMAIL PROTECTED]> To: "Paul Sinnema" <[EMAIL PROTECTED]> Sent: Wednesday, September 03, 2003 10:37 AM Subject: Re: Finding an Element (Node) in the DOM with an X Y coordinatefroma MouseEvent > Bonjour Paul, > > I can't still figure how you use batik under eclipse? > > What part of the SVG handling is managed by batik? > How do you display SVG content inside your view? Do you parse the batik > GVT making your own GVT to screen bridge? Do you generate a bitmap with > batik to display it later in your view. Do you insert an JSVGCanvas in > your view? > The solution of your problem will probably depend on it. > > Amicalement > Philippe Le mer 03/09/2003 à 09:47, Paul Sinnema a écrit : > Philippe, > > I'm currently building an Eclipse 'View' (yes it's the Open Source Project > you are referring to) to display and manipulate SVG. The intent is to build > an UML Class Diagram which in turn will create an XML that can be > transformed to an XMI with EMF in Eclipse. From there we are able to > generate code for several applications (JAVA, DOTNet, C++....). All the > code, for the view, is created by me (with a little help of Eclipse and of > course I've looked at other applications and copied where possible). > > Paul. > > ----- Original Message ----- > From: "Philippe GIL" <[EMAIL PROTECTED]> > To: "Paul Sinnema" <[EMAIL PROTECTED]> > Sent: Wednesday, September 03, 2003 9:28 AM > Subject: Re: Finding an Element (Node) in the DOM with an X Y coordinatefrom > a MouseEvent > > > Bonjour Paul, > > I have some questions regarding your mail. > > Does Eclipse mean the IBM open source project? (http://www.eclipse.org/) > Are you displaying SVG files inside Eclipse plugins (views or editors)? > What plugin are you using to display the SVG content, Java Advanced > Imaging over holongate Batik support (http://www.holongate.org/), Dirk > Lemmerman's Batik SVG Viewer > (http://www.eclipse-workbench.com/jsp/plugin_detail.jsp?id=139&cat=27) > or another way? > > The project I'm working on, need to edit SVG file under Eclipse > run-time. > > Amicalement > Philippe > > > Le mar 02/09/2003 à 15:21, Paul Sinnema a écrit : > > Hi, > > > > I've been struggling with several issues using Batik as the main display > for an new UML Class Diagram in Eclipse. I've solved several of the issues, > but I'm kinda stuck right now. > > > > In my 'view' I use an Interactor to get actions from the mouse (click, > press, etc...). I would like to be able to drag a <g> from one place to > another (make it topped, resize, etc....) for that I need to know which > element in the DOM tree was clicked, dragged, etc.... > > > > Has anyone got any experience with this? > > > > Paul. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]