Search in sources :

Example 1 with KnobModel

use of org.csstudio.opibuilder.widgets.model.KnobModel in project yamcs-studio by yamcs.

the class KnobEditPart method doCreateFigure.

/**
 * {@inheritDoc}
 */
@Override
protected IFigure doCreateFigure() {
    final KnobModel model = (KnobModel) getModel();
    KnobFigure knob = new KnobFigure();
    initializeCommonFigureProperties(knob, model);
    knob.setBulbColor(model.getKnobColor());
    knob.setEffect3D(model.isEffect3D());
    knob.setThumbColor(model.getThumbColor());
    knob.setValueLabelVisibility(model.isShowValueLabel());
    knob.setGradient(model.isRampGradient());
    knob.setIncrement(model.getIncrement());
    knob.addManualValueChangeListener(new IManualValueChangeListener() {

        @Override
        public void manualValueChanged(double newValue) {
            if (getExecutionMode() == ExecutionMode.RUN_MODE) {
                setPVValue(AbstractPVWidgetModel.PROP_PVNAME, newValue);
            }
        }
    });
    markAsControlPV(AbstractPVWidgetModel.PROP_PVNAME, AbstractPVWidgetModel.PROP_PVVALUE);
    return knob;
}
Also used : IManualValueChangeListener(org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener) KnobFigure(org.csstudio.swt.widgets.figures.KnobFigure) KnobModel(org.csstudio.opibuilder.widgets.model.KnobModel)

Aggregations

KnobModel (org.csstudio.opibuilder.widgets.model.KnobModel)1 IManualValueChangeListener (org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener)1 KnobFigure (org.csstudio.swt.widgets.figures.KnobFigure)1