Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Problem with GEF Directed Graph Tutorial
Problem with GEF Directed Graph Tutorial [message #249516] Wed, 08 July 2009 23:15 Go to next message
Andrea Mazzario is currently offline Andrea MazzarioFriend
Messages: 10
Registered: July 2009
Junior Member
I am implementing a simple GEF editor based on the Directed Graph
tutorial, and I have a problem when adding nodes. The code in the
GraphXYLayoutEditPolicy that creates the NodeCreateCommand simply gets the
location from the request and passes it to the command:

NodeCreateCommand result = new NodeCreateCommand();
result.setLocation(request.getLocation());

This works fine unless the window in which we attempt to create the
command has been scrolled: It seems that the NodeCreateCommand expects an
absolute location, while the request.getLocation() seems to return the
relative position of the mouse.
Can anybody tell me how to fix the GraphXYLayoutEditPolicy in the tutorial
so it will work correctly also if the window has been scrolled?

Thanks in advance
Andrea
Re: Problem with GEF Directed Graph Tutorial [message #249547 is a reply to message #249516] Thu, 09 July 2009 16:55 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

Before you set the location on the reult try doing the following:

Point location = req.getLocation();
((GraphicalEditPart)getHist()).getFigure.translateToRelative (location);
result.setLocation(location);

Hope this helps.

Cheers,
Alex
Re: Problem with GEF Directed Graph Tutorial [message #249705 is a reply to message #249547] Wed, 22 July 2009 23:14 Go to previous message
Andrea Mazzario is currently offline Andrea MazzarioFriend
Messages: 10
Registered: July 2009
Junior Member
Alex,
I apologize for my late reply, I was pulled into an emergency ;-(
Anyway, I was now able to get back to it, I tried to follow your
suggestion and it works great.
Thank you !!!!
Andrea
Previous Topic:GEF Printing error
Next Topic:How to create Hyperlink label or Image in GEF(Draw @d)
Goto Forum:
  


Current Time: Fri Apr 19 02:15:22 GMT 2024

Powered by FUDForum. Page generated in 0.02088 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top