Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » location problem
location problem [message #226541] Thu, 16 November 2006 14:27 Go to next message
Eclipse UserFriend
Originally posted by: Sferzah.yandex.ru

i have a container element on my diagram.
when i move any elements there - it's ok
when i create elements in root diagram - ok (use the same
CreateNodeCommand)

when i put new element (from palette tools) in my container - this element
appear in container with some offset. When i look in my
CreateNodeCommand.SetLocation - location value is right, but when this
command .Execute() - location value is wrong. Where this value can changed?
Re: location problem [message #227696 is a reply to message #226541] Sun, 10 December 2006 15:21 Go to previous messageGo to next message
Le Hong Phuong is currently offline Le Hong PhuongFriend
Messages: 8
Registered: July 2009
Junior Member
I encountered the same problem as you did. I used XYLayout for the container.

Does anyone have any idea? Thanks.
Re: location problem [message #227701 is a reply to message #227696] Sun, 10 December 2006 15:33 Go to previous messageGo to next message
Le Hong Phuong is currently offline Le Hong PhuongFriend
Messages: 8
Registered: July 2009
Junior Member
I tried to track/change the coordinating system of the direct container and the top-most container of a graphical node, but I still cannot get out of an offset.

Any idea will be appreciated!
Re: location problem [message #227760 is a reply to message #227701] Mon, 11 December 2006 07:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Sferzah.yandex.ru

are you use "subdiagram"?

now i look to this process behavior and what i see.. new element laying on
subdiagram with coordinates from root-diagram
(for example - if you put container to diagram in 100,0 coordinates then
ofsset children will be only horizontal, and if you put child in top-left
container's corner - then child coordinate will be ~100,0)
lets find solution
Re: location problem [message #227765 is a reply to message #227760] Mon, 11 December 2006 08:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Sferzah.yandex.ru

so.. in XYLayoutEditPolicyImpl.getCreateCommand (and other commands if
required)

IFigure pane = ((AbstractGraphicalEditPart)getHost()).getContentPane();
Point p = request.getLocation();
pane.translateToRelative(p);

and command.setLocation(p);

it's work to me
Re: location problem [message #227793 is a reply to message #227765] Mon, 11 December 2006 10:41 Go to previous message
Le Hong Phuong is currently offline Le Hong PhuongFriend
Messages: 8
Registered: July 2009
Junior Member
Thanks Alexey,

I've just found the solution by myself by adding the following two lines to the execute() method:


child.setX(request.getLocation().x - parent.getX());
child.setY(request.getLocation().y - parent.getY());

It works.

But I find that your solution is better, so I'll use it. Thanks again.

Bests,
Previous Topic:draw2d "scrolling monitor" question
Next Topic:drawing temporary figure for selection
Goto Forum:
  


Current Time: Fri Apr 26 05:35:24 GMT 2024

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

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

Back to the top