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;
}
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);
}
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;
}
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;
}
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;
}
Aggregations