[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Non-binary connections - how do you model them?

I would create an invisible editpart that was capable of holding multiple nodes. Then I would make sure there was always a node for any new connections present.

I tried having a node accept more than 1 connection but I found it did not match at all the GEF framework. There was however no problem with having 1 editpart to house several nodes and give the appearance of connecting multiple lines to one point.

This editpart can listen to the other editparts that house nodes, and move when they move if needs be. Also move when any of its connectoins get reconnected.



Jens v. P. wrote:
On 2004-12-02 05:53:48 +0100, Barry Lay <blay@xxxxxxxxxxxxxxxxxxx> said:

I have a requirement for a non-binary association between objects, and am curious about how one might model it graphically.


I think there are two possibilities:

1) Model the association as (invisible) node
The association is modeled just like the assiciation in UML 2. The association is represented as a node, and every linked "real" node is connected with a binary connection. Maybe it's possible to hide the association node itsself, e.g. by creating a figure with dimension (0,0) or (1,1). If you have to move the association node -- the user is moving the center point of the n-ary association -- the bounds of the node might be greater and you have to provide proper anchor points. The advantage of this apporach is that you have to managy binay connections only.


2) Model the association as Connection and Node
You can implement both interfaces, the Connection and the Node interface. That's no problem. I've implemented a class diagram editor and I needed this for conecting Comments to a Relationship, e.g. connect a Comment to a Generalization with a CommentLink-Connection. The result may look like the first approach and you can use bendpoints for the same puprpose as the center node in the first approach.


Depending on where and how may labes and other decorations you have to provide, maybe the first or the second approach are more suiteable for you. Maybe I like the first case more since it's more straight forward.

Jens




--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into the sheepfold{}, but climbeth up some other *way, the same is a thief and a robber."

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD  19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see http://www.rigidsoftware.com/Chess/chess.html