GEF5 FX: Using Connection [message #1840411] |
Wed, 14 April 2021 18:12  |
Eclipse User |
|
|
|
Im just began using the framework GEF by following the Guide on Itemis with the title "Getting started with GEF" (cant post links new account).
In this guide a mindmap is created step by step. The Tutorial uses org.eclipse.gef.fx.nodes.Connection as the Connection visual between Nodes.
My Problem is, that i want to modify the Color of these Connections and add a Label to the Connection, that is set to the middle of the Connection. But looking at the Class, I cant find a way to do that. The Connection class does have functions setStartDecoration() and setEndDecoration(), but thats all i was able to find for modifying the appearance of a Connection.
Im still very limited in my skills and maybe im missing something. Help would be appreciated.
|
|
|
Re: GEF5 FX: Using Connection [message #1840431 is a reply to message #1840411] |
Thu, 15 April 2021 07:16   |
Eclipse User |
|
|
|
Hi,
The Connection contains a JavaFX Node for its rendering; this is the node you need to customize. For example:
Node curve = connection.getCurve();
if (curve instanceof GeometryNode) {
((GeometryNode<?>) curve).setStroke(lineColor);
}
Labels can be added as children of the Connection Part, and/or anchored to the connection
HTH,
Camille
|
|
|
Re: GEF5 FX: Using Connection [message #1840465 is a reply to message #1840431] |
Thu, 15 April 2021 19:35   |
Eclipse User |
|
|
|
Hey,
thanks for your reply! Im now able to set the color of connections.
Im still struggling with adding Text to a Connection though. I tried using AnchorKey and DynamicAnchor, but it seems like too many not fully understood things are involved and no attempt has worked out yet.
Quote: Labels can be added as children of the Connection Part, and/or anchored to the connection
If I understand this correctly:
I dont think the text needs its own ContentPart and be added as child to the ConnectionPart.
So anchoring it dynamically to the center of the connection should be enough.
A slightly detailed explanation on how to do such thing would be very helpful.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03420 seconds