public class ArrowLengthStyle extends ThrottledStyleBase<Double> {
private static final Double PENDING = Double.NaN;
- private static final Double ONE = 1.0;
@Override
public Double calculateThrottledStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource groupItem) throws DatabaseException {
// Prevent PendingVariableExceptions from coming through
boolean wasSynchronous = graph.setSynchronous(true);
try {
- Double length = ONE;
if (ds.arrowLengthProperty.isPresent()) {
- length = Simantics.applySCLRead(graph, ds.arrowLengthProperty.get(), groupItem);
- // System.out.println("read thickness: " + thickness + " : " + ds.arrowLengthProperty);
- if (length == null) {
- length = ONE;
- } else {
- length = length * ds.arrowLengthGain + ds.arrowLengthBias;
- }
+ Double length = Simantics.applySCLRead(graph, ds.arrowLengthProperty.get(), groupItem);
+ return length != null ? length * ds.arrowLengthGain + ds.arrowLengthBias : null;
+ }
+ else {
+ return null;
}
-
- return length;
}
finally {
graph.setSynchronous(wasSynchronous);