Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » 2 top nodes with the same element type
2 top nodes with the same element type [message #202917] Thu, 21 August 2008 11:24 Go to next message
Eclipse UserFriend
Hello there!!!

I have in my gmfmap two top nodes with this configuration:
TopNode1:
containment feature: abc
Node:
element: xyz
diagram node: noRectangle
tool: Creation Tool Rectangle

TopNode2:
containment feature: abc
Node:
element: xyz
diagram node: noCircle
tool: Creation Tool Circle

They have the same "containment feature" and "element", but different
"diagram node" and "tool".

When I try to draw them, however, I just can draw the first one, the
rectangle. If I draw a circle, it isn't showed.

I've read the
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg09118.html
which is a problem close to mine, and I couldn't solve.

Is there anyway to solve this problem?!

Thanks,
Raphael
Re: 2 top nodes with the same element type [message #202933 is a reply to message #202917] Thu, 21 August 2008 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Hello Raphael,

> They have the same "containment feature" and "element", but different
> "diagram node" and "tool".
Add OCL constraints/element initializers to these two elements. GMF should
be able to differentiate betwee first and second node using domain model.

-----------------
Alex Shatalin
Re: 2 top nodes with the same element type [message #202946 is a reply to message #202933] Thu, 21 August 2008 14:18 Go to previous messageGo to next message
Eclipse UserFriend
Hello Alex,

First of all, thanks for your answer...

The only thing that make these nodes different are the "tool"/"diagram
node" properties. The two nodes use the same classes and references in the
domain model.

So, Do I have to include an OCL constraint/element initializers in each
node and related this OCL constraint/element initializers with the
"tool"/"diagram node"?!

Where can I find more information about OCL constraint/element
initializers ?!

Thanks again,
Raphael
Re: 2 top nodes with the same element type [message #203004 is a reply to message #202917] Fri, 22 August 2008 03:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: itleita.gmx.at

I have got the same problem with my connections..
Two link mapping definitions which refer to the same element but have a
different layout/look (and creation tool of course)!
But it just shows the first one..

but i think it's logical.. because.. how should it know which figure to
use when it only stores the element name.. it's tricky.
Re: 2 top nodes with the same element type [message #203019 is a reply to message #202946] Fri, 22 August 2008 04:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello Raphael,

> The only thing that make these nodes different are the "tool"/"diagram
> node" properties. The two nodes use the same classes and references in
> the domain model.
To clarify this question finally I can write down these two examples:

1. There is a Class in UML model and this class can be either arstract or
normal. This means, we do have "abstract" property in a domain model and
all "abstract = true" classes should be represented using 1-st diagram node
(created using 1-st diagram tool) in the same time "abstract == false" classes
should be represented using 2-nd diagram (created using 2-nd diagram tool).
The rest (node EClass and containment reference) is the same. In this case
you have to add Following OCL constraints (child element of node mapping)
to the 1-st NodeMappind: "self.abstract" + Following FeatureSequenceInitializer
for "abstract" feature: (ocl) "true".
Sampe for 2-nd element: "not self.abstract" + FeatureSequenceInitializer
for "abstract" feature: (ocl) "false". As a result "GMF" will be able to
differentiate between 1-st and 2-nd diagram nodes using domain element only.
(For example while initializing diagram contents using existing domain model).
In other words, if there is an property in domain model wich you can use
to separate domain elements of 1-st type from the domain elements of the
2-nd type (or you can add such a property) then you can follow my suggestions
described here.

2. Interface from the UML model can be represented either as "normal class"
or as a circle on diagram. There is no additional property "representItAsCircle"
in a domain model. User can decide with type of visual representation he'd
like to heve for this particular node (using one of two different palette
tools or using popup menu action to transform one representation into another).
In this case you have to modify generated code manually to support this situation.
Another option is to modify templates/genmodel in accordance and generate
this custom code. The case with templates modification was briefly described
in this presentation: http://www.eclipsecon.org/2008/sub/attachments/Bitter_GMF_or _How_We_did_UML_with_GMF.pdf.


Summarizing this: It's much more easy to follow way-1 (add property "Boolean
showAs1stTypeNode" into domain model) because all the code will be generated
for you by GMF automatically. In the same time still there is an option to
wollow way-2 but you should be ready for making custom modifications of the
generated code/templates in this case.

> So, Do I have to include an OCL constraint/element initializers in
> each node and related this OCL constraint/element initializers with
> the "tool"/"diagram node"?!
You have to add OCL constraints/element initializer to both NodeMappings
for the "similar" nodes. And you can attach different tools for each of them.
As a result you'll be able to create node-1 using tool-1 and node-2 using
tool-2.

> Where can I find more information about OCL constraint/element
> initializers ?!
Well... No good documentation on it. You can use OCL specification from OMG
to understand how OCL is working + understand the fact that each domain element
will be "matched" with corresponding NodeMapping taking into account this
constraint. Element initializer will be used on creation time to initialize
corresponding domain element properties.

-----------------
Alex Shatalin
Re: 2 top nodes with the same element type [message #203076 is a reply to message #203004] Fri, 22 August 2008 07:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zippo29.hotmail.fr

Hi!

I used to have the same problem!

A metaclass represented by a connection. I had to create 3 types of
connections according to some properties.

I tried the initilization in the gmfmap but after the creation of the
object on the diagram any change in the property section was impossible.

I don't know if it is the best way to solve it but it works for me:

1)putting the initilizations in the XXXCreateCommand
(doDefaultElementCreation())
2)making the viusal id registry return the correct ID according to the
values of the properties
3)make the getXXX_1000ContainedLinks in XXXDiagramUpdater create the
correct LinkDescriptor according to the ID


HTH
Regards
Re: 2 top nodes with the same element type [message #203295 is a reply to message #203019] Mon, 25 August 2008 10:38 Go to previous message
Eclipse UserFriend
Hello Alex!!!

Thanks a lot! I used the first solution that you gave to me and it work
fine! =D

See ya,
Raphael
Previous Topic:Node recursion
Next Topic:linewrapping for transition labels AND how to display arbitrary strings of a set in a label?
Goto Forum:
  


Current Time: Mon May 12 14:36:28 EDT 2025

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

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

Back to the top