use of org.csstudio.swt.widgets.figures.GaugeFigure in project yamcs-studio by yamcs.
the class GaugeEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
final GaugeModel model = getWidgetModel();
GaugeFigure gauge = new GaugeFigure();
initializeCommonFigureProperties(gauge, model);
gauge.setNeedleColor(CustomMediaFactory.getInstance().getColor((model.getNeedleColor())));
gauge.setEffect3D(model.isEffect3D());
gauge.setGradient(model.isRampGradient());
return gauge;
}
use of org.csstudio.swt.widgets.figures.GaugeFigure in project yamcs-studio by yamcs.
the class GaugeEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
setPropertyChangeHandler(PROP_NEEDLE_COLOR, (oldValue, newValue, refreshableFigure) -> {
var gauge = (GaugeFigure) refreshableFigure;
gauge.setNeedleColor(((OPIColor) newValue).getSWTColor());
return false;
});
setPropertyChangeHandler(PROP_EFFECT3D, (oldValue, newValue, refreshableFigure) -> {
var gauge = (GaugeFigure) refreshableFigure;
gauge.setEffect3D((Boolean) newValue);
return false;
});
setPropertyChangeHandler(PROP_RAMP_GRADIENT, (oldValue, newValue, refreshableFigure) -> {
var gauge = (GaugeFigure) refreshableFigure;
gauge.setGradient((Boolean) newValue);
return false;
});
IWidgetPropertyChangeHandler sizeHandler = (oldValue, newValue, figure) -> {
if (((Integer) newValue) < GaugeModel.MINIMUM_SIZE) {
newValue = GaugeModel.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