Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to reposition Node Figrues by opening the diagram?!
icon5.gif  how to reposition Node Figrues by opening the diagram?! [message #492550] Tue, 20 October 2009 17:39 Go to next message
deflow Mising name is currently offline deflow Mising nameFriend
Messages: 3
Registered: October 2009
Junior Member
Hi!

i'm a rookie in GMF and i'm on the edge of despair...i hope you can help me with the following problem Confused

i would like to reposition special figures when the diagram is opened by the first time. therefore i created my own edit part (eg MyEditPart) which inherits from the generated edit part.

My next thought was to provide a layout and binding that layout to MyEditPart. So, in my layout class i have access to the instance which is bound. however, when i try to set the new location there is no result on the diagramm...

i have no idea...it would be great if you give me a hint!

regards edd
Re: how to reposition Node Figrues by opening the diagram?! [message #492691 is a reply to message #492550] Wed, 21 October 2009 12:27 Go to previous messageGo to next message
Marc Mising name is currently offline Marc Mising nameFriend
Messages: 193
Registered: July 2009
Location: Valencia, Spain
Senior Member
You have to create a ChangeBoundsRequest and send it to the editPart you want to change the bounds (location and size). Something like that:

EditPart ep = ...
ChangeBoundsRequest cbr = new ChangeBoundsRequest();
cbr.setEditParts(ep);
cbr.setLocation(new Point(x, y));
cbr.setMoveDelta(new Point(x, y));
cbr.setSizeDelta(new Dimension(width, heigh));
ep.getCommand(cbr);

What you need is to change only the location, so the moveDelta and sizeDelta should leave in blank.

Good Luck Wink
Marc
Re: how to reposition Node Figrues by opening the diagram?! [message #492802 is a reply to message #492691] Wed, 21 October 2009 18:33 Go to previous messageGo to next message
deflow Mising name is currently offline deflow Mising nameFriend
Messages: 3
Registered: October 2009
Junior Member
hi marc!

thx for your answer. i tried your suggestion but without a result...
i added the the code to my own layout class, is this the right place?!

is it enough to call the xxx.getCommand(..) without executing that command?

thanks, edd
Re: how to reposition Node Figrues by opening the diagram?! [message #495063 is a reply to message #492550] Tue, 03 November 2009 16:59 Go to previous message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
Hello deflow,

You have to modify positions of the corresponding notation model element
instead of EditPart directly.
Use AbstractTransactionalCommand + Node.getLayoutConstraint() to specity
size/location of the diagram elements.

-----------------
Alex Shatalin
Previous Topic:custom templates and "aspects" directory
Next Topic:Extending gmfgen model
Goto Forum:
  


Current Time: Tue Apr 23 16:19:04 GMT 2024

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

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

Back to the top