Search in sources :

Example 1 with LocationViewer

use of org.openlca.app.viewers.combo.LocationViewer in project olca-app by GreenDelta.

the class FlowInfoPage method createLocationViewer.

private void createLocationViewer(Composite comp) {
    new Label(comp, SWT.NONE).setText(M.Location);
    var viewer = new LocationViewer(comp);
    viewer.setNullable(true);
    viewer.setInput(Database.get());
    getBinding().onModel(this::getModel, "location", viewer);
    viewer.setEnabled(isEditable());
    new CommentControl(comp, getToolkit(), "location", getComments());
}
Also used : LocationViewer(org.openlca.app.viewers.combo.LocationViewer) CommentControl(org.openlca.app.editors.comments.CommentControl) Label(org.eclipse.swt.widgets.Label)

Example 2 with LocationViewer

use of org.openlca.app.viewers.combo.LocationViewer in project olca-app by GreenDelta.

the class InfoPage method createGeographySection.

private void createGeographySection(Composite body, FormToolkit tk) {
    Composite comp = UI.formSection(body, tk, M.Geography, 3);
    tk.createLabel(comp, M.Location);
    LocationViewer combo = new LocationViewer(comp);
    combo.setNullable(true);
    combo.setInput(Database.get());
    getBinding().onModel(this::getModel, "location", combo);
    combo.setEnabled(isEditable());
    combo.addSelectionChangedListener(loc -> {
        String linkText = loc != null && loc.geodata != null ? "open in map" : "no data";
        geoLink.setText(linkText);
        geoLink.getParent().pack();
    });
    new CommentControl(comp, getToolkit(), "location", getComments());
    createGeoLink(comp, tk);
    multiText(comp, M.Description, "documentation.geography", 40);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) LocationViewer(org.openlca.app.viewers.combo.LocationViewer) CommentControl(org.openlca.app.editors.comments.CommentControl)

Aggregations

CommentControl (org.openlca.app.editors.comments.CommentControl)2 LocationViewer (org.openlca.app.viewers.combo.LocationViewer)2 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1