Search in sources :

Example 1 with ThumbWheelModel

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);
            }
        }
    }
}
Also used : ThumbWheelModel(org.csstudio.opibuilder.widgets.model.ThumbWheelModel) VType(org.diirt.vtype.VType) IPV(org.csstudio.simplepv.IPV) Display(org.diirt.vtype.Display)

Aggregations

ThumbWheelModel (org.csstudio.opibuilder.widgets.model.ThumbWheelModel)1 IPV (org.csstudio.simplepv.IPV)1 Display (org.diirt.vtype.Display)1 VType (org.diirt.vtype.VType)1