Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Node position relative to another node position
Node position relative to another node position [message #217424] Fri, 06 February 2009 01:31 Go to next message
AK is currently offline AKFriend
Messages: 18
Registered: July 2009
Junior Member
Is it possible to relocate a node relative to another node in the same
container? So, suppose I have a node N1 and another node N2 next to N1. If I
move or resize N1, I would like to relocate N2 in such a way that it's
position relative to N1's top left corner is the same as it was before N1
was moved/resized.

Thank you in advance.
Re: Node position relative to another node position [message #217625 is a reply to message #217424] Fri, 06 February 2009 17:37 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello AK,

It is possible if N2 is a child element of N1. Try using border items to
locate child element on a border of parent container.

-----------------
Alex Shatalin
Re: Node position relative to another node position [message #217641 is a reply to message #217625] Fri, 06 February 2009 19:46 Go to previous messageGo to next message
AK is currently offline AKFriend
Messages: 18
Registered: July 2009
Junior Member
Thank you, Alex. Unfortunately, that's not the case. As I mentioned N1 and
N2 are in the container so they both are children nodes at the same level.

"Alex Shatalin" <vano@borland.com> wrote in message
news:3c3172e62a48d8cb56a1188ca83b@news.eclipse.org...
> Hello AK,
>
> It is possible if N2 is a child element of N1. Try using border items to
> locate child element on a border of parent container.
>
> -----------------
> Alex Shatalin
>
>
Re: Node position relative to another node position [message #217771 is a reply to message #217641] Mon, 09 February 2009 07:03 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello AK,

Ok. Do you have another (non-containment) reference from N1 to N2? (I suppose
so)
In this case you can try to still represent N2 as a border items (and child
elements) of N1. In .gmfmap model you have to specify this reference (N1->N2)
as a containment one for ChlidReference below N1 Node mapping pointing to
N2 NodeMapping. AFAIKSee current version of .gmfmap editor does not allow
you to do it (only containment references are visible in this place in .gmfmap
editor), but you can try setting appropriate value in text editor, or making
this reference containment, setting the value in .gmfmap editor and setting
this reference back to non-containment. Then you can try to generate code
ignoring all the validation errors reported to you.
Finally you’ll get the situation then N2 is a child element of N1 on diagram
(and can be visualized as border items). In addition you have to correct
creation of N2 – from now it will be possible to create N2 nodes only “inside”
N1 nodes and appropriate container will not be assigned to newly created
N2 instances automatically by generated code. To fix this problem you can
either modify generated N2CreateCommand or modify EMF-generated N1 implementation
class (Collection returned from N1.getN2s()) to assign N2 to the appropriate
collection on attaching it to N1.
I’ve tried to describe possible solution for this situation using current
version of GMF here. In addition suggest you to review “border items” GMF
feature first to be sure this is what you want from the final diagram editor
first.
HTH
-----------------
Alex Shatalin
Previous Topic:Removing context menu items from diagram
Next Topic:Migrating from GMF 2.0.2 to 2.1.* or 2.2.0
Goto Forum:
  


Current Time: Sat Feb 27 10:33:44 GMT 2021

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

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

Back to the top