use of org.csstudio.opibuilder.widgets.model.ThumbWheelModel in project yamcs-studio by yamcs.
the class ThumbWheelEditPart method registerLoadLimitsListener.
/**
*/
private void registerLoadLimitsListener() {
if (getExecutionMode() == ExecutionMode.RUN_MODE) {
final ThumbWheelModel model = getWidgetModel();
if (model.isLimitsFromPV()) {
IPV pv = getPV(AbstractPVWidgetModel.PROP_PVNAME);
if (pv != null) {
if (pvLoadLimitsListener == null)
pvLoadLimitsListener = new IPVListener.Stub() {
@Override
public void valueChanged(IPV pv) {
VType value = pv.getValue();
Display displayInfo = VTypeHelper.getDisplayInfo(value);
if (value != null && displayInfo != null) {
Display new_meta = displayInfo;
if (meta == null || !meta.equals(new_meta)) {
meta = new_meta;
model.setPropertyValue(ThumbWheelModel.PROP_MAX, meta.getUpperDisplayLimit());
model.setPropertyValue(ThumbWheelModel.PROP_MIN, meta.getLowerDisplayLimit());
}
}
}
};
pv.addListener(pvLoadLimitsListener);
}
}
}
}
Aggregations