use of org.csstudio.opibuilder.widgets.model.ImageBoolIndicatorModel.PROP_NO_ANIMATION in project yamcs-studio by yamcs.
the class ImageBoolIndicatorEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
// Don't autosize to save CPU usage
// removeAllPropertyChangeHandlers(AbstractPVWidgetModel.PROP_PVVALUE);
// value
// IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {
// public boolean handleChange(Object oldValue,
// final Object newValue,
// final IFigure refreshableFigure) {
// if(newValue == null)
// return false;
// ImageBoolButtonFigure figure = (ImageBoolButtonFigure) refreshableFigure;
// // autoSizeWidget(figure);
// return true;
// }
// };
// setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVVALUE, handler);
setPropertyChangeHandler(PROP_ON_IMAGE, (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
var absolutePath = (String) newValue;
if (!absolutePath.contains("://")) {
var path = Path.fromPortableString(absolutePath);
if (!path.isAbsolute()) {
path = ResourceUtil.buildAbsolutePath(getWidgetModel(), path);
absolutePath = path.toPortableString();
}
}
imageFigure.setOnImagePath(absolutePath);
autoSizeWidget(imageFigure);
return true;
});
setPropertyChangeHandler(PROP_OFF_IMAGE, (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
var absolutePath = (String) newValue;
if (!absolutePath.contains("://")) {
var path = Path.fromPortableString(absolutePath);
if (!path.isAbsolute()) {
path = ResourceUtil.buildAbsolutePath(getWidgetModel(), path);
absolutePath = path.toPortableString();
}
}
imageFigure.setOffImagePath(absolutePath);
autoSizeWidget(imageFigure);
return true;
});
setPropertyChangeHandler(PROP_STRETCH, (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
imageFigure.setStretch((Boolean) newValue);
autoSizeWidget(imageFigure);
return true;
});
setPropertyChangeHandler(PROP_AUTOSIZE, (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(imageFigure);
return true;
});
setPropertyChangeHandler(PROP_NO_ANIMATION, (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
imageFigure.setAnimationDisabled((Boolean) newValue);
return false;
});
setPropertyChangeHandler(PROP_ALIGN_TO_NEAREST_SECOND, (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
imageFigure.setAlignedToNearestSecond((Boolean) newValue);
return false;
});
// changes to the border width property
IWidgetPropertyChangeHandler handle = (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(imageFigure);
return true;
};
setPropertyChangeHandler(PROP_BORDER_WIDTH, handle);
setPropertyChangeHandler(PROP_BORDER_STYLE, handle);
// size change handlers - so we can stretch accordingly
handle = (oldValue, newValue, figure) -> {
var imageFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(imageFigure);
return true;
};
setPropertyChangeHandler(PROP_HEIGHT, handle);
setPropertyChangeHandler(PROP_WIDTH, handle);
FigureTransparencyHelper.addHandler(this, figure);
}
Aggregations