Search in sources :

Example 1 with BasicDataType

use of org.csstudio.simplepv.BasicDataType in project yamcs-studio by yamcs.

the class ArrayEditPart method registerLoadPVDataTypeListener.

private void registerLoadPVDataTypeListener() {
    if (getExecutionMode() == ExecutionMode.RUN_MODE) {
        final ArrayModel model = getWidgetModel();
        IPV pv = getPV();
        if (pv != null) {
            if (pvDataTypeListener == null)
                pvDataTypeListener = new IPVListener.Stub() {

                    @Override
                    public void valueChanged(IPV pv) {
                        VType value = pv.getValue();
                        if (value != null) {
                            model.setArrayLength(VTypeHelper.getSize(value));
                            BasicDataType dataType = VTypeHelper.getBasicDataType(value);
                            model.setPropertyValue(ArrayModel.PROP_DATA_TYPE, mapBasicDataTypeToArrayType(dataType));
                        }
                    }
                };
            pv.addListener(pvDataTypeListener);
        }
    }
}
Also used : VType(org.diirt.vtype.VType) BasicDataType(org.csstudio.simplepv.BasicDataType) ArrayModel(org.csstudio.opibuilder.widgets.model.ArrayModel) IPV(org.csstudio.simplepv.IPV)

Aggregations

ArrayModel (org.csstudio.opibuilder.widgets.model.ArrayModel)1 BasicDataType (org.csstudio.simplepv.BasicDataType)1 IPV (org.csstudio.simplepv.IPV)1 VType (org.diirt.vtype.VType)1