use of org.csstudio.swt.widgets.figures.MeterFigure in project yamcs-studio by yamcs.
the class MeterEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
final MeterModel model = getWidgetModel();
MeterFigure xMeter = new MeterFigure();
initializeCommonFigureProperties(xMeter, model);
xMeter.setNeedleColor((model.getNeedleColor()));
xMeter.setGradient(model.isRampGradient());
xMeter.setValueLabelVisibility(model.isShowValueLabelVisible());
return xMeter;
}
use of org.csstudio.swt.widgets.figures.MeterFigure in project yamcs-studio by yamcs.
the class MeterEditPart method registerPropertyChangeHandlers.
/**
* {@inheritDoc}
*/
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
// needle Color
IWidgetPropertyChangeHandler needleColorColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
MeterFigure xMeter = (MeterFigure) refreshableFigure;
xMeter.setNeedleColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(MeterModel.PROP_NEEDLE_COLOR, needleColorColorHandler);
// Ramp gradient
IWidgetPropertyChangeHandler gradientHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
MeterFigure xMeter = (MeterFigure) refreshableFigure;
xMeter.setGradient((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(MeterModel.PROP_RAMP_GRADIENT, gradientHandler);
// Show Value Label
IWidgetPropertyChangeHandler valueLabelHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
MeterFigure xMeter = (MeterFigure) refreshableFigure;
xMeter.setValueLabelVisibility((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(MeterModel.PROP_SHOW_VALUE_LABEL, valueLabelHandler);
}
Aggregations