Search in sources :

Example 1 with LongArrayWrapper

use of org.csstudio.swt.widgets.datadefinition.LongArrayWrapper in project yamcs-studio by yamcs.

the class ArrayEditPart method setValue.

@Override
public void setValue(Object value) {
    if (value == null) {
        return;
    }
    if (value.getClass().isArray()) {
        var index = getArrayFigure().getIndex();
        valueArray = value;
        if (value instanceof String[]) {
            var a = (String[]) value;
            setChildrenValue(index, asList(a), ArrayDataType.STRING_ARRAY);
        } else if (value instanceof Object[]) {
            var a = (Object[]) value;
            setChildrenValue(index, asList(a), ArrayDataType.OBJECT_ARRAY);
        } else if (value instanceof double[]) {
            setChildrenValue(index, new DoubleArrayWrapper((double[]) value), ArrayDataType.DOUBLE_ARRAY);
        } else if (value instanceof long[]) {
            setChildrenValue(index, new LongArrayWrapper((long[]) value), ArrayDataType.LONG_ARRAY);
        } else if (value instanceof byte[]) {
            setChildrenValue(index, new ByteArrayWrapper((byte[]) value), ArrayDataType.BYTE_ARRAY);
        } else if (value instanceof float[]) {
            setChildrenValue(index, new FloatArrayWrapper((float[]) value), ArrayDataType.FLOAT_ARRAY);
        } else if (value instanceof short[]) {
            setChildrenValue(index, new ShortArrayWrapper((short[]) value), ArrayDataType.SHORT_ARRAY);
        } else if (value instanceof int[]) {
            setChildrenValue(index, new IntArrayWrapper((int[]) value), ArrayDataType.INT_ARRAY);
        }
        return;
    }
    super.setValue(value);
}
Also used : DoubleArrayWrapper(org.csstudio.swt.widgets.datadefinition.DoubleArrayWrapper) ByteArrayWrapper(org.csstudio.swt.widgets.datadefinition.ByteArrayWrapper) ShortArrayWrapper(org.csstudio.swt.widgets.datadefinition.ShortArrayWrapper) FloatArrayWrapper(org.csstudio.swt.widgets.datadefinition.FloatArrayWrapper) IntArrayWrapper(org.csstudio.swt.widgets.datadefinition.IntArrayWrapper) LongArrayWrapper(org.csstudio.swt.widgets.datadefinition.LongArrayWrapper)

Aggregations

ByteArrayWrapper (org.csstudio.swt.widgets.datadefinition.ByteArrayWrapper)1 DoubleArrayWrapper (org.csstudio.swt.widgets.datadefinition.DoubleArrayWrapper)1 FloatArrayWrapper (org.csstudio.swt.widgets.datadefinition.FloatArrayWrapper)1 IntArrayWrapper (org.csstudio.swt.widgets.datadefinition.IntArrayWrapper)1 LongArrayWrapper (org.csstudio.swt.widgets.datadefinition.LongArrayWrapper)1 ShortArrayWrapper (org.csstudio.swt.widgets.datadefinition.ShortArrayWrapper)1