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);
}
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());
}
}
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();
}
Aggregations