diff --git a/CPS/src/lu/list/itis/dkd/tui/widget/ValueWidget.java b/CPS/src/lu/list/itis/dkd/tui/widget/ValueWidget.java index 6468bb163238edc172cac6d6bbe0739132570617..4f6238b420dd25b35db71fca4fd2e3309e9a6265 100644 --- a/CPS/src/lu/list/itis/dkd/tui/widget/ValueWidget.java +++ b/CPS/src/lu/list/itis/dkd/tui/widget/ValueWidget.java @@ -80,8 +80,8 @@ public class ValueWidget extends TetherableWidget implements InformationProvider protected boolean constrainted; /** - * Field holding the current angular position of the constrainted (lowerStopAngle | - * upperStopAngle) angle. + * Field holding the current angular position of the constrainted (lowerStopAngle | upperStopAngle) + * angle. */ protected double dialAngle; private double stepAngle; @@ -211,6 +211,28 @@ public class ValueWidget extends TetherableWidget implements InformationProvider LOGGER.trace("{} = {}", variable.getName(), value); //$NON-NLS-1$ } } + // --------------------------------------------------------------------------- + + @SuppressWarnings("unchecked") + private void updateInformationReceivers() { + for (Corona corona : this.getAllCoronas()) { + if (corona instanceof InformationReceiver) { + Type[] types = corona.getClass().getGenericInterfaces(); + + for (Type type : types) { + if (type instanceof ParameterizedType) { + String typeName = ((ParameterizedType) type).getActualTypeArguments()[0].getTypeName(); + if (typeName.equals(String.class.getTypeName())) { + String information = (variable.getValue() != null) ? variable.getValue().toString() : null; + ((InformationReceiver) corona).setInformation(information); + } else if (typeName.equals(Double.class.getTypeName())) { + ((InformationReceiver) corona).setInformation(variable.getValue()); + } + } + } + } + } + } // --------------------------------------------------------------------------- // *************************************************************************** @@ -349,31 +371,9 @@ public class ValueWidget extends TetherableWidget implements InformationProvider // --------------------------------------------------------------------------- - @SuppressWarnings("unchecked") @Override public void paint(Graphics2D canvas) { - for (Corona corona : coronas.values()) { - if (corona instanceof InformationReceiver) { - Type[] types = corona.getClass().getGenericInterfaces(); - - for (Type type : types) { - if (!(type instanceof ParameterizedType)) { - continue; - } - - String typeName = ((ParameterizedType) type).getActualTypeArguments()[0].getTypeName(); - if (typeName.equals(String.class.getTypeName())) { - String information = (variable.getValue() != null) ? variable.getValue().toString() : null; - ((InformationReceiver) corona).setInformation(information); - continue; - } - if (typeName.equals(Double.class.getTypeName())) { - ((InformationReceiver) corona).setInformation(variable.getValue()); - continue; - } - } - } - } + this.updateInformationReceivers(); super.paint(canvas); }