Commit 9c2292b7 authored by Nico Mack's avatar Nico Mack

Add inputChanged method to update on variable value changes

parent a998bfe2
......@@ -13,6 +13,8 @@
*/
package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.cps.InputEvent;
import lu.list.itis.dkd.tui.cps.variable.Variable;
import lu.list.itis.dkd.tui.feature.touch.TouchEvent;
import lu.list.itis.dkd.tui.feature.touch.TouchManager;
import lu.list.itis.dkd.tui.utility.AngleUtils;
......@@ -491,14 +493,14 @@ public class CoxcombRangeSlice extends ValueRangeCorona {
if (borderStroke != null)
localCanvas.setStroke(borderStroke);
if (face != null) {
if (faceColour != null) {
localCanvas.setPaint(faceColour.getColor());
localCanvas.fill(face);
}
if (bezelColour != null) {
localCanvas.setPaint(bezelColour.getColor());
localCanvas.setPaint(bezelColour.getColor());
localCanvas.draw(face);
}
}
......@@ -511,7 +513,7 @@ public class CoxcombRangeSlice extends ValueRangeCorona {
if (strokeColour != null) {
localCanvas.setPaint(strokeColour.getColor());
localCanvas.draw(slice);
}
}
}
if (this.opacity < 1.0f)
......@@ -628,6 +630,22 @@ public class CoxcombRangeSlice extends ValueRangeCorona {
}
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public void inputChanged(InputEvent input) {
if (input.getSource() != null) {
Variable<?> source = input.getSource();
if (source.getName().equals(this.lowerBoundVariable.getName())) {
this.setLowerBound(this.lowerBoundVariable.getValue());
} else if (source.getName().equals(this.upperBoundVariable.getName())) {
this.setUpperBound(this.upperBoundVariable.getValue());
}
}
}
// ---------------------------------------------------------------------------
@Override
......
package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.content.InformationReceiver;
import lu.list.itis.dkd.tui.cps.InputChangeListener;
import lu.list.itis.dkd.tui.cps.InputEvent;
import lu.list.itis.dkd.tui.cps.system.VariableBased;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.cps.variable.Variable;
......@@ -28,7 +30,7 @@ import java.util.Map;
// * Class Definition and Members *
// ***************************************************************************
public class ValueRangeCorona extends SelectableCorona implements InformationReceiver<ValueRange<?>>, VariableBased {
public class ValueRangeCorona extends SelectableCorona implements InformationReceiver<ValueRange<?>>, VariableBased, InputChangeListener {
protected NumericalVariable lowerBoundVariable;
protected NumericalVariable upperBoundVariable;
protected double minimumRange;
......@@ -140,6 +142,14 @@ public class ValueRangeCorona extends SelectableCorona implements InformationRec
}
}
if (this.lowerBoundVariable != null) {
this.lowerBoundVariable.addListener(this);
}
if (this.upperBoundVariable != null) {
this.upperBoundVariable.addListener(this);
}
return connected;
}
......@@ -154,6 +164,15 @@ public class ValueRangeCorona extends SelectableCorona implements InformationRec
return declared;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
// ---------------------------------------------------------------------------
@Override
public void inputChanged(InputEvent input) {
// TODO Does nothing yet.
}
// ---------------------------------------------------------------------------
@Override
// ---------------------------------------------------------------------------
......@@ -162,6 +181,7 @@ public class ValueRangeCorona extends SelectableCorona implements InformationRec
return new ValueRangeCorona(this);
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * End of Class *
......
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