Linking from a node inside a compartment to a child node outside the compartment [message #215942] |
Wed, 21 January 2009 02:29  |
Eclipse User |
|
|
|
Hello All,
I have a Top node reference which has a compartment, which in turn has a
number of nodes. I want to define child nodes for these nodes inside, but
the child nodes should be outside the compartment some where in the
canvas to which I can make connections from the parent to child. The
problem is I don't know where to provide the child node mapping in the
gmfmap file. If I define it as a child reference>node mapping under the
respective nodes, inside the compartment, it will be displayed inside the
compartment in the final diagram. I want it to be outside..also some help
towards how to create the Link mapping will also be appreciated.<BR><BR>
I hope someone will be able to help me on this.
Thanks in advance.
Steve
|
|
|
|
|
|
Re: Linking from a node inside a compartment -Hep required [message #216147 is a reply to message #216139] |
Thu, 22 January 2009 12:00   |
Eclipse User |
|
|
|
Originally posted by: romain.raugi.gmail.com
Le 1/22/2009 4:00 PM, Steve a écrit :
> I would greatly appreciate, if someone could point me to something useful..
>
> Thanks,
>
> Steve
>
Hi,
A LinkMapping allows you to map a domain information, a Connection
defined in the gmfgraph model and a palette entry. This domain info can be:
1- A class. Its instances will be represented with the specified
connections. You need to define:
* The containment feature: A EReference of the domain class mapped in
the Canvas mapping. Where to find the connection objects.
* The element: the domain class of the connection.
* The source feature, the EReference of this class that identifies
the source element.
* The target feature, the EReference of the class that identifies the
target element.
class Diagram {
EList<Node> nodes = ...;
EList<Link> links = ...; // the containment feature
}
class Node {
}
class Link { // the element
Node source; // the source feature
Node target; // the target feature
}
2- A EReference, what suggests Enrico. To do that you need to define:
* The target feature: the EReference of you container domain class
that specifies where to get its children.
For example, if you want to connect A instances to their contained B
instances:
class A {
EList<B> children = ...;
}
class B {
}
This EReference will be "children".
You can look at the Mindmap example, this is how topics/subtopics
connections are defined.
Romain
|
|
|
Re: Linking from a node inside a compartment to a child node outside the compartment [message #216817 is a reply to message #215942] |
Fri, 30 January 2009 05:57  |
Eclipse User |
|
|
|
Hello Steve,
> a number of nodes. I want to define child nodes for these nodes
> inside, but the child nodes should be outside the compartment some
> where in the canvas to which I can make connections from the parent
> to child. The problem is I don't know where to provide the child node
> mapping in the gmfmap file.
> If I define it as a child reference>node mapping under the respective nodes,
> inside the compartment, it will be displayed inside the compartment in the
> final diagram. I want it to be outside..
Try to create "phantom" node mappings for these child nodes. This means:
- create a TopNodeReference with appropriate NodeMapping for each of child
nodes
- leave “containmentFeature” property of these TopNodeReferences empty (this
means corresponding top nodes will not be stored inside diagram domain element
hierarchy on creation)
- create Link mappings using containment reference from child nodes container
(located in a compartment) to these child nodes
As a result you will have the situation then you can create “phantom” child
nodes on diagram (corresponding domain model elements will be stored in a
root of EMF resource) and then link these nodes with their parent element
located inside a compartment using special link (in this moment corresponding
domain model element will be moved below the actual parent, but visually
will stay on the same place).
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.05007 seconds