3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.view
.dataimport
;
12 import java
.net
.MalformedURLException
;
14 import java
.net
.URISyntaxException
;
17 import org
.eclipse
.jface
.wizard
.WizardPage
;
18 import org
.eclipse
.swt
.widgets
.Composite
;
20 import eu
.etaxonomy
.taxeditor
.view
.specimenSearch
.SpecimenProviderSelectionController
;
24 * Wizard page for selecting the specimen provider
29 public class SpecimenProviderSelectionWizardPage
extends WizardPage
{
31 private SpecimenProviderSelectionController specimenProviderSelectionController
;
34 public SpecimenProviderSelectionWizardPage(String pageName
) {
36 setTitle("Select Specimen Provider");
37 setDescription("Select the provider to query for specimens.\nTo query a BioCASE " +
38 "provider the access point URL must be entered.");
42 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
45 public void createControl(Composite parent
) {
46 specimenProviderSelectionController
= SpecimenProviderSelectionController
.getInstance(parent
, getWizard());
47 setControl(specimenProviderSelectionController
.getComposite());
50 public QueryType
getQueryType(){
51 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
52 return QueryType
.BIOCASE
;
54 else {// if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
55 return QueryType
.GBIF
;
61 * @throws URISyntaxException
63 public URI
getEndPoint() {
68 * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
71 public boolean isPageComplete() {
72 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
75 endPoint
= new URL(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText()).toURI();
76 this.setErrorMessage(null);
78 } catch (MalformedURLException e
) {
79 setErrorMessage("A valid URL has to be entered.");
81 } catch (URISyntaxException e
) {
82 setErrorMessage("A valid URL has to be entered.");
86 else if(specimenProviderSelectionController
.getComposite().getBtnGbif().getSelection()){
87 this.setErrorMessage(null);
96 public SpecimenProviderSelectionController
getController() {
97 return specimenProviderSelectionController
;