Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Bend Connections routed by OrthogonalRouter (GEF 5)(Bend Connections routed by OrthogonalRouter (GEF 5))
Bend Connections routed by OrthogonalRouter (GEF 5) [message #1772104] Tue, 05 September 2017 14:27 Go to next message
Thomas Oberle is currently offline Thomas OberleFriend
Messages: 11
Registered: April 2017
Junior Member
Hello,

I want to be able to bend the Connections between my nodes.

To do so I add the following bindings:
adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(BendConnectionPolicy.class);
adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(BendOnSegmentDragHandler.class);

Futhermore I extend my Connection Part class by AbstractContentPart<Connection> and implement IBendableContentPart<Connection>

This seems not to be totaly wrong because it works for connections routed by StraightRouter.
Unfortunately this doesn´t work for OrthogonalRouter.

Am I doing something wrong or do I have to implement something else?

Thanks,
Thomas

[Updated on: Tue, 05 September 2017 14:28]

Report message to a moderator

Re: Bend Connections routed by OrthogonalRouter (GEF 5) [message #1772106 is a reply to message #1772104] Tue, 05 September 2017 14:47 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
IMHO it should not be possible to use BendOnSegmentDragHandler with StraightRouter. In the implementation, there is a guard, disallowing all IRouter implementations except OrthogonalRouter. Therefore, you should verify that it works for StraightRouter / does not work for OrthogonalRouter (that would be very strange).

If you want to bend a connection that is not routed via OrthogonalRouter, however, you should generate handles for the connection that can be used for manipulation via BendFirstAnchorageOnSegmentHandleDragHandler instead of BendOnSegmentDragHandler.

The BendOnSegmentDragHandler allows a manipulation of a segment in only one direction, i.e. horizontally or vertically. Therefore, it cannot be used to manipulate bendable-content-parts where not all segments are orthogonal. That's why it checks for OrthogonalRouter explicitly. We could instead think of another behaviour when manipulating differently routed bendable-content-parts.

Best regards,
Matthias
Re: Bend Connections routed by OrthogonalRouter (GEF 5) [message #1772204 is a reply to message #1772106] Wed, 06 September 2017 14:39 Go to previous messageGo to next message
Thomas Oberle is currently offline Thomas OberleFriend
Messages: 11
Registered: April 2017
Junior Member
Thanks for the quick answer.
I was wrong about BendOnSegmentDragHandler.
I didn´t know exactly what this handler is needed for and I used it in the wrong place.
But now it works. I took the org.eclipse.gef.mvc.examples.logo project and stripped it piece by piece until I found what I was looking for.
I needed to implement the following code to get it working:

bindRectangleSegmentHandlePartAdapters( AdapterMaps.getAdapterMapBinder(binder(), RectangleSegmentHandlePart.class));

protected void bindRectangleSegmentHandlePartAdapters(MapBinder<AdapterKey<?>, Object> adapterMapBinder) {
adapterMapBinder.addBinding(AdapterKey.defaultRole()).to(BendFirstAnchorageOnSegmentHandleDragHandler.class);
}

Thanks for your help!
Thomas
Re: Bend Connections routed by OrthogonalRouter (GEF 5) [message #1772293 is a reply to message #1772204] Thu, 07 September 2017 16:24 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Glad you found the solution!

Just as a clarification:
1) User clicks a connection
=> FocusAndSelectOnClickHandler selects the corresponding content part (SelectionModel is changed)
2) SelectionBehavior is notified about the selection change
=> SelectionFeedbackPartFactory generates SelectionFeedbackPart(s) for the new selection, highlighting it.
=> SelectionHandlePartFactory generates SelectionHandlePart(s) for the new selection. For an orthogonally routed connection, RectangleSegmentHandlePart(s) are created for the individual segments of the connection.
3) User drags a rectangular handle that was generated for the connection
=> BendFirstAnchorageOnHandleDragHandler manipulates the connection using BendConnectionPolicy.

Since the user interacts with a handle, an BendFirstAnchorageOnHandleDragHandler needs to be registered for that handle part, instead of being registered for the connection's content part. That's why the handler class has "BendFirstAnchorage" and "OnHandleDrag" in its name, to indicate that this handler should be registered for a handle part.

Best regards,
Matthias
Previous Topic:Moving Diagram with Mouse
Next Topic:Save selected node as png file (GEF5)
Goto Forum:
  


Current Time: Sun Oct 13 08:22:17 GMT 2024

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

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

Back to the top