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
;
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
.specimenSearch
.SpecimenProviderSelectionController
;
25 * Wizard page for selecting the specimen provider
30 public class SpecimenProviderSelectionWizardPage
extends WizardPage
{
32 private SpecimenProviderSelectionController specimenProviderSelectionController
;
34 private ServiceWrapperBase serviceWrapper
;
36 public SpecimenProviderSelectionWizardPage(String pageName
) {
38 setTitle("Select Specimen Provider");
39 setDescription("Select the provider to query for specimens.\nTo query a BioCASE " +
40 "provider the access point URL must be entered.");
44 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
47 public void createControl(Composite parent
) {
48 specimenProviderSelectionController
= SpecimenProviderSelectionController
.getInstance(parent
, getWizard());
49 setControl(specimenProviderSelectionController
.getComposite());
50 //serviceWrapper = new BioCaseQueryServiceWrapper();
54 public QueryType
getQueryType(){
55 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
56 return QueryType
.BIOCASE
;
58 else {// if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
59 return QueryType
.GBIF
;
65 * @throws URISyntaxException
67 public URI
getEndPoint() {
72 * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
75 public boolean isPageComplete() {
76 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
79 endPoint
= new URL(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText()).toURI();
80 serviceWrapper
= new BioCaseQueryServiceWrapper();
81 serviceWrapper
.setBaseUrl(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText());
82 this.setErrorMessage(null);
84 } catch (MalformedURLException e
) {
85 setErrorMessage("A valid URL has to be entered.");
87 } catch (URISyntaxException e
) {
88 setErrorMessage("A valid URL has to be entered.");
92 else if(specimenProviderSelectionController
.getComposite().getBtnGbif().getSelection()){
93 this.setErrorMessage(null);
100 * @return the bioCaseQueryServiceWrapper
102 public ServiceWrapperBase
getQueryServiceWrapper() {
103 return serviceWrapper
;
107 * @param bioCaseQueryServiceWrapper the bioCaseQueryServiceWrapper to set
109 public void setQueryServiceWrapper(ServiceWrapperBase queryServiceWrapper
) {
110 this.serviceWrapper
= queryServiceWrapper
;
116 public SpecimenProviderSelectionController
getController() {
117 return specimenProviderSelectionController
;