2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.view
.dataimport
;
11 import java
.net
.MalformedURLException
;
12 import eu
.etaxonomy
.cdm
.common
.URI
;
13 import java
.net
.URISyntaxException
;
16 import org
.eclipse
.jface
.wizard
.WizardPage
;
17 import org
.eclipse
.swt
.widgets
.Composite
;
19 import eu
.etaxonomy
.cdm
.ext
.common
.ServiceWrapperBase
;
20 import eu
.etaxonomy
.cdm
.ext
.occurrence
.bioCase
.BioCaseQueryServiceWrapper
;
21 import eu
.etaxonomy
.taxeditor
.view
.search
.specimen
.SpecimenProviderSelectionController
;
25 * Wizard page for selecting the specimen provider
29 public class SpecimenProviderSelectionWizardPage
extends WizardPage
{
31 private SpecimenProviderSelectionController specimenProviderSelectionController
;
33 private ServiceWrapperBase serviceWrapper
;
35 public SpecimenProviderSelectionWizardPage(String pageName
) {
37 setTitle("Select Specimen Provider");
38 setDescription("Select the provider to query for specimens.\nTo query a BioCASE " +
39 "provider the access point URL must be entered.");
43 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
46 public void createControl(Composite parent
) {
47 specimenProviderSelectionController
= SpecimenProviderSelectionController
.getInstance(parent
, getWizard());
48 setControl(specimenProviderSelectionController
.getComposite());
49 //serviceWrapper = new BioCaseQueryServiceWrapper();
53 public QueryType
getQueryType(){
54 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
55 return QueryType
.BIOCASE
;
57 else {// if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
58 return QueryType
.GBIF
;
62 public URI
getEndPoint() {
67 public boolean isPageComplete() {
68 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
71 endPoint
= URI
.fromUrl(new URL(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText()));
72 serviceWrapper
= new BioCaseQueryServiceWrapper();
73 serviceWrapper
.setBaseUrl(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText());
74 this.setErrorMessage(null);
76 } catch (MalformedURLException e
) {
77 setErrorMessage("A valid URL has to be entered.");
79 } catch (URISyntaxException e
) {
80 setErrorMessage("A valid URL has to be entered.");
84 else if(specimenProviderSelectionController
.getComposite().getBtnGbif().getSelection()){
85 this.setErrorMessage(null);
91 public ServiceWrapperBase
getQueryServiceWrapper() {
92 return serviceWrapper
;
94 public void setQueryServiceWrapper(ServiceWrapperBase queryServiceWrapper
) {
95 this.serviceWrapper
= queryServiceWrapper
;
98 public SpecimenProviderSelectionController
getController() {
99 return specimenProviderSelectionController
;