Search in sources :

Example 11 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class ChooseHaleConnectProjectWizard method openSelectProject.

/**
 * Open a {@link ChooseHaleConnectProjectWizard}
 *
 * @return the selected project or null if none was selected
 */
public static HaleConnectProjectConfig openSelectProject() {
    HaleConnectProjectConfig config = new HaleConnectProjectConfig();
    ChooseHaleConnectProjectWizard wizard = new ChooseHaleConnectProjectWizard(config);
    HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
    dialog.setMinimumPageSize(800, 300);
    if (dialog.open() == WizardDialog.OK) {
        return wizard.getConfiguration();
    }
    return null;
}
Also used : HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Example 12 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class ShareProjectHandler method execute.

/**
 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ShareProjectWizard wizard = new ShareProjectWizard();
    HaleConnectProjectExportAdvisor advisor = new HaleConnectProjectExportAdvisor();
    advisor.setServiceProvider(HaleUI.getServiceProvider());
    advisor.setActionId(ProjectIO.ACTION_SAVE_PROJECT);
    wizard.setAdvisor(advisor, null);
    HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
    dialog.open();
    return null;
}
Also used : HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Example 13 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class AbstractGenericCustomFunctionWizard method setContainer.

/**
 * @see Wizard#setContainer(IWizardContainer)
 */
@Override
public void setContainer(IWizardContainer wizardContainer) {
    super.setContainer(wizardContainer);
    if (wizardContainer instanceof HaleWizardDialog) {
        final HaleWizardDialog container = (HaleWizardDialog) wizardContainer;
        // has to be pageChanging, because closing the tray in page changed
        // leads to an exception
        ((HaleWizardDialog) wizardContainer).addPageChangingListener(new IPageChangingListener() {

            @Override
            public void handlePageChanging(PageChangingEvent event) {
                boolean helpAvailable = false;
                if (event.getTargetPage() instanceof HaleWizardPage<?>) {
                    HaleWizardPage<?> page = (HaleWizardPage<?>) event.getTargetPage();
                    helpAvailable = page.getHelpContext() != null;
                }
                container.setHelpButtonEnabled(helpAvailable);
                if (container.getTray() != null)
                    container.closeTray();
            }
        });
    }
}
Also used : HaleWizardPage(eu.esdihumboldt.hale.ui.HaleWizardPage) PageChangingEvent(org.eclipse.jface.dialogs.PageChangingEvent) IPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Example 14 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class WFSTarget method createControls.

@Override
public void createControls(Composite parent) {
    getPage().setMessage("Please specify the WFS Transaction URL");
    GridLayout layout = new GridLayout(3, false);
    parent.setLayout(layout);
    // target URL field
    targetURL = new URIFieldEditor("targetURL", "Transaction 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);
        }
    };
    targetURL.setPage(getPage());
    targetURL.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(FieldEditor.IS_VALID)) {
                getPage().setMessage(null);
                updateState();
            } else if (event.getProperty().equals(FieldEditor.VALUE)) {
                getPage().setMessage(null);
                updateState();
            }
        }
    });
    // 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) {
            WFSTransactionConfig config = new WFSTransactionConfig();
            ISelection versionSel = selectVersion.getSelection();
            if (!versionSel.isEmpty() && versionSel instanceof IStructuredSelection) {
                WFSVersion version = (WFSVersion) ((IStructuredSelection) versionSel).getFirstElement();
                config.setVersion(version);
            }
            WFSTransactionWizard wizard = new WFSTransactionWizard(config);
            HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
            if (dialog.open() == WizardDialog.OK) {
                WFSTransactionConfig result = wizard.getConfiguration();
                // apply result
                targetURL.setStringValue(result.getTransactionUri().toString());
                if (result.getVersion() != null) {
                    selectVersion.setSelection(new StructuredSelection(result.getVersion()));
                } else {
                    selectVersion.setSelection(new StructuredSelection());
                }
            }
        }
    });
    // select version
    Label versionLabel = new Label(parent, SWT.NONE);
    versionLabel.setText("WFS Version");
    selectVersion = new ComboViewer(parent);
    GridDataFactory.swtDefaults().span(1, 1).grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(selectVersion.getControl());
    selectVersion.setContentProvider(EnumContentProvider.getInstance());
    selectVersion.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof WFSVersion) {
                return ((WFSVersion) element).versionString;
            }
            return super.getText(element);
        }
    });
    selectVersion.setInput(WFSVersion.class);
    selectVersion.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateState();
        }
    });
    // fixed content type
    setContentType(HalePlatform.getContentTypeManager().getContentType(CONTENT_TYPE_ID_WFST));
    // initial state update
    updateState();
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WFSVersion(eu.esdihumboldt.hale.io.wfs.WFSVersion) URIFieldEditor(eu.esdihumboldt.hale.ui.util.io.URIFieldEditor) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ISelection(org.eclipse.jface.viewers.ISelection) LabelProvider(org.eclipse.jface.viewers.LabelProvider) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)

