use of org.csstudio.opibuilder.model.AbstractWidgetModel.PROP_TOOLTIP in project yamcs-studio by yamcs.
the class LabelEditPart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
setPropertyChangeHandler(PROP_TEXT, (oldValue, newValue, figure) -> {
((TextFigure) figure).setText((String) newValue);
Display.getCurrent().timerExec(10, () -> {
if (getWidgetModel().isAutoSize()) {
getWidgetModel().setSize(((TextFigure) figure).getAutoSizeDimension());
}
});
return true;
});
setPropertyChangeHandler(PROP_ACTIONS, (oldValue, newValue, figure) -> {
((TextFigure) figure).setSelectable(determinSelectable());
return false;
});
setPropertyChangeHandler(PROP_TOOLTIP, (oldValue, newValue, figure) -> {
((TextFigure) figure).setSelectable(determinSelectable());
return false;
});
IWidgetPropertyChangeHandler handler = (oldValue, newValue, figure) -> {
Display.getCurrent().timerExec(10, () -> {
if (getWidgetModel().isAutoSize()) {
getWidgetModel().setSize(((TextFigure) figure).getAutoSizeDimension());
figure.revalidate();
}
});
return true;
};
setPropertyChangeHandler(PROP_FONT, handler);
setPropertyChangeHandler(PROP_BORDER_STYLE, handler);
setPropertyChangeHandler(PROP_BORDER_WIDTH, handler);
setPropertyChangeHandler(PROP_TRANSPARENT, (oldValue, newValue, figure) -> {
((TextFigure) figure).setOpaque(!(Boolean) newValue);
return true;
});
setPropertyChangeHandler(PROP_AUTOSIZE, (oldValue, newValue, figure) -> {
if ((Boolean) newValue) {
getWidgetModel().setSize(((TextFigure) figure).getAutoSizeDimension());
figure.revalidate();
}
return true;
});
setPropertyChangeHandler(PROP_ALIGN_H, (oldValue, newValue, figure) -> {
((TextFigure) figure).setHorizontalAlignment(H_ALIGN.values()[(Integer) newValue]);
return true;
});
setPropertyChangeHandler(PROP_ALIGN_V, (oldValue, newValue, figure) -> {
((TextFigure) figure).setVerticalAlignment(V_ALIGN.values()[(Integer) 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;
});
getWidgetModel().getProperty(PROP_WRAP_WORDS).addPropertyChangeListener(evt -> updatePropertyVisibility());
setPropertyChangeHandler(PROP_SHOW_SCROLLBAR, (oldValue, newValue, figure) -> {
if (figure instanceof WrappableTextFigure) {
((WrappableTextFigure) figure).setShowScrollbar((Boolean) newValue);
}
return false;
});
}
Aggregations