Commit d8af8a53 authored by Nico Mack's avatar Nico Mack

ValueCorona now directly registers itself as value change listener to

assigned variable
parent 019cf0f2
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 ValueCorona extends SelectableCorona implements InformationReceiver<Object>, VariableBased {
public class ValueCorona extends SelectableCorona implements InformationReceiver<Object>, VariableBased, InputChangeListener {
protected NumericalVariable variable;
// ---------------------------------------------------------------------------
......@@ -73,7 +75,8 @@ public class ValueCorona extends SelectableCorona implements InformationReceiver
// ---------------------------------------------------------------------------
@Override
public void paint(Graphics2D canvas) {}
public void paint(Graphics2D canvas) {
}
// ---------------------------------------------------------------------------
......@@ -111,6 +114,7 @@ public class ValueCorona extends SelectableCorona implements InformationReceiver
numerical = Variable.castTo(systemVariable, NumericalVariable.class);
if (numerical != null) {
this.variable = numerical;
this.variable.addListener(this);
this.setInformation(this.variable.getValue());
connected.add(this.variable);
}
......@@ -138,6 +142,14 @@ public class ValueCorona extends SelectableCorona implements InformationReceiver
return declared;
}
// ---------------------------------------------------------------------------
/** {@inheritDoc} */
@Override
public void inputChanged(InputEvent input) {
this.setInformation(input.getSource().getValue());
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * 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