Skip to main content



      Home
Home » Eclipse Projects » GEF » Model has undirected connections; ConnectionEditPart?
Model has undirected connections; ConnectionEditPart? [message #120921] Fri, 05 March 2004 04:25 Go to next message
Eclipse UserFriend
Originally posted by: smallpocks.yahoo.com

Hey Guys,
I am using GEF to create what is essentially an undirected graph. Because
each of the connections between the nodes on my graph needs to be
selectable, I am using a ConnectionEditPart for my links and a NodeEditPart
for my nodes. Here is my question: Since my graph/model only has undirected
connections, how do I differentiate between Source and Target connections?

I have to override both:
List getModelSourceConnections() and

List getModelTargetConnections()

but I only have one List of two-way connections.



In the doc, I found this, which I believe addresses my problem, however I
don't fully understand it.

In GEF, ConnectionEditParts are structural features of their source and
target "nodes", which are EditParts. However, the model does not have this
requirement. The application may store the connection model in any way, or
there may even be no real model. The burden is on the source and target
EditPart to obtain their appropriate connections in the methods
getModelSourceConnections() and getModelTargetConnections(). How this is
done is application specific.



Thanks for any help...

Guy
Re: Model has undirected connections; ConnectionEditPart? [message #120976 is a reply to message #120921] Fri, 05 March 2004 14:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You cannot draw a line without having a starting point and an end point.
You can choose them arbitrarily if you wish.

Does the connection know its nodes? If so, does it store them in a list of
2 nodes? You could pick the first one to be the source, and the second to
be the target.

"Guy Beckman" <smallpocks@yahoo.com> wrote in message
news:c29glm$1bs$1@eclipse.org...
> Hey Guys,
> I am using GEF to create what is essentially an undirected graph. Because
> each of the connections between the nodes on my graph needs to be
> selectable, I am using a ConnectionEditPart for my links and a
NodeEditPart
> for my nodes. Here is my question: Since my graph/model only has
undirected
> connections, how do I differentiate between Source and Target connections?
>
> I have to override both:
> List getModelSourceConnections() and
>
> List getModelTargetConnections()
>
> but I only have one List of two-way connections.
>
>
>
> In the doc, I found this, which I believe addresses my problem, however I
> don't fully understand it.
>
> In GEF, ConnectionEditParts are structural features of their source and
> target "nodes", which are EditParts. However, the model does not have this
> requirement. The application may store the connection model in any way, or
> there may even be no real model. The burden is on the source and target
> EditPart to obtain their appropriate connections in the methods
> getModelSourceConnections() and getModelTargetConnections(). How this is
> done is application specific.
>
>
>
> Thanks for any help...
>
> Guy
>
>
Re: Model has undirected connections; ConnectionEditPart? [message #121000 is a reply to message #120976] Fri, 05 March 2004 19:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: smallpocks.yahoo.com

I understand and I agree. I have already done the things that you suggest
from the perspective of the Connection. The problem comes with the Node,
where I have to have two different methods, one that returns a list of
Source connections and the other that returns a list of Target connections.
It seems to me that these two lists are really meant for nodes with directed
connections. My nodes only have one list of connections, and I'm not sure
what to do about it.
Thanks
Guy

"Randy Hudson" <none@us.ibm.com> wrote in message
news:c2akmf$glv$1@eclipse.org...
> You cannot draw a line without having a starting point and an end point.
> You can choose them arbitrarily if you wish.
>
> Does the connection know its nodes? If so, does it store them in a list
of
> 2 nodes? You could pick the first one to be the source, and the second to
> be the target.
>
> "Guy Beckman" <smallpocks@yahoo.com> wrote in message
> news:c29glm$1bs$1@eclipse.org...
> > Hey Guys,
> > I am using GEF to create what is essentially an undirected graph.
Because
> > each of the connections between the nodes on my graph needs to be
> > selectable, I am using a ConnectionEditPart for my links and a
> NodeEditPart
> > for my nodes. Here is my question: Since my graph/model only has
> undirected
> > connections, how do I differentiate between Source and Target
connections?
> >
> > I have to override both:
> > List getModelSourceConnections() and
> >
> > List getModelTargetConnections()
> >
> > but I only have one List of two-way connections.
> >
> >
> >
> > In the doc, I found this, which I believe addresses my problem, however
I
> > don't fully understand it.
> >
> > In GEF, ConnectionEditParts are structural features of their source and
> > target "nodes", which are EditParts. However, the model does not have
this
> > requirement. The application may store the connection model in any way,
or
> > there may even be no real model. The burden is on the source and target
> > EditPart to obtain their appropriate connections in the methods
> > getModelSourceConnections() and getModelTargetConnections(). How this is
> > done is application specific.
> >
> >
> >
> > Thanks for any help...
> >
> > Guy
> >
> >
>
>
Re: Model has undirected connections; ConnectionEditPart? [message #121130 is a reply to message #121000] Tue, 09 March 2004 11:32 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Guy Beckman" <smallpocks@yahoo.com> wrote in message
news:c2b4h9$2mn$1@eclipse.org...
> I understand and I agree. I have already done the things that you suggest
> from the perspective of the Connection. The problem comes with the Node,
> where I have to have two different methods, one that returns a list of
> Source connections and the other that returns a list of Target
connections.
> It seems to me that these two lists are really meant for nodes with
directed
> connections. My nodes only have one list of connections, and I'm not sure
> what to do about it.
> Thanks
> Guy

You have to do pretty much the same thing. Start by getting all of the
connections, then remove the ones for which the node is not the "first"
(i.e. source) node, and you will have your "source" nodes. Do the opposite
for targets. We have discussed this before and there doesn't seem to be any
way to avoid the fact that a connection is connected to an *ordered* pair of
nodes.
Previous Topic:Properties View
Next Topic:createChangeConstraintCommand; weird values getting passed in...
Goto Forum:
  


Current Time: Wed May 07 15:22:33 EDT 2025

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

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

Back to the top