Search in sources :

Example 1 with IManualValueChangeListener

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

the class SpinnerEditpart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    SpinnerFigure spinner = new SpinnerFigure();
    TextFigure labelFigure = spinner.getLabelFigure();
    labelFigure.setFont(getWidgetModel().getFont().getSWTFont());
    labelFigure.setFontPixels(getWidgetModel().getFont().isSizeInPixels());
    labelFigure.setOpaque(!getWidgetModel().isTransparent());
    labelFigure.setHorizontalAlignment(getWidgetModel().getHorizontalAlignment());
    labelFigure.setVerticalAlignment(getWidgetModel().getVerticalAlignment());
    spinner.setMax(getWidgetModel().getMaximum());
    spinner.setMin(getWidgetModel().getMinimum());
    spinner.setStepIncrement(getWidgetModel().getStepIncrement());
    spinner.setPageIncrement(getWidgetModel().getPageIncrement());
    spinner.setFormatType(getWidgetModel().getFormat());
    spinner.setPrecision((Integer) getPropertyValue(SpinnerModel.PROP_PRECISION));
    spinner.setArrowButtonsOnLeft(getWidgetModel().isButtonsOnLeft());
    spinner.setArrowButtonsHorizontal(getWidgetModel().isHorizontalButtonsLayout());
    spinner.showText(getWidgetModel().showText());
    if (getExecutionMode() == ExecutionMode.RUN_MODE) {
        spinner.addManualValueChangeListener(new IManualValueChangeListener() {

            @Override
            public void manualValueChanged(double newValue) {
                setPVValue(SpinnerModel.PROP_PVNAME, newValue);
                getWidgetModel().setText(((SpinnerFigure) getFigure()).getLabelFigure().getText(), false);
            }
        });
    }
    return spinner;
}
Also used : IManualValueChangeListener(org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener) SpinnerFigure(org.csstudio.swt.widgets.figures.SpinnerFigure) ITextFigure(org.csstudio.swt.widgets.figures.ITextFigure) TextFigure(org.csstudio.swt.widgets.figures.TextFigure)

Example 2 with IManualValueChangeListener

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

the class AbstractBoolControlEditPart method initializeCommonFigureProperties.

/**
 * Sets those properties on the figure that are defined in the
 * {@link AbstractBoolFigure} base class. This method is provided for the
 * convenience of subclasses, which can call this method in their
 * implementation of {@link AbstractBaseEditPart#doCreateFigure()}.
 *
 * @param figure
 *            the figure.
 * @param model
 *            the model.
 */
protected void initializeCommonFigureProperties(final AbstractBoolControlFigure figure, final AbstractBoolControlModel model) {
    super.initializeCommonFigureProperties(figure, model);
    figure.setToggle(model.isToggleButton());
    figure.setShowConfirmDialog(model.getShowConfirmDialog());
    figure.setConfirmTip(model.getConfirmTip());
    figure.setPassword(model.getPassword());
    figure.setRunMode(getExecutionMode().equals(ExecutionMode.RUN_MODE));
    figure.addManualValueChangeListener(new IManualValueChangeListener() {

        @Override
        public void manualValueChanged(final double newValue) {
            if (getExecutionMode() == ExecutionMode.RUN_MODE) {
                if (getWidgetModel().getDataType() == 0)
                    setPVValue(AbstractBoolControlModel.PROP_PVNAME, newValue);
                else
                    setPVValue(AbstractBoolWidgetModel.PROP_PVNAME, newValue <= 0.01 ? getWidgetModel().getOffState() : getWidgetModel().getOnState());
            }
        }
    });
    delegate.setUpdateSuppressTime(-1);
    markAsControlPV(AbstractBoolControlModel.PROP_PVNAME, AbstractPVWidgetModel.PROP_PVVALUE);
}
Also used : IManualValueChangeListener(org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener)

Example 3 with IManualValueChangeListener

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

the class CheckBoxEditPart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    CheckBoxFigure figure = new CheckBoxFigure(getExecutionMode().equals(ExecutionMode.RUN_MODE));
    figure.setBit(getWidgetModel().getBit());
    figure.setText(getWidgetModel().getLabel());
    figure.setSelectedColor(getWidgetModel().getSelectedColor().getSWTColor());
    figure.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 figure;
}
Also used : IManualValueChangeListener(org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener) CheckBoxFigure(org.csstudio.swt.widgets.figures.CheckBoxFigure)

Example 4 with IManualValueChangeListener

use of org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener 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)

Example 5 with IManualValueChangeListener

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

the class ArrayEditPart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    ArrayFigure figure = new ArrayFigure();
    ArrayModel model = getWidgetModel();
    figure.setArrayLength(model.getArrayLength());
    figure.setHorizontal(model.isHorizontal());
    figure.setSpinnerWidth(model.getSpinnerWidth());
    figure.setShowSpinner(model.isShowSpinner());
    figure.setShowScrollbar(model.isShowScrollbar());
    figure.setIndex(0);
    figure.addIndexChangeListener(new IManualValueChangeListener() {

        @Override
        public void manualValueChanged(double newValue) {
            setValue(getValue());
        }
    });
    updatePropSheet();
    return figure;
}
Also used : IManualValueChangeListener(org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener) ArrayFigure(org.csstudio.swt.widgets.figures.ArrayFigure) ArrayModel(org.csstudio.opibuilder.widgets.model.ArrayModel)

Aggregations

IManualValueChangeListener (org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener)10 ImageBoolButtonFigure (org.csstudio.opibuilder.widgets.figures.ImageBoolButtonFigure)1 ArrayModel (org.csstudio.opibuilder.widgets.model.ArrayModel)1 ImageBoolButtonModel (org.csstudio.opibuilder.widgets.model.ImageBoolButtonModel)1 KnobModel (org.csstudio.opibuilder.widgets.model.KnobModel)1 ScaledSliderModel (org.csstudio.opibuilder.widgets.model.ScaledSliderModel)1 ScrollBarModel (org.csstudio.opibuilder.widgets.model.ScrollBarModel)1 ArrayFigure (org.csstudio.swt.widgets.figures.ArrayFigure)1 CheckBoxFigure (org.csstudio.swt.widgets.figures.CheckBoxFigure)1 ITextFigure (org.csstudio.swt.widgets.figures.ITextFigure)1 KnobFigure (org.csstudio.swt.widgets.figures.KnobFigure)1 ScaledSliderFigure (org.csstudio.swt.widgets.figures.ScaledSliderFigure)1 ScrollbarFigure (org.csstudio.swt.widgets.figures.ScrollbarFigure)1 SpinnerFigure (org.csstudio.swt.widgets.figures.SpinnerFigure)1 TextFigure (org.csstudio.swt.widgets.figures.TextFigure)1 SymbolImageProperties (org.csstudio.swt.widgets.symbol.SymbolImageProperties)1 IImageListener (org.csstudio.swt.widgets.symbol.util.IImageListener)1 IFigure (org.eclipse.draw2d.IFigure)1 Color (org.eclipse.swt.graphics.Color)1