Search in sources :

Example 1 with CommentControl

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;
}
Also used : CommentControl(org.openlca.app.editors.comments.CommentControl) Text(org.eclipse.swt.widgets.Text)

Example 2 with CommentControl

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;
    }
}
Also used : ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) CommentControl(org.openlca.app.editors.comments.CommentControl) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) RootEntity(org.openlca.core.model.RootEntity)

Example 3 with CommentControl

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;
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) CommentControl(org.openlca.app.editors.comments.CommentControl) GridData(org.eclipse.swt.layout.GridData)

Example 4 with CommentControl

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;
}
Also used : CommentControl(org.openlca.app.editors.comments.CommentControl) Text(org.eclipse.swt.widgets.Text)

Example 5 with CommentControl

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;
}
Also used : CommentControl(org.openlca.app.editors.comments.CommentControl) Text(org.eclipse.swt.widgets.Text)

Aggregations

CommentControl (org.openlca.app.editors.comments.CommentControl)17 Text (org.eclipse.swt.widgets.Text)5 Composite (org.eclipse.swt.widgets.Composite)4 CLabel (org.eclipse.swt.custom.CLabel)3 Label (org.eclipse.swt.widgets.Label)3 ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)3 LocationViewer (org.openlca.app.viewers.combo.LocationViewer)3 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Hyperlink (org.eclipse.ui.forms.widgets.Hyperlink)2 DataQualityShell (org.openlca.app.editors.processes.data_quality.DataQualityShell)2 DQSystem (org.openlca.core.model.DQSystem)2 ModelType (org.openlca.core.model.ModelType)2 Process (org.openlca.core.model.Process)2 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 Objects (java.util.Objects)1 BiConsumer (java.util.function.BiConsumer)1 Supplier (java.util.function.Supplier)1 SWT (org.eclipse.swt.SWT)1