use of org.csstudio.swt.widgets.figures.PolygonFigure in project yamcs-studio by yamcs.
the class PolygonEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
PolygonFigure polygon = new PolygonFigure();
PolygonModel model = getWidgetModel();
polygon.setPoints(model.getPoints());
polygon.setFill(model.getFillLevel());
polygon.setHorizontalFill(model.isHorizontalFill());
polygon.setTransparent(model.isTransparent());
polygon.setLineColor(model.getLineColor());
return polygon;
}
use of org.csstudio.swt.widgets.figures.PolygonFigure in project yamcs-studio by yamcs.
the class PolygonEditPart method registerPropertyChangeHandlers.
/**
* {@inheritDoc}
*/
@Override
protected void registerPropertyChangeHandlers() {
super.registerPropertyChangeHandlers();
// fill
IWidgetPropertyChangeHandler fillHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
PolygonFigure polygon = (PolygonFigure) refreshableFigure;
polygon.setFill((Double) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractPolyModel.PROP_FILL_LEVEL, fillHandler);
// fill orientaion
IWidgetPropertyChangeHandler fillOrientHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
PolygonFigure figure = (PolygonFigure) 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) {
PolygonFigure figure = (PolygonFigure) refreshableFigure;
figure.setTransparent((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_TRANSPARENT, transparentHandler);
// line color
IWidgetPropertyChangeHandler lineColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
((PolygonFigure) refreshableFigure).setLineColor(((OPIColor) newValue).getSWTColor());
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_LINE_COLOR, lineColorHandler);
}
Aggregations