use of org.csstudio.opibuilder.widgets.model.KnobModel.PROP_THUMB_COLOR in project yamcs-studio by yamcs.
the class KnobEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
setPropertyChangeHandler(PROP_KNOB_COLOR, (oldValue, newValue, refreshableFigure) -> {
var knob = (KnobFigure) refreshableFigure;
knob.setBulbColor(((OPIColor) newValue).getSWTColor());
return false;
});
setPropertyChangeHandler(PROP_THUMB_COLOR, (oldValue, newValue, refreshableFigure) -> {
var knob = (KnobFigure) refreshableFigure;
knob.setThumbColor(((OPIColor) newValue).getSWTColor());
return false;
});
setPropertyChangeHandler(PROP_EFFECT3D, (oldValue, newValue, refreshableFigure) -> {
var knob = (KnobFigure) refreshableFigure;
knob.setEffect3D((Boolean) newValue);
return false;
});
setPropertyChangeHandler(PROP_SHOW_VALUE_LABEL, (oldValue, newValue, refreshableFigure) -> {
var knob = (KnobFigure) refreshableFigure;
knob.setValueLabelVisibility((Boolean) newValue);
return false;
});
setPropertyChangeHandler(PROP_RAMP_GRADIENT, (oldValue, newValue, refreshableFigure) -> {
var knob = (KnobFigure) refreshableFigure;
knob.setGradient((Boolean) newValue);
return false;
});
setPropertyChangeHandler(PROP_INCREMENT, (oldValue, newValue, refreshableFigure) -> {
var knob = (KnobFigure) refreshableFigure;
knob.setIncrement((Double) newValue);
return false;
});
// force square size
IWidgetPropertyChangeHandler sizeHandler = (oldValue, newValue, figure) -> {
if (((Integer) newValue) < KnobModel.MINIMUM_SIZE) {
newValue = KnobModel.MINIMUM_SIZE;
}
getWidgetModel().setSize((Integer) newValue, (Integer) newValue);
return false;
};
PropertyChangeListener sizeListener = evt -> sizeHandler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure());
getWidgetModel().getProperty(PROP_WIDTH).addPropertyChangeListener(sizeListener);
getWidgetModel().getProperty(PROP_HEIGHT).addPropertyChangeListener(sizeListener);
}
Aggregations