use of org.csstudio.swt.widgets.figures.OPIRectangleFigure in project yamcs-studio by yamcs.
the class RectangleEditpart method doCreateFigure.
@Override
protected IFigure doCreateFigure() {
OPIRectangleFigure figure = new OPIRectangleFigure(getExecutionMode() == ExecutionMode.RUN_MODE);
RectangleModel model = getWidgetModel();
figure.setFill(model.getFillLevel());
figure.setHorizontalFill(model.isHorizontalFill());
figure.setTransparent(model.isTransparent());
figure.setSelectable(determineSelectable());
figure.setLineColor(model.getLineColor());
figure.setGradient(model.isGradient());
figure.setBackGradientStartColor(model.getBackgroundGradientStartColor());
figure.setForeGradientStartColor(model.getForegroundGradientStartColor());
return figure;
}
use of org.csstudio.swt.widgets.figures.OPIRectangleFigure in project yamcs-studio by yamcs.
the class RectangleEditpart 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) {
OPIRectangleFigure figure = (OPIRectangleFigure) refreshableFigure;
figure.setFill((Double) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_FILL_LEVEL, fillHandler);
// fill orientaion
IWidgetPropertyChangeHandler fillOrientHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
OPIRectangleFigure figure = (OPIRectangleFigure) refreshableFigure;
figure.setHorizontalFill((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_HORIZONTAL_FILL, fillOrientHandler);
// transparent
IWidgetPropertyChangeHandler transparentHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
OPIRectangleFigure figure = (OPIRectangleFigure) refreshableFigure;
figure.setTransparent((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(RectangleModel.PROP_TRANSPARENT, transparentHandler);
// line color
IWidgetPropertyChangeHandler lineColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
((OPIRectangleFigure) 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) {
((OPIRectangleFigure) figure).setGradient((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(RectangleModel.PROP_GRADIENT, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((OPIRectangleFigure) figure).setBackGradientStartColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(RectangleModel.PROP_BACKGROUND_GRADIENT_START_COLOR, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((OPIRectangleFigure) figure).setForeGradientStartColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(RoundedRectangleModel.PROP_FOREGROUND_GRADIENT_START_COLOR, handler);
}
Aggregations