Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to create container Elements?(screen inside)
How to create container Elements?(screen inside) [message #207696] Thu, 02 October 2008 12:06 Go to next message
Rob is currently offline RobFriend
Messages: 4
Registered: July 2009
Junior Member
Hi!
First of all, you should watch this example screen so its easier to
understand what i really want to know.
http://img119.imageshack.us/my.php?image=examplerf9.jpg
You see 2 Container "Container 1" and "Container 2", which contain other
elements.
I want to create an editor, which allows to create such containers and add
other objects only in this container. A link from "Object 1" in "Container
1" to "Object 2" in "Container 2" is not allowed. I tried it with
compartments but its not that what i want because those compartments are
fixed and i cant move them within my "Container".
I think, there is a way to solve this problem with compartments but i'm
really new to GMF, so i dont know how to do it.
Maybe, someone here can help me.

Thanks.
Rob
Re: How to create container Elements?(screen inside) [message #207703 is a reply to message #207696] Thu, 02 October 2008 12:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Hi Rob,

what you describe should really be no problem with GMF. Your metamodel
(ecore) should hold a class for the diagram (D), a class for the
container (C),a class for the objects, and optionally a class for the
links (L). In the GmfGraph you should have the figures for the container
and object, a compartment for the container, two nodes and a link. Now,
in the GmfMap, just create a top node mapping for the container nodes,
holding a compartment and another node mapping for the object nodes. Set
the references to the metamodel and the gmfgraph according to the GMF
tutorial, create the link mapping and the link constraint, and you
should be fine.

Regarding your last sentence I guess that the comparment's layout was
set to ListLayout, so you should check this in your gmfgen file. Maybe
that's all you need to change.

Tobias



Rob schrieb:
> Hi!
> First of all, you should watch this example screen so its easier to
> understand what i really want to know.
> http://img119.imageshack.us/my.php?image=examplerf9.jpg
> You see 2 Container "Container 1" and "Container 2", which contain other
> elements.
> I want to create an editor, which allows to create such containers and
> add other objects only in this container. A link from "Object 1" in
> "Container 1" to "Object 2" in "Container 2" is not allowed. I tried it
> with compartments but its not that what i want because those
> compartments are fixed and i cant move them within my "Container". I
> think, there is a way to solve this problem with compartments but i'm
> really new to GMF, so i dont know how to do it.
> Maybe, someone here can help me.
>
> Thanks.
> Rob
>
Re: How to create container Elements?(screen inside) [message #207719 is a reply to message #207703] Thu, 02 October 2008 13:52 Go to previous messageGo to next message
Rob is currently offline RobFriend
Messages: 4
Registered: July 2009
Junior Member
I tried to create an editor like you said but it doesnt work.
I made some screenshots, so you can see what i did wrong.
1st (my ecore) : http://img240.imageshack.us/my.php?image=ecoretq3.jpg
2nd (gmfgraph, i added an compartment with my ObjectFigure) :
http://img399.imageshack.us/my.php?image=gmfgraphxt9.jpg
3rd (gmfmap, i added the compartment mapping like its written in the GMF
tutorial) : http://img66.imageshack.us/my.php?image=gmfmapkf2.jpg
I created my Generator Model and i got an error "Top Level Node
'Containment Feature' must be available in the diagram 'Domain Element' or
it's super-class".
I dont know why i got this error but i ignored it and generated the
Diagram Code.
I also changed the layout type in my gmfgen as you can see on this
screenshot.
http://img258.imageshack.us/my.php?image=gmfgenwb8.jpg
The default value was "UNKNOWN". I changed it to "FLOW_LAYOUT".
I started my Editor and i can create Containers with Objects in. But i
cant move/resize etc. my Objects in my Container as you can see here.
http://img367.imageshack.us/my.php?image=applicationnu3.jpg
Re: How to create container Elements?(screen inside) [message #207727 is a reply to message #207719] Thu, 02 October 2008 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

Hi Rob,

1) From what I can see, the ecore model looks fine.

2) I don't think it's necessary to define a layout in the gmfgraph (I
never did). Especially I'm a bit confused as you set FlowLayout to false
in the gmfgraph and then set the layout to flowLayout in the gmfgen...

3) In the GmfMap you should remove the TopNodeReference to Object, as
Top Node References always represent elements directly contained in the
diagram element (which, for Objects, is not the case). This also
explains the error.

4) in the gmfgen there is another attribute concerning the layout of a
compartment, though it is a bit hidden. Instead of setting the layout of
the viewmap you should look for the attribute 'ListLayout' (an attribute
- not a child - of the Compartment) and set the value to false.

Hope this helps,
Tobias





Rob schrieb:
> I tried to create an editor like you said but it doesnt work.
> I made some screenshots, so you can see what i did wrong.
> 1st (my ecore) : http://img240.imageshack.us/my.php?image=ecoretq3.jpg
> 2nd (gmfgraph, i added an compartment with my ObjectFigure) :
> http://img399.imageshack.us/my.php?image=gmfgraphxt9.jpg
> 3rd (gmfmap, i added the compartment mapping like its written in the GMF
> tutorial) : http://img66.imageshack.us/my.php?image=gmfmapkf2.jpg
> I created my Generator Model and i got an error "Top Level Node
> 'Containment Feature' must be available in the diagram 'Domain Element'
> or it's super-class".
> I dont know why i got this error but i ignored it and generated the
> Diagram Code.
> I also changed the layout type in my gmfgen as you can see on this
> screenshot. http://img258.imageshack.us/my.php?image=gmfgenwb8.jpg
> The default value was "UNKNOWN". I changed it to "FLOW_LAYOUT".
> I started my Editor and i can create Containers with Objects in. But i
> cant move/resize etc. my Objects in my Container as you can see here.
> http://img367.imageshack.us/my.php?image=applicationnu3.jpg
>
>
>
Re: How to create container Elements?(screen inside) [message #207875 is a reply to message #207727] Mon, 06 October 2008 11:07 Go to previous message
Rob is currently offline RobFriend
Messages: 4
Registered: July 2009
Junior Member
I did what you said and it works.
Thanks a lot.
Previous Topic:Diagram Editor opens up very slowly
Next Topic:about xPand reference
Goto Forum:
  


Current Time: Wed Jan 27 11:50:04 GMT 2021

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

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

Back to the top