use of org.openlca.app.editors.comments.CommentControl in project olca-app by GreenDelta.
the class Widgets method multiText.
public static Text multiText(Composite parent, String label, String property, ModelEditor<?> editor, FormToolkit toolkit) {
Text text = UI.formMultiText(parent, toolkit, label);
editor.getBinding().onString(editor::getModel, property, text);
new CommentControl(parent, toolkit, property, editor.getComments());
return text;
}
use of org.openlca.app.editors.comments.CommentControl in project olca-app by GreenDelta.
the class Widgets method link.
public static ImageHyperlink link(Composite parent, String label, String property, ModelEditor<?> editor, FormToolkit toolkit) {
new Label(parent, SWT.NONE).setText(label);
ImageHyperlink link = new ImageHyperlink(parent, SWT.TOP);
link.setForeground(Colors.linkBlue());
try {
Object value = Bean.getValue(editor.getModel(), property);
if (value == null) {
link.setText("-");
return link;
}
if (!(value instanceof RootEntity)) {
link.setText(value.toString());
return link;
}
var entity = (RootEntity) value;
link.setText(Labels.name(entity));
link.setImage(Images.get(entity));
link.addHyperlinkListener(new ModelLinkClickedListener(entity));
new CommentControl(parent, toolkit, property, editor.getComments());
return link;
} catch (Exception e) {
log.error("Could not get value " + property + " of " + editor.getModel(), e);
return link;
}
}
use of org.openlca.app.editors.comments.CommentControl in project olca-app by GreenDelta.
the class Widgets method readOnly.
public static CLabel readOnly(Composite parent, String label, Image image, String property, ModelEditor<?> editor, FormToolkit toolkit) {
UI.formLabel(parent, label);
CLabel labelWidget = new CLabel(parent, SWT.NONE);
GridData gridData = UI.gridData(labelWidget, false, false);
gridData.verticalAlignment = SWT.TOP;
gridData.verticalIndent = 2;
labelWidget.setImage(image);
editor.getBinding().readOnly(editor.getModel(), property, labelWidget);
new CommentControl(parent, toolkit, property, editor.getComments());
return labelWidget;
}
use of org.openlca.app.editors.comments.CommentControl in project olca-app by GreenDelta.
the class Widgets method text.
public static Text text(Composite parent, String label, String property, ModelEditor<?> editor, FormToolkit toolkit) {
Text text = UI.formText(parent, toolkit, label);
editor.getBinding().onString(editor::getModel, property, text);
new CommentControl(parent, toolkit, property, editor.getComments());
return text;
}
use of org.openlca.app.editors.comments.CommentControl in project olca-app by GreenDelta.
the class Widgets method multiText.
public static Text multiText(Composite parent, String label, String property, ModelEditor<?> editor, FormToolkit toolkit, int heightHint) {
Text text = UI.formMultiText(parent, toolkit, label, heightHint);
editor.getBinding().onString(editor::getModel, property, text);
new CommentControl(parent, toolkit, property, editor.getComments());
return text;
}
Aggregations