use of org.openlca.app.components.TextDropComponent in project olca-app by GreenDelta.
the class Dialog method sourceRow.
private void sourceRow(Composite body, FormToolkit tk) {
UI.formLabel(body, tk, M.Source);
TextDropComponent drop = new TextDropComponent(body, tk, ModelType.SOURCE);
UI.gridData(drop, true, false);
if (aspect.source != null) {
drop.setContent(Descriptor.of(aspect.source));
}
drop.onChange(d -> {
if (d == null) {
aspect.source = null;
} else {
SourceDao dao = new SourceDao(Database.get());
aspect.source = dao.getForId(d.id);
}
});
UI.filler(body, tk);
}
use of org.openlca.app.components.TextDropComponent in project olca-app by GreenDelta.
the class Widgets method dropComponent.
public static TextDropComponent dropComponent(Composite parent, String label, String property, ModelEditor<?> editor, FormToolkit toolkit) {
ModelType modelType = getModelType(editor.getModel(), property);
toolkit.createLabel(parent, label, SWT.NONE);
TextDropComponent text = new TextDropComponent(parent, toolkit, modelType);
UI.gridData(text, true, false);
editor.getBinding().onModel(editor::getModel, property, text);
new CommentControl(parent, toolkit, property, editor.getComments());
return text;
}
Aggregations