Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » A clear definition of "children feature" and its use cases?
A clear definition of "children feature" and its use cases? [message #195253] Wed, 02 July 2008 08:33 Go to next message
Eclipse UserFriend
Originally posted by: zippo29.hotmail.fr

Hi all!

I have gone through some posts (if not all) that speak about "children
feature", I read the note in the GMF tutorial but I am still not
understanding completly.

They say it's for specify "where children are taken from". Sorry, but
children in a graphical meaning or semantic ? What does it mean taken from
(from where they are stored = containment)? It seems to be created to do a
derived association, am I right?

Adding on that that the use case they give as an example is very specific.
Does someone have a clear definition of "children feature" and how to use
it ?


Thanks in advance.
Re: A clear definition of "children feature" and its use cases? [message #195330 is a reply to message #195253] Wed, 02 July 2008 11:04 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mous,

Imagine you have the following domain model:

- EClass "Container"
- ContainmentReference "abstractChildren"
- Reference "childrenOfType1"
- Reference "childrenOfType2"

- Abstract EClass "AbstractChild"

- EClass "ChildOfType1"

- EClass "ChildOfType2"

and you would like to represent all "childrenOfType1" for each Container
instance as child elements. In this case you have to specify "abstractChildren"
reference as a containment reference and "childrenOfType1" as child one.


-----------------
Alex Shatalin
Re: A clear definition of "children feature" and its use cases? [message #195380 is a reply to message #195330] Wed, 02 July 2008 11:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zippo29.hotmail.fr

Thanks for your answer!

But is this the only use case it was made for ? Suppose I have a case
where I want to represent a node that has no containment with the root or
with any element in the diagram but just association:

EClass A <------ EClass B <>------> EClass C (B as root element)
or
EClass B <>------> EClass C ------> EClass A (B as root element)


Is the children feature serves me in this case?
Re: A clear definition of "children feature" and its use cases? [message #195387 is a reply to message #195380] Wed, 02 July 2008 12:21 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mous,

> where I want to represent a node that has no containment with the root
> or with any element in the diagram but just association:
Then you have to specify "containment" feature == refernce from "graphically"
parent element to "graphically" child one set container for newly created
"child" somehow using custom code.

In other words, AFAIK currently child and containment feature are both features
of the same "graphically parent" element. If you need to physically put child
node somewhere else - make this reference derived and implement corresponding
logic in EMF-generated setter method for this feature.

-----------------
Alex Shatalin
Re: A clear definition of "children feature" and its use cases? [message #195631 is a reply to message #195387] Thu, 03 July 2008 12:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zippo29.hotmail.fr

Hi Alex!

I had to search on google to understand what "AFAIK" means! My english is
not that good :p!

AW(AnyWay ;)), I tried to create an editor for this case :

EClass D <>------>EClass E<>------>EClass B <>------> EClass C ------>
EClass A
EClass D <>------>EClass A

I created a main editor (Root D) Es contain Bs => no problem.
I created a sub-editor for the Bs: in the gmfmap B is the root element. I
created a top node for C and a top node for A with (containment
feature)and (children feature) left blank. So it's a phantom node. I
created a linkMapping representing the reference between C and A.

I generated the gmfgen ignoring the validating error (phatom nodes exist
not targeted ...) of the gmfmap. I generated the code(No complain from the
gmfgen).

My editor works fine. A nodes appears at the resource level as expected
from the phantom nodes.

From now, I have 3 questions :
- Is this a bug in gmf : gmfmap not valid and gmfgen valid and no problem
in generated code ?
- I want the As to be created in the D level instead of the resource
level. Is this possible ? If yes, how to do it ? EMF custom code or GMF
custom code ?
- I noticed that the As are shared between all the instances of B
diagrams i-e if I created a new instance of B all the As that ewxist in
the resource are loaded in my new diagram. I managed to handle this by
changing the XDiagramUpdater.getB_VisualIDSemanticChildren() method. Is
there a another/better way to do this ?


Thanks for your patience until the end!
Best regards
Re: A clear definition of "children feature" and its use cases? [message #195648 is a reply to message #195631] Thu, 03 July 2008 12:30 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mous,

First i'd like to suggest you using "shortcutting" functionality for adding
A instance onto the B diagram.. but the problem is: you can not create links
between element of diagramType-1 (B) and diagramType-2 (D) now.. So, let's
try to answer questions below.

> I had to search on google to understand what "AFAIK" means! My english
> is not that good :p!
>
> AW(AnyWay ;)), I tried to create an editor for this case :
>
> EClass D <>------>EClass E<>------>EClass B <>------> EClass C ------>
> EClass A
> EClass D <>------>EClass A
> I created a main editor (Root D) Es contain Bs => no problem.
> I created a sub-editor for the Bs: in the gmfmap B is the root
> element. I
> created a top node for C and a top node for A with (containment
> feature)and (children feature) left blank. So it's a phantom node. I
> created a linkMapping representing the reference between C and A.
>
> I generated the gmfgen ignoring the validating error (phatom nodes
> exist not targeted ...) of the gmfmap. I generated the code(No
> complain from the gmfgen).
>
> My editor works fine. A nodes appears at the resource level as
> expected from the phantom nodes.
>
> From now, I have 3 questions :


> - Is this a bug in gmf : gmfmap not valid and gmfgen valid and no
> problem in generated code ?
Well, you still have "unexpected behavior" - "A" diagram elements created
on "B" diagram will go to the root of domain model resource directly and
will not reside in any containers.. This is why we show warning while transforming
..gmfmap to .gmfgen..

> - I want the As to be created in the D level instead of the resource
> level. Is this possible ? If yes, how to do it ? EMF custom code or
> GMF custom code ?
I suggest you to modify ACreateCommand generated for diagram "B". You can
see that this command is now attaching newly created "A" instance to the
root of domain model resource. You can modify this code to look for appropriate
"D" and use it as a container for newly created "A". I suppose you will have
some problems with diagram contents initialization functionality at the end,
but let's postpone these questions till next time. :-)

> - I noticed that the As are shared between all the instances of B
> diagrams i-e if I created a new instance of B all the As that ewxist
This is expected behavior for "phantom" nodes - all nodes without specified
contained will reside in resource root.

> the resource are loaded in my new diagram. I managed to handle this by
> changing the XDiagramUpdater.getB_VisualIDSemanticChildren() method.
> Is there a another/better way to do this ?
I think this is a proper place to enter custom modifications in this case.

-----------------
Alex Shatalin
Re: A clear definition of "children feature" and its use cases? [message #195814 is a reply to message #195648] Fri, 04 July 2008 22:41 Go to previous message
Eclipse UserFriend
Originally posted by: zippo29.hotmail.fr

hello!

The createcommand modification works very good. I don't (or still not ;))
have problems.

I work on a good way to express the constraint on the elements in the
updater.

Thanks for your help!
Previous Topic:setroutingconstraint curve problem
Next Topic:Using Dialog box or Wizards to Edit model objects
Goto Forum:
  


Current Time: Thu Mar 28 15:06:48 GMT 2024

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

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

Back to the top