Search in sources :

Example 1 with MeterFigure

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;
}
Also used : MeterFigure(org.csstudio.swt.widgets.figures.MeterFigure) MeterModel(org.csstudio.opibuilder.widgets.model.MeterModel)

Example 2 with MeterFigure

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);
}
Also used : MeterFigure(org.csstudio.swt.widgets.figures.MeterFigure) IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

MeterFigure (org.csstudio.swt.widgets.figures.MeterFigure)2 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)1 MeterModel (org.csstudio.opibuilder.widgets.model.MeterModel)1 IFigure (org.eclipse.draw2d.IFigure)1