use of org.openlca.app.editors.processes.data_quality.DataQualityShell in project olca-app by GreenDelta.
the class InfoPage method createDqEntryRow.
private Hyperlink createDqEntryRow(Composite parent, FormToolkit tk) {
UI.formLabel(parent, tk, M.DataQualityEntry);
Supplier<String> dqLabel = () -> {
Process p = getModel();
return p.dqSystem == null || Strings.nullOrEmpty(p.dqEntry) ? "(not specified)" : p.dqSystem.applyScoreLabels(p.dqEntry);
};
Hyperlink link = UI.formLink(parent, tk, dqLabel.get());
Controls.onClick(link, e -> {
if (getModel().dqSystem == null) {
MsgBox.info("No data quality system is selected");
return;
}
String oldVal = getModel().dqEntry;
DQSystem system = getModel().dqSystem;
String entry = getModel().dqEntry;
DataQualityShell shell = DataQualityShell.withoutUncertainty(parent.getShell(), system, entry);
shell.onOk = (_shell) -> {
getModel().dqEntry = _shell.getSelection();
};
shell.onDelete = (_shell) -> {
getModel().dqEntry = null;
};
shell.addDisposeListener(_e -> {
if (Objects.equals(oldVal, getModel().dqEntry))
return;
link.setText(dqLabel.get());
link.pack();
getEditor().setDirty(true);
});
shell.open();
});
link.setEnabled(isEditable());
new CommentControl(parent, getToolkit(), "dqEntry", getComments());
return link;
}
use of org.openlca.app.editors.processes.data_quality.DataQualityShell in project olca-app by GreenDelta.
the class DataQualityCellEditor method openDialogBox.
@Override
protected Object openDialogBox(Control control) {
if (exchange == null || editor.getModel().exchangeDqSystem == null) {
MsgBox.error("Please select a data quality system first");
return null;
}
DQSystem system = editor.getModel().exchangeDqSystem;
String dqEntry = exchange.dqEntry;
Double uncertainty = exchange.baseUncertainty;
DataQualityShell shell = DataQualityShell.withUncertainty(control.getShell(), system, dqEntry, uncertainty);
shell.onOk = this::onOk;
shell.onDelete = this::onDelete;
shell.onUseUncertainties = this::onUseUncertainties;
shell.addDisposeListener(e -> {
if (valuesChanged()) {
updateContents(exchange.dqEntry);
viewer.refresh();
editor.setDirty(true);
}
});
shell.open();
return null;
}
Aggregations