use of eu.esdihumboldt.hale.ui.io.source.URLSourceURIFieldEditor in project hale by halestudio.
the class AbstractWFSSource method createControls.
/**
* @see ImportSource#createControls(Composite)
*/
@Override
public void createControls(Composite parent) {
parent.setLayout(new GridLayout(4, false));
// caption
// placeholder
new Label(parent, SWT.NONE);
Label caption = new Label(parent, SWT.NONE);
caption.setText(getCaption());
caption.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 3, 1));
// source file
// target URL field
sourceURL = new URLSourceURIFieldEditor("sourceURL", "URL:", parent) {
// the following methods are overridden so the capabilities button
// may appear on the same line
@Override
public int getNumberOfControls() {
return super.getNumberOfControls() + 1;
}
@Override
protected void doFillIntoGrid(Composite parent, int numColumns) {
super.doFillIntoGrid(parent, numColumns - 1);
}
};
sourceURL.setPage(getPage());
// set custom URI filter
sourceURL.setURIFilter(createHistoryURIFilter());
// set content types for URI field
Collection<IOProviderDescriptor> factories = getConfiguration().getFactories();
HashSet<IContentType> supportedTypes = new HashSet<IContentType>();
for (IOProviderDescriptor factory : factories) {
supportedTypes.addAll(factory.getSupportedTypes());
}
sourceURL.setContentTypes(supportedTypes);
sourceURL.setPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(FieldEditor.IS_VALID)) {
getPage().setMessage(null);
updateState(true);
} else if (event.getProperty().equals(FieldEditor.VALUE)) {
getPage().setMessage(null);
updateState(true);
}
}
});
// button to determine from capabilities
Button capButton = new Button(parent, SWT.PUSH);
capButton.setText("...");
capButton.setToolTipText("Determine based on WFS Capabilities");
capButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
determineSource(sourceURL);
}
});
// provider selection
// label
Label providerLabel = new Label(parent, SWT.NONE);
providerLabel.setText("Import as");
// create provider combo
ComboViewer providers = createProviders(parent);
providers.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1));
// initial state update
updateState(true);
}
Aggregations