Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Connected nodes
Connected nodes [message #70976] Fri, 27 October 2006 11:19 Go to next message
Eclipse UserFriend
Originally posted by: eclipse-removethis.thistoo-reckord.de

Hi,

I'm fairly new to GMF and after building some very simple editors (like the mindmap example) I'm trying to build a slightly more complex
editor and already hitting wall after wall.

I'll outline my problems below, but to sum it up: Is there somewhere some more advanced tutorial/documentation than the mindmap one, that
outlines how to deal with some typical cases where the domain model cannot be mapped 1:1 to the graphical model?

My problems in detail:

I'm trying to create a very simple component diagram editor featuring components that can have ports and connections between ports (one
connection per port). My domain model looks like this:
http://www.se.eecs.uni-kassel.de/se/fileadmin/gmf/model.png

I'd like to have the diagram look something like this badly faked screenshot:
http://www.se.eecs.uni-kassel.de/se/fileadmin/gmf/diagram.pn g

My first problem was that I couldn't find a good way to get the ports stick to the component since apparently GMF doesn't support nodes
directly adjacent to each other. I tried using two nested rectangles for the component, the outer one also containing the rectangles for the
ports and solving the problem with a custom layouter, which was . Is there an easier way to do this? Are node-node connections planned for
the future? I'd imagine this to be a rather frequent requirement.

In my next attempt I tried to only show ports for which a connection exists and to use decorations to show the ports as ends of the
polyline. This led to a new problem: graphically, the polyline should connect the two component rectangles. But in the mapping I can't tell
it to use source.component and target.component (the ports association is bidirectional) to find the source and target for the line. Is
something like this possible or do I need to add a direct reference to my domain model?

Next, I further simplified my domain model to http://www.se.eecs.uni-kassel.de/se/fileadmin/gmf/model1.png
With that model and using polygon decorations to visualize the ports, I finally got a diagram editor running. But I wasn't able to get the
port names to show in the decorations. Although the label figures are children of the polygon decorations in the gallery, they are always
shown as labels connected to the line:

http://www.se.eecs.uni-kassel.de/se/fileadmin/gmf/diagram1.p ng


I hope these questions are not too dumb, but after some days of poking GMF and searching the newsgroup I still couldn't find any obvious
solutions.

Regards,
Carsten
Re: Connected nodes [message #70989 is a reply to message #70976] Fri, 27 October 2006 11:49 Go to previous messageGo to next message
Eclipse UserFriend
Hello Carsten,


> My first problem was that I couldn't find a good way to get the ports
> stick to the component since apparently GMF doesn't support nodes
Did you try setting affixedParentSide attribute for port Node in .gmfgraph
model? This attribute was recently added and is available in 2.0 builds.
Intention is to place some child node to the border of the parent – AFAIU
this is exactly what you want.

I suggest you to return back to the original domain model. It should be
possible to create Component, then create several ports in it (should be
located on the border of component) and then connect two ports from the different
components with the Connection. It is what you want, isn’t it?

-----------------
Alex Shatalin
Re: Connected nodes [message #71004 is a reply to message #70989] Fri, 27 October 2006 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-removethis.thistoo-reckord.de

Hi Alex,

On 27.10.2006 17:49, Alex Shatalin wrote:
> be possible to create Component, then create several ports in it (should
> be located on the border of component) and then connect two ports from
> the different components with the Connection. It is what you want, isn’t
> it?

That's exactly what I want, thanks. I was using GMF1 so far, updating right now :)

Aside from that though, I'm going to run into my second problem quite soon again - how to create visual links between objects that are only
indirectly connected in the domain model. Do you have any tips/examples for that? Can it be done through the mapping alone or do I have to
modify the generated code?
Re: Connected nodes [message #71044 is a reply to message #71004] Fri, 27 October 2006 13:01 Go to previous messageGo to next message
Eclipse UserFriend
Hello Carsten,

I’ll try to answer your question please correct me if I misunderstood you.
AFAIU it is necessary to create a link from node1 to node2. This link should
be reflected in the model in some complex way. For example: child of node1
(node1.1) should be created and keep a reference to link object, link object
should point to the newly created child node of node2 (node2.1). To cover
this use case we suggest to modify your model by adding “transient derived
volatile” feature to the node1 and to the link classes. As a result you’ll
be able to express this logic in corresponding java methods and just use
these features in link mapping.

Another solution is to modify code, by this one looks easy.

-----------------
Alex Shatalin
Re: Connected nodes [message #71939 is a reply to message #70989] Tue, 31 October 2006 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stefano.puri.gmail.com

Hi Alex,
in 2.0 builds can the affixedParentSide attribute also be used for a node
with compartment?

Regards,
Stefano.

"Alex Shatalin" <vano@borland.com> ha scritto nel messaggio
news:cd695fb3125fc8c8c80757870163@news.eclipse.org...
> Hello Carsten,
>
>
>> My first problem was that I couldn't find a good way to get the ports
>> stick to the component since apparently GMF doesn't support nodes
> Did you try setting affixedParentSide attribute for port Node in
> .gmfgraph model? This attribute was recently added and is available in 2.0
> builds. Intention is to place some child node to the border of the
> parent - AFAIU this is exactly what you want.
>
> I suggest you to return back to the original domain model. It should be
> possible to create Component, then create several ports in it (should be
> located on the border of component) and then connect two ports from the
> different components with the Connection. It is what you want, isn't it?
>
> -----------------
> Alex Shatalin
>
>
Re: Connected nodes [message #72106 is a reply to message #71939] Tue, 31 October 2006 09:36 Go to previous message
Eclipse UserFriend
Hello Stefano,

> in 2.0 builds can the affixedParentSide attribute also be used for a
> node with compartment?
Nobody tried that. ;-) You can try and report any errors you found.

-----------------
Alex Shatalin
Previous Topic:changing connection color programtically
Next Topic:Only single root element allowed, forbid to D&D a second one to Root pane
Goto Forum:
  


Current Time: Thu Jul 24 01:12:44 EDT 2025

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

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

Back to the top