Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Recursive Connection
Recursive Connection [message #1807906] Wed, 12 June 2019 07:48 Go to next message
Servan Kilec is currently offline Servan KilecFriend
Messages: 7
Registered: October 2018
Junior Member
I want a recursive relationship with a node. I have created a connection (this connection uses the "OrthogonalRouter").

For example:
MindMapNode node = new MindMapNode();
MindMapConnection conn = new MindMapConnection();
conn.connect(node, node);


In the "MinMapConnection" class I rewrote the "connect" method so that it doesn't throw exceptions if the target and the source node are the same. However, no connection is displayed anyway.

Is there a way to create a recursive relationship? Do I have to write my own router? If so, what is the best way to do this?


My goal is a connection like in this picture:
index.php/fa/35742/0/

[Updated on: Wed, 12 June 2019 07:49]

Report message to a moderator

Re: Recursive Connection [message #1808686 is a reply to message #1807906] Fri, 28 June 2019 14:20 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Servan,

in order to implement reflexive relations, you may contribute an implementation for this special case within the corresponding part's doRefreshVisual() method by testing if source and target are identical and supplying the relation visual with control points manually routed around the source/target so that it is fully visible.

Hence, it could look similar to this pseudocode:
public class RelationPart extends AbstractContentPart<RelationVisual> {

  protected void doRefreshVisual(RelationVisual visual) {
    ...
    // update control points
    if (sourcePart == targetPart) {
      // reflexive relation
      relationVisual.setControlPoints(determineReflexiveControlPoints(sourcePart));
    } else {
      // normal control points
    }
  }

  protected List<Point> determineReflexiveControlPoints(NodePart target) {
    Bounds bounds = target.getVisual().getBoundsInParent();
    // TODO: return list of control points, e.g. Arrays.asLists(bounds.x + 5, bounds.y, ...);
  }
...
}


Best regards,
Matthias
Previous Topic:GEF 5: Allow only some Connections
Next Topic:GEF 5.1.0 is released!
Goto Forum:
  


Current Time: Fri Apr 26 04:51:49 GMT 2024

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

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

Back to the top