Dear users, Please note that, from Monday, August 16, 2019, RSA keys shorter than 2048bit will no longer be accepted for security reasons. Please update your keys as needed before this date. If you need assistance with regard to this process, please contact sia@list.lu

Thank you for your understanding.

Commit 19a157f7 authored by Eric Tobias's avatar Eric Tobias

Corrected how values are communicated

parent 66f13a5b
......@@ -17,11 +17,12 @@ import org.eclipse.osgi.util.NLS;
/**
* @author Eric Tobias [eric.tobias@list.lu]
* @since [major].[minor]
* @version [major].[minor].[micro]
* @since 1.0
* @version 1.0.0
*/
@SuppressWarnings({"javadoc", "nls"})
public class Externalization extends NLS {
private static final String BUNDLE_NAME = "lu.list.itis.dkd.cps.utility.externalization"; //$NON-NLS-1$
private static final String BUNDLE_NAME = "lu.list.itis.dkd.cps.utility.externalization";
public static String UNIT_ATTRIBUTE;
static {
......
......@@ -28,6 +28,8 @@ import lu.list.itis.dkd.tui.widget.builder.ValueWidgetBuilder;
import lu.list.itis.dkd.tui.widget.corona.Corona;
import java.awt.Graphics2D;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/**
* A simple widget that holds an integer value and may modify the value base on a rotation.
......@@ -189,10 +191,29 @@ public final class ValueWidget extends BaseWidget implements InformationProvider
public void paint(Graphics2D canvas) {
for (Corona corona : coronas.values()) {
if (corona instanceof InformationReceiver<?>) {
((InformationReceiver<String>) corona).setInformation(variable.getInformation().toString());
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())) {
((InformationReceiver<String>) corona).setInformation(variable.getInformation());
continue;
}
if (typeName.equals(Double.class.getTypeName())) {
((InformationReceiver<Double>) corona).setInformation(variable.getValue());
continue;
}
}
}
}
super.paint(canvas);
}
private void updateFromRotation(double angle) {
......
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