Search in sources :

Example 11 with DefaultCustomPropertyFunction

use of eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction in project hale by halestudio.

the class CustomFunctionExplanationPage method apply.

@Override
public void apply() {
    DefaultCustomPropertyFunction cf = getWizard().getResultFunction();
    if (cf == null)
        return;
    Map<Locale, Value> templates = new HashMap<>();
    tabs.forEach((locale, group) -> {
        String text = group.getEditor().getText();
        if (text != null && !text.isEmpty()) {
            templates.put(locale, Value.of(new eu.esdihumboldt.hale.common.core.io.Text(text)));
        }
    });
    DefaultCustomFunctionExplanation explanation = new DefaultCustomFunctionExplanation(templates);
    cf.setExplanation(explanation);
}
Also used : Locale(java.util.Locale) DefaultCustomPropertyFunction(eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction) HashMap(java.util.HashMap) Value(eu.esdihumboldt.hale.common.core.io.Value) DefaultCustomFunctionExplanation(eu.esdihumboldt.hale.common.align.custom.DefaultCustomFunctionExplanation) Text(org.eclipse.swt.widgets.Text)

Example 12 with DefaultCustomPropertyFunction

use of eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction in project hale by halestudio.

the class MainPage method apply.

@Override
public void apply() {
    if (ident != null && name != null) {
        DefaultCustomPropertyFunction cf = getWizard().getResultFunction();
        cf.setIdentifier(ident.getText());
        cf.setName(name.getText());
    }
}
Also used : DefaultCustomPropertyFunction(eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction)

Example 13 with DefaultCustomPropertyFunction

use of eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction in project hale by halestudio.

the class MainPage method createContent.

@Override
protected void createContent(Composite page) {
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(page);
    GridDataFactory labelData = GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER);
    GridDataFactory fieldData = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false);
    ModifyListener modify = new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            updateState();
        }
    };
    // identifier
    Label labelIdent = new Label(page, SWT.NONE);
    labelIdent.setText("Identifier");
    labelData.applyTo(labelIdent);
    ident = new Text(page, SWT.SINGLE | SWT.BORDER);
    ident.addModifyListener(modify);
    fieldData.applyTo(ident);
    // name
    Label labelName = new Label(page, SWT.NONE);
    labelName.setText("Name");
    labelData.applyTo(labelName);
    name = new Text(page, SWT.SINGLE | SWT.BORDER);
    name.addModifyListener(modify);
    fieldData.applyTo(name);
    // TODO description
    // load from initial function
    DefaultCustomPropertyFunction cf = getWizard().getResultFunction();
    if (cf.getName() != null) {
        name.setText(cf.getName());
    }
    if (cf.getIdentifier() != null) {
        ident.setText(cf.getIdentifier());
    }
    updateState();
}
Also used : GridDataFactory(org.eclipse.jface.layout.GridDataFactory) DefaultCustomPropertyFunction(eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Aggregations

DefaultCustomPropertyFunction (eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunction)13 Value (eu.esdihumboldt.hale.common.core.io.Value)4 DefaultCustomFunctionExplanation (eu.esdihumboldt.hale.common.align.custom.DefaultCustomFunctionExplanation)3 CustomPropertyFunction (eu.esdihumboldt.hale.common.align.extension.function.custom.CustomPropertyFunction)3 ParameterValue (eu.esdihumboldt.hale.common.align.model.ParameterValue)3 Locale (java.util.Locale)3 DefaultCustomPropertyFunctionEntity (eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunctionEntity)2 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 Text (org.eclipse.swt.widgets.Text)2 DefaultCustomPropertyFunctionParameter (eu.esdihumboldt.hale.common.align.custom.DefaultCustomPropertyFunctionParameter)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)1 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)1 Text (eu.esdihumboldt.hale.common.core.io.Text)1 PropertyDefinition (eu.esdihumboldt.hale.common.schema.model.PropertyDefinition)1 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)1