use of org.csstudio.swt.widgets.figures.TankFigure in project yamcs-studio by yamcs.
the class TankEditPart method registerPropertyChangeHandlers.
/**
* {@inheritDoc}
*/
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
// fillColor
IWidgetPropertyChangeHandler fillColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
TankFigure tank = (TankFigure) refreshableFigure;
tank.setFillColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(TankModel.PROP_FILL_COLOR, fillColorHandler);
// fillBackgroundColor
IWidgetPropertyChangeHandler fillBackColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
TankFigure tank = (TankFigure) refreshableFigure;
tank.setFillBackgroundColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(TankModel.PROP_FILLBACKGROUND_COLOR, fillBackColorHandler);
// effect 3D
IWidgetPropertyChangeHandler effect3DHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
TankFigure tank = (TankFigure) refreshableFigure;
tank.setEffect3D((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(TankModel.PROP_EFFECT3D, effect3DHandler);
// Change fill color when "FillColor Alarm Sensitive" property changes.
IWidgetPropertyChangeHandler fillColorAlarmSensitiveHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure refreshableFigure) {
TankFigure figure = (TankFigure) refreshableFigure;
boolean sensitive = (Boolean) newValue;
figure.setFillColor(delegate.calculateAlarmColor(sensitive, getWidgetModel().getFillColor()));
return true;
}
};
setPropertyChangeHandler(TankModel.PROP_FILLCOLOR_ALARM_SENSITIVE, fillColorAlarmSensitiveHandler);
// Change fill color when alarm severity changes.
delegate.addAlarmSeverityListener(new AlarmSeverityListener() {
@Override
public boolean severityChanged(AlarmSeverity severity, IFigure figure) {
if (!getWidgetModel().isFillColorAlarmSensitive())
return false;
TankFigure tank = (TankFigure) figure;
tank.setFillColor(delegate.calculateAlarmColor(getWidgetModel().isFillColorAlarmSensitive(), getWidgetModel().getFillColor()));
return true;
}
});
}
use of org.csstudio.swt.widgets.figures.TankFigure in project yamcs-studio by yamcs.
the class TankEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
TankModel model = getWidgetModel();
TankFigure tank = new TankFigure();
initializeCommonFigureProperties(tank, model);
tank.setFillColor(model.getFillColor());
tank.setEffect3D(model.isEffect3D());
tank.setFillBackgroundColor(model.getFillbackgroundColor());
return tank;
}
Aggregations