Search in sources :

Example 1 with EllipseFigure

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

the class EllipseEditpart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    EllipseFigure figure = new EllipseFigure();
    EllipseModel model = getWidgetModel();
    figure.setFill(model.getFillLevel());
    figure.setHorizontalFill(model.isHorizontalFill());
    figure.setTransparent(model.isTransparent());
    figure.setLineColor(model.getLineColor());
    figure.setGradient(model.isGradient());
    figure.setBackGradientStartColor(model.getBackgroundGradientStartColor());
    figure.setForeGradientStartColor(model.getForegroundGradientStartColor());
    return figure;
}
Also used : EllipseFigure(org.csstudio.swt.widgets.figures.EllipseFigure) EllipseModel(org.csstudio.opibuilder.widgets.model.EllipseModel)

Example 2 with EllipseFigure

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

the class EllipseEditpart method registerPropertyChangeHandlers.

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

        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            EllipseFigure ellipseFigure = (EllipseFigure) refreshableFigure;
            ellipseFigure.setFill((Double) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractShapeModel.PROP_FILL_LEVEL, fillHandler);
    // fill orientaion
    IWidgetPropertyChangeHandler fillOrientHandler = new IWidgetPropertyChangeHandler() {

        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            EllipseFigure ellipseFigure = (EllipseFigure) refreshableFigure;
            ellipseFigure.setHorizontalFill((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractShapeModel.PROP_HORIZONTAL_FILL, fillOrientHandler);
    // transparent
    IWidgetPropertyChangeHandler transparentHandler = new IWidgetPropertyChangeHandler() {

        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            EllipseFigure ellipseFigure = (EllipseFigure) refreshableFigure;
            ellipseFigure.setTransparent((Boolean) newValue);
            return true;
        }
    };
    setPropertyChangeHandler(AbstractShapeModel.PROP_TRANSPARENT, transparentHandler);
    // line color
    IWidgetPropertyChangeHandler lineColorHandler = new IWidgetPropertyChangeHandler() {

        public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
            ((EllipseFigure) refreshableFigure).setLineColor(((OPIColor) newValue).getSWTColor());
            return true;
        }
    };
    setPropertyChangeHandler(AbstractShapeModel.PROP_LINE_COLOR, lineColorHandler);
    IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((EllipseFigure) figure).setGradient((Boolean) newValue);
            return false;
        }
    };
    setPropertyChangeHandler(EllipseModel.PROP_GRADIENT, handler);
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((EllipseFigure) figure).setBackGradientStartColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(EllipseModel.PROP_BACKGROUND_GRADIENT_START_COLOR, handler);
    handler = new IWidgetPropertyChangeHandler() {

        @Override
        public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
            ((EllipseFigure) figure).setForeGradientStartColor(((OPIColor) newValue).getSWTColor());
            return false;
        }
    };
    setPropertyChangeHandler(EllipseModel.PROP_FOREGROUND_GRADIENT_START_COLOR, handler);
}
Also used : IWidgetPropertyChangeHandler(org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler) EllipseFigure(org.csstudio.swt.widgets.figures.EllipseFigure) OPIColor(org.csstudio.opibuilder.util.OPIColor) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

EllipseFigure (org.csstudio.swt.widgets.figures.EllipseFigure)2 IWidgetPropertyChangeHandler (org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler)1 OPIColor (org.csstudio.opibuilder.util.OPIColor)1 EllipseModel (org.csstudio.opibuilder.widgets.model.EllipseModel)1 IFigure (org.eclipse.draw2d.IFigure)1