Search in sources :

Example 1 with TextDropComponent

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);
}
Also used : SourceDao(org.openlca.core.database.SourceDao) TextDropComponent(org.openlca.app.components.TextDropComponent)

Example 2 with TextDropComponent

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;
}
Also used : CommentControl(org.openlca.app.editors.comments.CommentControl) ModelType(org.openlca.core.model.ModelType) TextDropComponent(org.openlca.app.components.TextDropComponent)

Aggregations

TextDropComponent (org.openlca.app.components.TextDropComponent)2 CommentControl (org.openlca.app.editors.comments.CommentControl)1 SourceDao (org.openlca.core.database.SourceDao)1 ModelType (org.openlca.core.model.ModelType)1