use of org.csstudio.opibuilder.widgets.model.TextUpdateModel.PROP_ROTATION in project yamcs-studio by yamcs.
the class TextUpdateEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
setPropertyChangeHandler(PROP_TEXT, (oldValue, newValue, figure) -> {
setFigureText((String) newValue);
if (isAutoSize) {
Display.getCurrent().timerExec(10, this::performAutoSize);
}
return true;
});
setPropertyChangeHandler(PROP_FONT, (oldValue, newValue, figure) -> {
figure.setFont(CustomMediaFactory.getInstance().getFont(((OPIFont) newValue).getFontData()));
return true;
});
IWidgetPropertyChangeHandler handler = (oldValue, newValue, figure) -> {
Display.getCurrent().timerExec(10, () -> {
if (getWidgetModel().isAutoSize()) {
performAutoSize();
figure.revalidate();
}
});
return true;
};
setPropertyChangeHandler(PROP_FONT, handler);
setPropertyChangeHandler(PROP_BORDER_STYLE, handler);
setPropertyChangeHandler(PROP_BORDER_WIDTH, handler);
setPropertyChangeHandler(PROP_TRANSPARENT, (oldValue, newValue, figure) -> {
figure.setOpaque(!(Boolean) newValue);
return true;
});
setPropertyChangeHandler(PROP_AUTOSIZE, (oldValue, newValue, figure) -> {
isAutoSize = (Boolean) newValue;
if ((Boolean) newValue) {
performAutoSize();
figure.revalidate();
}
return true;
});
setPropertyChangeHandler(PROP_ALIGN_H, (oldValue, newValue, figure) -> {
if (figure instanceof TextFigure) {
((TextFigure) figure).setHorizontalAlignment(H_ALIGN.values()[(Integer) newValue]);
}
return true;
});
setPropertyChangeHandler(PROP_ALIGN_V, (oldValue, newValue, figure) -> {
if (figure instanceof TextFigure) {
((TextFigure) figure).setVerticalAlignment(V_ALIGN.values()[(Integer) newValue]);
}
return true;
});
setPropertyChangeHandler(PROP_PVVALUE, (oldValue, newValue, figure) -> {
if (newValue == null) {
return false;
}
formatValue(newValue, PROP_PVVALUE);
return false;
});
setPropertyChangeHandler(PROP_FORMAT_TYPE, (oldValue, newValue, figure) -> {
format = FormatEnum.values()[(Integer) newValue];
formatValue(newValue, PROP_FORMAT_TYPE);
return true;
});
setPropertyChangeHandler(PROP_PRECISION, (oldValue, newValue, figure) -> {
precision = (Integer) newValue;
formatValue(newValue, PROP_PRECISION);
return true;
});
setPropertyChangeHandler(PROP_PRECISION_FROM_DB, (oldValue, newValue, figure) -> {
isPrecisionFromDB = (Boolean) newValue;
formatValue(newValue, PROP_PRECISION_FROM_DB);
return true;
});
setPropertyChangeHandler(PROP_SHOW_UNITS, (oldValue, newValue, figure) -> {
isShowUnits = (Boolean) newValue;
formatValue(newValue, PROP_SHOW_UNITS);
return true;
});
setPropertyChangeHandler(PROP_ROTATION, (oldValue, newValue, figure) -> {
if (figure instanceof TextFigure) {
((TextFigure) figure).setRotate((Double) newValue);
}
return true;
});
setPropertyChangeHandler(PROP_WRAP_WORDS, (oldValue, newValue, figure) -> {
AbstractWidgetModel model = getWidgetModel();
var parent = model.getParent();
parent.removeChild(model);
parent.addChild(model);
parent.selectWidget(model, true);
return false;
});
}
Aggregations