Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to make dashed and customized Connection
How to make dashed and customized Connection [message #1803385] Wed, 27 February 2019 18:06 Go to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
I'm trying to easily convert this:

public class ConnectionNodesVisual extends Connection {
	
	public static class ArrowHead extends Polygon {
		public ArrowHead() {
			super(0, 0, 10, 3, 10, -3);
		}
	}
	
	public ConnectionNodesVisual() {
		ArrowHead endDecoration = new ArrowHead();
		endDecoration.setFill(Color.BLACK);
		setEndDecoration(endDecoration);
	}

}



into a dashed connection with a different color and width. However, I can't seem to be able to find those editable options for the Connection...

How can I easily achieve this?

[Updated on: Wed, 27 February 2019 18:07]

Report message to a moderator

Re: How to make dashed and customized Connection [message #1803387 is a reply to message #1803385] Wed, 27 February 2019 18:34 Go to previous messageGo to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
I eventually found out the solution:

		GeometryNode<IGeometry> geometry =  (GeometryNode<IGeometry>) getCurve();

		geometry.getStrokeDashArray().addAll(2d,21d);
		geometry.setStrokeWidth(5);
		geometry.setStroke(Color.GREY);


But I still don't understand the geometry.getStrokeDashArray().addAll(2d,21d);. What is the meaning of 2.0 and 21.0? Why doesn't it work if I addAll(5d,5d) ?
Re: How to make dashed and customized Connection [message #1803388 is a reply to message #1803385] Wed, 27 February 2019 18:35 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Joao,

for styling purposes, you can use all properties provided by JavaFX. In this case, you need to configure stroke-dash-array, stroke-width, and stroke for the curve rendered by Connection. Note that this is also possible via CSS.

Edit: The JavaFX documentation is pretty good [1].

[1] https://docs.oracle.com/javase/8/javafx/api/javafx/scene/shape/Shape.html#getStrokeDashArray--

Best regards,
Matthias

[Updated on: Wed, 27 February 2019 18:37]

Report message to a moderator

Previous Topic:Bug In GEF MVC Tutorial
Next Topic:GEF5 Add multiple parts to Group
Goto Forum:
  


Current Time: Tue Oct 08 09:28:00 GMT 2024

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

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

Back to the top