Skip to main content



      Home
Home » Eclipse Projects » GEF » Recursive Connection
Recursive Connection [message #1807906] Wed, 12 June 2019 03:48 Go to next message
Eclipse UserFriend
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 03:49] by Moderator

Re: Recursive Connection [message #1808686 is a reply to message #1807906] Fri, 28 June 2019 10:20 Go to previous message
Eclipse UserFriend
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: Wed Apr 30 04:32:28 EDT 2025

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

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

Back to the top