Example 15 with HaleWizardDialog

use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.

the class WFSGetFeatureSource method determineSource.

@Override
protected void determineSource(URIFieldEditor sourceURL) {
    WFSGetFeatureConfig config = new WFSGetFeatureConfig();
    WFSGetFeatureWizard wizard = new WFSGetFeatureWizard(config, getSchemaSpace());
    HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
    if (dialog.open() == WizardDialog.OK) {
        WFSGetFeatureConfig result = wizard.getConfiguration();
        // create URL
        URIBuilder builder = new URIBuilder(result.getGetFeatureUri());
        // add fixed parameters
        builder.addParameter("SERVICE", "WFS");
        builder.addParameter("VERSION", result.getVersion().toString());
        builder.addParameter("REQUEST", "GetFeature");
        // specify type names
        if (!result.getTypeNames().isEmpty()) {
            KVPUtil.addTypeNameParameter(builder, result.getTypeNames(), result.getVersion());
        }
        // BBOX
        if (result.getBbox() != null) {
            BBox bb = result.getBbox();
            List<String> vals = new ArrayList<>(5);
            vals.add(Double.toString(bb.getX1()));
            vals.add(Double.toString(bb.getY1()));
            vals.add(Double.toString(bb.getX2()));
            vals.add(Double.toString(bb.getY2()));
            String crs = result.getBboxCrsUri();
            if (crs != null && !crs.isEmpty()) {
                vals.add(crs);
            } else {
            // if no CRS is provided this may be a problem, because
            // default behavior is different for WFS 1.1 and WFS 2.0
            // WFS 1.1: WGS 84
            // WFS 2.0: Service default CRS
            }
            builder.addParameter("BBOX", Joiner.on(',').join(vals));
        }
        // MAXFEATURES (WFS 1) / COUNT (WFS 2)
        if (result.getMaxFeatures() != null) {
            switch(result.getVersion()) {
                case V1_1_0:
                    builder.addParameter("MAXFEATURES", String.valueOf(result.getMaxFeatures()));
                    break;
                case V2_0_0:
                case V2_0_2:
                default:
                    builder.addParameter("COUNT", String.valueOf(result.getMaxFeatures()));
                    break;
            }
        }
        try {
            sourceURL.setStringValue(builder.build().toString());
            getPage().setErrorMessage(null);
        } catch (URISyntaxException e) {
            getPage().setErrorMessage(e.getLocalizedMessage());
        }
    }
}
Also used : BBox(eu.esdihumboldt.hale.io.wfs.capabilities.BBox) ArrayList(java.util.ArrayList) URISyntaxException(java.net.URISyntaxException) HaleWizardDialog(eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog) URIBuilder(org.apache.http.client.utils.URIBuilder)

Aggregations

HaleWizardDialog (eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)18 Shell (org.eclipse.swt.widgets.Shell)6 MutableCell (eu.esdihumboldt.hale.common.align.model.MutableCell)3 ISelection (org.eclipse.jface.viewers.ISelection)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 Composite (org.eclipse.swt.widgets.Composite)3 IOConfiguration (eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration)2 HaleWizardPage (eu.esdihumboldt.hale.ui.HaleWizardPage)2 FunctionWizard (eu.esdihumboldt.hale.ui.function.FunctionWizard)2 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)2 ProjectService (eu.esdihumboldt.hale.ui.service.project.ProjectService)2 IPageChangingListener (org.eclipse.jface.dialogs.IPageChangingListener)2 PageChangingEvent (org.eclipse.jface.dialogs.PageChangingEvent)2 TypeFunction (eu.esdihumboldt.hale.common.align.extension.function.TypeFunction)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)1