Set strokeWidth for new chart items already upon creation 25/3525/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 15 Nov 2019 07:22:14 +0000 (09:22 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 15 Nov 2019 07:22:14 +0000 (09:22 +0200)
gitlab #415

Change-Id: Ibc478abadc3c80006eee09b7daf568a9f43dd8b0

bundles/org.simantics.charts/src/org/simantics/charts/query/AddChartItem.java
bundles/org.simantics.charts/src/org/simantics/charts/query/ChartItemDescriptor.java
bundles/org.simantics.charts/src/org/simantics/charts/ui/AddVariableToChartAction.java

index 62ef8781f596da405e79081947cdb9f2e49e7f50..280f32f347fdbe3d8d31d7f39da16c880e252e37 100644 (file)
@@ -94,6 +94,8 @@ public class AddChartItem extends WriteResultRequest<Collection<Resource>> {
                 graph.claim(chartItem, CHART.Chart_Item_Renderer, getRenderer(graph, desc.renderer));
                 int index = desc.index!=null ? desc.index : nextIndex++;
                 graph.claimLiteral(chartItem, CHART.Chart_Item_Index, index);
+                if (desc.strokeWidth != null)
+                    graph.claimLiteral(chartItem, G2DResource.getInstance(graph).HasStrokeWidth, desc.strokeWidth, Bindings.FLOAT);
                 if (desc.color != null)
                     graph.claimLiteral(chartItem, G2DResource.getInstance(graph).HasColor, desc.color, Bindings.FLOAT_ARRAY);
 
index d4377f367ff8c6623cbda875330202be9f44e0e9..46b8202dfb58badf0551d6aca8cee34f6c3fef78 100644 (file)
@@ -42,6 +42,7 @@ public class ChartItemDescriptor {
 
     public DrawMode drawMode = DrawMode.getDefault();
 
+    public @Optional Float strokeWidth;
     public @Optional float[] color; 
 
 }
index 464a5beb53cc1c5823aea1f68b71f2fa3801da32..4d2a1317aedc07ca9d63faa5c43c05383d3e29d1 100644 (file)
@@ -178,6 +178,7 @@ public class AddVariableToChartAction implements Runnable {
                                cid.max = data.max;
                                cid.subscriptionItem = ns.subscriptionItem;
                                cid.color = data.color;
+                               cid.strokeWidth = data.strokeWidth;
                                AddChartItem ci = new AddChartItem(     chart, Collections.singletonList( cid ) );
                                Simantics.getSession().sync( ci );
                                }