]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.network/src/org/simantics/district/network/profile/EdgeThicknessStyle.java
Support showing ticks in DynamicVisualisations
[simantics/district.git] / org.simantics.district.network / src / org / simantics / district / network / profile / EdgeThicknessStyle.java
index 06dcdf3f05e8fc3d0ff6327e75ff7486ee3b893a..b305c39148bd284bfea3b96ee1cbf6221226e198 100644 (file)
@@ -19,17 +19,25 @@ public class EdgeThicknessStyle extends ThrottledStyleBase<Double> {
        @Override
        public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
                DiagramSettings ds = graph.syncRequest(new DiagramSettingsRequest(runtimeDiagram), TransientCacheAsyncListener.instance());
-               Double thickness = ONE;
-               if (ds.edgeThicknessProperty.isPresent()) {
-                       thickness = Simantics.applySCLRead(graph, ds.edgeThicknessProperty.get(), groupItem);
-//                     System.out.println("read thickness: " + thickness + " : " + ds.edgeThicknessProperty);
-                       if (thickness == null) {
-                               thickness = ONE;
-                       } else {
-                               thickness = thickness * ds.edgeThicknessGain + ds.edgeThicknessBias;
+               // Prevent PendingVariableExceptions from coming through
+               boolean wasSynchronous = graph.setSynchronous(true);
+               try {
+                       Double thickness = ONE;
+                       if (ds.edgeThicknessProperty.isPresent()) {
+                               thickness = Simantics.applySCLRead(graph, ds.edgeThicknessProperty.get(), groupItem);
+       //                      System.out.println("read thickness: " + thickness + " : " + ds.edgeThicknessProperty);
+                               if (thickness == null) {
+                                       thickness = ONE;
+                               } else {
+                                       thickness = thickness * ds.edgeThicknessGain + ds.edgeThicknessBias;
+                               }
                        }
+                       
+                       return thickness;
+               }
+               finally {
+                       graph.setSynchronous(wasSynchronous);
                }
-               return thickness;
        }
 
        @Override