Commit 019cf0f2 authored by Nico Mack's avatar Nico Mack

Added rampingTime property

parent ee5754c1
......@@ -47,6 +47,7 @@ public class ShapeGraph extends ValueCorona {
protected int strokeWidth;
protected Shape scaledShape;
protected boolean blinkOnOutOfRange;
protected int rampingTime;
protected Timeline blinkingTimeline;
protected Timeline balisticTimeline;
......@@ -66,6 +67,7 @@ public class ShapeGraph extends ValueCorona {
this.lowerBound = builder.lowerBound;
this.upperBound = builder.upperBound;
this.blinkOnOutOfRange = builder.blinkOnOutOfRange;
this.rampingTime = builder.rampingTime;
this.fillColour = builder.fillColour;
this.strokeColour = builder.strokeColour;
this.strokeWidth = builder.strokeWidth;
......@@ -92,6 +94,8 @@ public class ShapeGraph extends ValueCorona {
this.lowerBound = original.lowerBound;
this.upperBound = original.upperBound;
this.blinkOnOutOfRange = original.blinkOnOutOfRange;
this.rampingTime = original.rampingTime;
this.fillColour = original.fillColour;
this.strokeColour = original.strokeColour;
this.strokeWidth = original.strokeWidth;
......@@ -213,13 +217,17 @@ public class ShapeGraph extends ValueCorona {
if (variable != null) {
double value = this.variable.getValue();
if ((balisticTimeline != null) && (!balisticTimeline.isDone()))
balisticTimeline.cancel();
if (rampingTime > 0) {
if ((balisticTimeline != null) && (!balisticTimeline.isDone()))
balisticTimeline.cancel();
balisticTimeline = new Timeline(this);
balisticTimeline.addPropertyToInterpolate("shownValue", shownValue, value); //$NON-NLS-1$
balisticTimeline.setDuration(500);
balisticTimeline.play();
balisticTimeline = new Timeline(this);
balisticTimeline.addPropertyToInterpolate("shownValue", shownValue, value); //$NON-NLS-1$
balisticTimeline.setDuration(rampingTime);
balisticTimeline.play();
} else {
this.setShownValue(value);
}
}
}
......
......@@ -40,6 +40,7 @@ public class ShapeGraphBuilder extends ValueCoronaBuilder<ShapeGraphBuilder> {
public int strokeWidth;
public Shape graphShape;
public boolean blinkOnOutOfRange;
public int rampingTime;
// ***************************************************************************
// * Constants *
......@@ -90,6 +91,7 @@ public class ShapeGraphBuilder extends ValueCoronaBuilder<ShapeGraphBuilder> {
/** Optional fields */
blinkOnOutOfRange = BootstrappingUtils.getContentAsBoolean(rootElement, CpsNamespace.BLINK_ON_OUT_OF_RANGE_NODE, BootstrappingUtils.OPTIONAL, Boolean.FALSE, context);
rampingTime = BootstrappingUtils.getContentAsInteger(rootElement, Externalization.RAMPING_TIME_NODE, BootstrappingUtils.OPTIONAL, 500, context);
strokeWidth = BootstrappingUtils.getContentAsInteger(rootElement, Externalization.STROKE_WIDTH_NODE, BootstrappingUtils.OPTIONAL, 1, context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment