Search in sources :

Example 1 with ArcFigure

use of org.csstudio.swt.widgets.figures.ArcFigure in project yamcs-studio by yamcs.

the class ArcEditpart method registerPropertyChangeHandlers.

@Override
protected void registerPropertyChangeHandlers() {
    super.registerPropertyChangeHandlers();
    // fill
    IWidgetPropertyChangeHandler fillHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            ArcFigure figure = (ArcFigure) refreshableFigure;
            figure.setFill((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(ArcModel.PROP_FILL, fillHandler);
    // start angle
    IWidgetPropertyChangeHandler startAngleHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            ArcFigure figure = (ArcFigure) refreshableFigure;
            figure.setStartAngle((Integer) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(ArcModel.PROP_START_ANGLE, startAngleHandler);
    // total angle
    IWidgetPropertyChangeHandler totalAngleHandler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            ArcFigure figure = (ArcFigure) refreshableFigure;
            figure.setTotalAngle((Integer) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(ArcModel.PROP_TOTAL_ANGLE, totalAngleHandler);
}
Also used : IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) ArcFigure(org.csstudio.swt.widgets.figures.ArcFigure) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with ArcFigure

use of org.csstudio.swt.widgets.figures.ArcFigure in project yamcs-studio by yamcs.

the class ArcEditpart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    ArcFigure figure = new ArcFigure();
    ArcModel model = getWidgetModel();
    figure.setFill(model.isFill());
    figure.setStartAngle(model.getStartAngle());
    figure.setTotalAngle(model.getTotalAngle());
    return figure;
}
Also used : ArcModel(org.csstudio.opibuilder.widgets.model.ArcModel) ArcFigure(org.csstudio.swt.widgets.figures.ArcFigure)

Aggregations

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