Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to apply css for gef geometry
How to apply css for gef geometry [message #1753534] Tue, 07 February 2017 15:03 Go to next message
Shenwei Zheng is currently offline Shenwei ZhengFriend
Messages: 22
Registered: December 2016
Junior Member
Hi,

I am trying to apply styling from a css file for GeometryNode. For example, I would like to draw a red line (org.eclipse.gef.geometry.planar.Line).
Point start = new Point(5, 5);
Point end = new Point(10, 10);
Line line = new Line(start, end);
GeometryNode<Line> lineNode = new GeometryNode<Line>(line);
lineNode.setId("my-line");

With inline code it works.
lineNode.setStroke(Color.RED);

But I want to define styling in css file like this. It doesn't work.
#my-line{
  -fx-stroke: red;
}

Does someone have a solution?
I appreciate any hints. Thanks

Bests
Shenwei
Re: How to apply css for gef geometry [message #1753551 is a reply to message #1753534] Tue, 07 February 2017 16:22 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Shenwei,

unlike CSS class and inline style, the CSS ID is not forwarded by GeometryNode to the JavaFX Path that is used for displaying the geometry, because the setter is declared final and the CSS ID should be unique, i.e. GeometryNode and the wrapped Path cannot have the same ID (styling will not work if the ID is not unique, although uniqueness is not enforced). Therefore, you need to select that Path manually within the stylesheet, as follows:
#my-line Path {
  -fx-stroke-width: 3px;
  -fx-stroke: red;
}


Best regards,
Matthias
Previous Topic:GEF4 version 0.2.0 problem with self loop
Next Topic:[GEF4] GridLayout / Spreadsheet
Goto Forum:
  


Current Time: Mon Sep 23 13:29:15 GMT 2024

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

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

Back to the top