|Re: How to create container Elements?(screen inside) [message #207703 is a reply to message #207696]
||Thu, 02 October 2008 12:26
Originally posted by: tobk42.gmx.de|
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.
> First of all, you should watch this example screen so its easier to
> understand what i really want to know.
> You see 2 Container "Container 1" and "Container 2", which contain other
> 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.
|Re: How to create container Elements?(screen inside) [message #207727 is a reply to message #207719]
||Thu, 02 October 2008 14:05
Originally posted by: tobk42.gmx.de|
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,
> 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) :
> 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.
Powered by FUDForum
. Page generated in 0.01454 seconds