use of org.csstudio.opibuilder.widgets.model.ImageModel.PROP_ALIGN_TO_NEAREST_SECOND in project yamcs-studio by yamcs.
the class ImageEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
setPropertyChangeHandler(PROP_IMAGE_FILE, (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) 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.setFilePath(absolutePath);
autoSizeWidget(imageFigure);
return false;
});
setPropertyChangeHandler(PROP_STRETCH, (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) figure;
imageFigure.setStretch((Boolean) newValue);
autoSizeWidget(imageFigure);
return false;
});
setPropertyChangeHandler(PROP_AUTOSIZE, (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) figure;
imageFigure.setAutoSize((Boolean) newValue);
var model = (ImageModel) getModel();
var d = imageFigure.getAutoSizedDimension();
if ((Boolean) newValue && !model.getStretch() && d != null) {
model.setSize(d.width, d.height);
}
return false;
});
setPropertyChangeHandler(PROP_NO_ANIMATION, (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) figure;
imageFigure.setAnimationDisabled((Boolean) newValue);
return false;
});
setPropertyChangeHandler(PROP_ALIGN_TO_NEAREST_SECOND, (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) figure;
imageFigure.setAlignedToNearestSecond((Boolean) newValue);
return false;
});
// changes to the border width property
IWidgetPropertyChangeHandler handle = (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) figure;
imageFigure.resizeImage();
autoSizeWidget(imageFigure);
return false;
};
setPropertyChangeHandler(PROP_BORDER_WIDTH, handle);
setPropertyChangeHandler(PROP_BORDER_STYLE, handle);
// size change handlers - so we can stretch accordingly
handle = (oldValue, newValue, figure) -> {
var imageFigure = (ImageFigure) figure;
imageFigure.resizeImage();
autoSizeWidget(imageFigure);
return false;
};
setPropertyChangeHandler(PROP_HEIGHT, handle);
setPropertyChangeHandler(PROP_WIDTH, handle);
FigureTransparencyHelper.addHandler(this, figure);
registerCropPropertyHandlers();
registerImageRotationPropertyHandlers();
}
Aggregations