Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to add two or more connections between two editpart?
How to add two or more connections between two editpart? [message #165301] Mon, 24 January 2005 05:29 Go to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

I mean the connections are displayed separatedly.
Both the ChorpboxAnchor and the EllipseAnchor will display the connections
overlaped.Should I write a new Anchor by myslfe?

Thanks.
Re: How to add two or more connections between two editpart? [message #165349 is a reply to message #165301] Mon, 24 January 2005 13:36 Go to previous messageGo to next message
Brian Fernandes is currently offline Brian FernandesFriend
Messages: 68
Registered: July 2009
Member
I guess you could write your own Anchors, but another option is to change
the router a bit. It could detect that a particular row or column has been
occupied already and choose a different row or column, the Chopbox and
Ellipse Anchors will automatically return different locations on the side
of the figure.

Have a look at how the ManhattanConnectectionRouter for ideas.

Best,
Brian.
zhlmmc wrote:

> I mean the connections are displayed separatedly.
> Both the ChorpboxAnchor and the EllipseAnchor will display the connections
> overlaped.Should I write a new Anchor by myslfe?

> Thanks.
Re: How to add two or more connections between two editpart? [message #165374 is a reply to message #165301] Mon, 24 January 2005 17:29 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Use the FanRouter. It will fan out overlapping connections. You can invoke
setSeparation() to specify the distance by which you want the connections to
be spread out. Whatever router you're using currently, should be set as the
next router on the FanRouter. Then, when you set the FanRouter as the
router for your layer, it will use "the next router" for laying out the
connections, and will fan out ones that are over-lapping.

Look at EDiagram example's DiagramEditPart#refreshVisuals().

"zhlmmc" <zhlmmc@hotmail.com> wrote in message
news:ct2132$m3j$1@www.eclipse.org...
> I mean the connections are displayed separatedly.
> Both the ChorpboxAnchor and the EllipseAnchor will display the connections
> overlaped.Should I write a new Anchor by myslfe?
>
> Thanks.
>
Re: How to add two or more connections between two editpart? [message #165442 is a reply to message #165374] Tue, 25 January 2005 12:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

I did what you said but it doesn't work.
protected IFigure createFigure() {
PolylineConnection connection = new PolylineConnection();
Label label = new Label();
label.setText("line");
FanRouter frouter = new FanRouter();
frouter.setSeparation(50);
frouter.setNextRouter(new BendpointConnectionRouter());
connection.setConnectionRouter(frouter);
connection.add(label,new
ConnectionLocator(connection,ConnectionLocator.MIDDLE));

return connection;
}
The connections are still displayed overlapped.
What's wrong?Is there any constraint with my EditPart?

Pratik Shah wrote:

> Use the FanRouter. It will fan out overlapping connections. You can invoke
> setSeparation() to specify the distance by which you want the connections to
> be spread out. Whatever router you're using currently, should be set as the
> next router on the FanRouter. Then, when you set the FanRouter as the
> router for your layer, it will use "the next router" for laying out the
> connections, and will fan out ones that are over-lapping.

> Look at EDiagram example's DiagramEditPart#refreshVisuals().

> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> news:ct2132$m3j$1@www.eclipse.org...
>> I mean the connections are displayed separatedly.
>> Both the ChorpboxAnchor and the EllipseAnchor will display the connections
>> overlaped.Should I write a new Anchor by myslfe?
>>
>> Thanks.
>>
Re: How to add two or more connections between two editpart? [message #165450 is a reply to message #165374] Tue, 25 January 2005 12:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

hi~
I did what you said but it doesn't work.
protected IFigure createFigure() {
PolylineConnection connection = new PolylineConnection();
Label label = new Label();
label.setText("line");
FanRouter frouter = new FanRouter();
frouter.setSeparation(50);
frouter.setNextRouter(new BendpointConnectionRouter());
connection.setConnectionRouter(frouter);
connection.add(label,new
ConnectionLocator(connection,ConnectionLocator.MIDDLE));

return connection;
}
The connections are still displayed overlapped.
What's wrong?Is there any constraint with my EditPart?

Pratik Shah wrote:

> Use the FanRouter. It will fan out overlapping connections. You can invoke
> setSeparation() to specify the distance by which you want the connections to
> be spread out. Whatever router you're using currently, should be set as the
> next router on the FanRouter. Then, when you set the FanRouter as the
> router for your layer, it will use "the next router" for laying out the
> connections, and will fan out ones that are over-lapping.

> Look at EDiagram example's DiagramEditPart#refreshVisuals().

> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> news:ct2132$m3j$1@www.eclipse.org...
>> I mean the connections are displayed separatedly.
>> Both the ChorpboxAnchor and the EllipseAnchor will display the connections
>> overlaped.Should I write a new Anchor by myslfe?
>>
>> Thanks.
>>
Re: How to add two or more connections between two editpart? [message #165496 is a reply to message #165442] Tue, 25 January 2005 15:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

3.0 had problems if you were using different instance of ChopBoxAnchors at
the ends of the connections. This is fixed in the latest code. If this is
your problem, reuse the same anchor instance at your nodes.

"zhlmmc" <zhlmmc@hotmail.com> wrote in message
news:ct5cea$hf2$1@www.eclipse.org...
>I did what you said but it doesn't work.
> protected IFigure createFigure() {
> PolylineConnection connection = new PolylineConnection();
> Label label = new Label();
> label.setText("line");
> FanRouter frouter = new FanRouter();
> frouter.setSeparation(50);
> frouter.setNextRouter(new BendpointConnectionRouter());
> connection.setConnectionRouter(frouter);
> connection.add(label,new
> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>
> return connection;
> }
> The connections are still displayed overlapped.
> What's wrong?Is there any constraint with my EditPart?
>
> Pratik Shah wrote:
>
>> Use the FanRouter. It will fan out overlapping connections. You can
>> invoke
>> setSeparation() to specify the distance by which you want the connections
>> to
>> be spread out. Whatever router you're using currently, should be set as
>> the
>> next router on the FanRouter. Then, when you set the FanRouter as the
>> router for your layer, it will use "the next router" for laying out the
>> connections, and will fan out ones that are over-lapping.
>
>> Look at EDiagram example's DiagramEditPart#refreshVisuals().
>
>> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
>> news:ct2132$m3j$1@www.eclipse.org...
>>> I mean the connections are displayed separatedly.
>>> Both the ChorpboxAnchor and the EllipseAnchor will display the
>>> connections
>>> overlaped.Should I write a new Anchor by myslfe?
>>>
>>> Thanks.
>>>
>
>
Re: How to add two or more connections between two editpart? [message #165501 is a reply to message #165442] Tue, 25 January 2005 16:41 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
You should be setting the connection router on the connection layer (and
only once), not on the connection itself. Like I said, look at ediagram
example's DiagramEditPart if you need more details.

"zhlmmc" <zhlmmc@hotmail.com> wrote in message
news:ct5cea$hf2$1@www.eclipse.org...
> I did what you said but it doesn't work.
> protected IFigure createFigure() {
> PolylineConnection connection = new PolylineConnection();
> Label label = new Label();
> label.setText("line");
> FanRouter frouter = new FanRouter();
> frouter.setSeparation(50);
> frouter.setNextRouter(new BendpointConnectionRouter());
> connection.setConnectionRouter(frouter);
> connection.add(label,new
> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>
> return connection;
> }
> The connections are still displayed overlapped.
> What's wrong?Is there any constraint with my EditPart?
>
> Pratik Shah wrote:
>
> > Use the FanRouter. It will fan out overlapping connections. You can
invoke
> > setSeparation() to specify the distance by which you want the
connections to
> > be spread out. Whatever router you're using currently, should be set as
the
> > next router on the FanRouter. Then, when you set the FanRouter as the
> > router for your layer, it will use "the next router" for laying out the
> > connections, and will fan out ones that are over-lapping.
>
> > Look at EDiagram example's DiagramEditPart#refreshVisuals().
>
> > "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> > news:ct2132$m3j$1@www.eclipse.org...
> >> I mean the connections are displayed separatedly.
> >> Both the ChorpboxAnchor and the EllipseAnchor will display the
connections
> >> overlaped.Should I write a new Anchor by myslfe?
> >>
> >> Thanks.
> >>
>
>
Re: How to add two or more connections between two editpart? [message #165601 is a reply to message #165501] Wed, 26 January 2005 04:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

Where can I download the ediagram example?

Pratik Shah wrote:

> You should be setting the connection router on the connection layer (and
> only once), not on the connection itself. Like I said, look at ediagram
> example's DiagramEditPart if you need more details.

> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> news:ct5cea$hf2$1@www.eclipse.org...
>> I did what you said but it doesn't work.
>> protected IFigure createFigure() {
>> PolylineConnection connection = new PolylineConnection();
>> Label label = new Label();
>> label.setText("line");
>> FanRouter frouter = new FanRouter();
>> frouter.setSeparation(50);
>> frouter.setNextRouter(new BendpointConnectionRouter());
>> connection.setConnectionRouter(frouter);
>> connection.add(label,new
>> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>>
>> return connection;
>> }
>> The connections are still displayed overlapped.
>> What's wrong?Is there any constraint with my EditPart?
>>
>> Pratik Shah wrote:
>>
>> > Use the FanRouter. It will fan out overlapping connections. You can
> invoke
>> > setSeparation() to specify the distance by which you want the
> connections to
>> > be spread out. Whatever router you're using currently, should be set as
> the
>> > next router on the FanRouter. Then, when you set the FanRouter as the
>> > router for your layer, it will use "the next router" for laying out the
>> > connections, and will fan out ones that are over-lapping.
>>
>> > Look at EDiagram example's DiagramEditPart#refreshVisuals().
>>
>> > "zhlmmc" <zhlmmc@hotmail.com> wrote in message
>> > news:ct2132$m3j$1@www.eclipse.org...
>> >> I mean the connections are displayed separatedly.
>> >> Both the ChorpboxAnchor and the EllipseAnchor will display the
> connections
>> >> overlaped.Should I write a new Anchor by myslfe?
>> >>
>> >> Thanks.
>> >>
>>
>>
Re: How to add two or more connections between two editpart? [message #165609 is a reply to message #165496] Wed, 26 January 2005 05:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

You mean use the same ChopboxAnchor at the ends of the same connection?
I did that but it still doesn't work.

Randy Hudson wrote:

> 3.0 had problems if you were using different instance of ChopBoxAnchors at
> the ends of the connections. This is fixed in the latest code. If this is
> your problem, reuse the same anchor instance at your nodes.

> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> news:ct5cea$hf2$1@www.eclipse.org...
>>I did what you said but it doesn't work.
>> protected IFigure createFigure() {
>> PolylineConnection connection = new PolylineConnection();
>> Label label = new Label();
>> label.setText("line");
>> FanRouter frouter = new FanRouter();
>> frouter.setSeparation(50);
>> frouter.setNextRouter(new BendpointConnectionRouter());
>> connection.setConnectionRouter(frouter);
>> connection.add(label,new
>> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>>
>> return connection;
>> }
>> The connections are still displayed overlapped.
>> What's wrong?Is there any constraint with my EditPart?
>>
>> Pratik Shah wrote:
>>
>>> Use the FanRouter. It will fan out overlapping connections. You can
>>> invoke
>>> setSeparation() to specify the distance by which you want the connections
>>> to
>>> be spread out. Whatever router you're using currently, should be set as
>>> the
>>> next router on the FanRouter. Then, when you set the FanRouter as the
>>> router for your layer, it will use "the next router" for laying out the
>>> connections, and will fan out ones that are over-lapping.
>>
>>> Look at EDiagram example's DiagramEditPart#refreshVisuals().
>>
>>> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
>>> news:ct2132$m3j$1@www.eclipse.org...
>>>> I mean the connections are displayed separatedly.
>>>> Both the ChorpboxAnchor and the EllipseAnchor will display the
>>>> connections
>>>> overlaped.Should I write a new Anchor by myslfe?
>>>>
>>>> Thanks.
>>>>
>>
>>
Re: How to add two or more connections between two editpart? [message #165625 is a reply to message #165501] Wed, 26 January 2005 06:19 Go to previous message
Eclipse UserFriend
Originally posted by: zhlmmc.hotmail.com

I've got it,thank you :)

Pratik Shah wrote:

> You should be setting the connection router on the connection layer (and
> only once), not on the connection itself. Like I said, look at ediagram
> example's DiagramEditPart if you need more details.

> "zhlmmc" <zhlmmc@hotmail.com> wrote in message
> news:ct5cea$hf2$1@www.eclipse.org...
>> I did what you said but it doesn't work.
>> protected IFigure createFigure() {
>> PolylineConnection connection = new PolylineConnection();
>> Label label = new Label();
>> label.setText("line");
>> FanRouter frouter = new FanRouter();
>> frouter.setSeparation(50);
>> frouter.setNextRouter(new BendpointConnectionRouter());
>> connection.setConnectionRouter(frouter);
>> connection.add(label,new
>> ConnectionLocator(connection,ConnectionLocator.MIDDLE));
>>
>> return connection;
>> }
>> The connections are still displayed overlapped.
>> What's wrong?Is there any constraint with my EditPart?
>>
>> Pratik Shah wrote:
>>
>> > Use the FanRouter. It will fan out overlapping connections. You can
> invoke
>> > setSeparation() to specify the distance by which you want the
> connections to
>> > be spread out. Whatever router you're using currently, should be set as
> the
>> > next router on the FanRouter. Then, when you set the FanRouter as the
>> > router for your layer, it will use "the next router" for laying out the
>> > connections, and will fan out ones that are over-lapping.
>>
>> > Look at EDiagram example's DiagramEditPart#refreshVisuals().
>>
>> > "zhlmmc" <zhlmmc@hotmail.com> wrote in message
>> > news:ct2132$m3j$1@www.eclipse.org...
>> >> I mean the connections are displayed separatedly.
>> >> Both the ChorpboxAnchor and the EllipseAnchor will display the
> connections
>> >> overlaped.Should I write a new Anchor by myslfe?
>> >>
>> >> Thanks.
>> >>
>>
>>
Previous Topic:drag
Next Topic:Direct Edit on creation
Goto Forum:
  


Current Time: Thu Apr 25 07:05:58 GMT 2024

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

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

Back to the top