use of eu.esdihumboldt.hale.ui.codelist.inspire.internal.CodeListSelector in project hale by halestudio.
the class RegistrySource method createControls.
/**
* @see ImportSource#createControls(Composite)
*/
@Override
public void createControls(Composite parent) {
GridLayoutFactory parentLayout = GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false);
parentLayout.applyTo(parent);
GridDataFactory labelData = //
GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER);
GridDataFactory controlData = //
GridDataFactory.swtDefaults().align(SWT.FILL, //
SWT.CENTER).grab(true, false);
// preset label
Label label = new Label(parent, SWT.NONE);
label.setText("Select preset:");
labelData.applyTo(label);
// preset selector
selector = new CodeListSelector(parent);
selector.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (description != null) {
CodeListRef schema = selector.getSelectedObject();
if (schema != null && schema.getDescription() != null) {
description.setText(schema.getDescription());
} else {
description.setText("");
}
}
updateState();
}
});
controlData.applyTo(selector.getControl());
// skipper
Composite empty = new Composite(parent, SWT.NONE);
GridDataFactory.swtDefaults().hint(1, 1).applyTo(empty);
// description label
description = new Label(parent, SWT.WRAP);
GridDataFactory.fillDefaults().grab(true, true).applyTo(description);
// prevent selector appearing very small
parent.pack();
// initial configuration (fixed values)
getConfiguration().setContentType(HalePlatform.getContentTypeManager().getContentType(INSPIRECodeListConstants.CONTENT_TYPE_ID));
getConfiguration().setProviderFactory(IOProviderExtension.getInstance().getFactory(INSPIRECodeListConstants.PROVIDER_ID));
// initial state update
updateState();
}
Aggregations