- reload last entered access point in wizard space
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 3 Jul 2014 08:36:10 +0000 (08:36 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 3 Jul 2014 08:36:10 +0000 (08:36 +0000)
 - added validation to access point text field

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/SpecimenProviderSelectionWizardPage.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/SpecimenSearchWizard.java

index 5657686e3bc4fdd0ac4c743784eb8a64d39c4417..fae847394171aed05c4bf15c102caf245063cf2f 100644 (file)
@@ -9,6 +9,11 @@
 */
 package eu.etaxonomy.taxeditor.editor.view.dataimport;
 
 */
 package eu.etaxonomy.taxeditor.editor.view.dataimport;
 
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.widgets.Composite;
 
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.widgets.Composite;
 
@@ -24,6 +29,7 @@ import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenProviderSelectionContr
 public class SpecimenProviderSelectionWizardPage extends WizardPage{
 
     private SpecimenProviderSelectionController specimenProviderSelectionController;
 public class SpecimenProviderSelectionWizardPage extends WizardPage{
 
     private SpecimenProviderSelectionController specimenProviderSelectionController;
+    private URI endPoint;
 
     protected SpecimenProviderSelectionWizardPage(String pageName) {
         super(pageName);
 
     protected SpecimenProviderSelectionWizardPage(String pageName) {
         super(pageName);
@@ -37,7 +43,7 @@ public class SpecimenProviderSelectionWizardPage extends WizardPage{
      */
     @Override
     public void createControl(Composite parent) {
      */
     @Override
     public void createControl(Composite parent) {
-        specimenProviderSelectionController = new SpecimenProviderSelectionController(parent);
+        specimenProviderSelectionController = SpecimenProviderSelectionController.getInstance(parent, getWizard());
         setControl(specimenProviderSelectionController.getComposite());
     }
 
         setControl(specimenProviderSelectionController.getComposite());
     }
 
@@ -50,4 +56,46 @@ public class SpecimenProviderSelectionWizardPage extends WizardPage{
         }
     }
 
         }
     }
 
+    /**
+     * @return
+     * @throws URISyntaxException
+     */
+    public URI getEndPoint() {
+        return endPoint;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+     */
+    @Override
+    public boolean isPageComplete() {
+        if(specimenProviderSelectionController.getComposite().getBtnBioCaseProvider().getSelection()){
+            endPoint = null;
+            try {
+                endPoint = new URL(specimenProviderSelectionController.getComposite().getTxtAccessPoint().getText()).toURI();
+                this.setErrorMessage(null);
+                return true;
+            } catch (MalformedURLException e) {
+                setErrorMessage("A valid URL has to be entered.");
+                return false;
+            } catch (URISyntaxException e) {
+                setErrorMessage("A valid URL has to be entered.");
+                return false;
+            }
+        }
+        else if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
+            this.setErrorMessage(null);
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @return
+     */
+    public SpecimenProviderSelectionController getController() {
+        return specimenProviderSelectionController;
+    }
+
+
 }
 }
index 412b991dda75084aebbc0c0cc4683cb717d09ee9..a2a21f96559fac9ccb1581c063d2a85ec11f0a78 100644 (file)
@@ -57,12 +57,13 @@ public class SpecimenSearchWizard extends Wizard implements IImportWizard {
     @Override
     public boolean performFinish() {
         searchPage.getController().saveLastSate();
     @Override
     public boolean performFinish() {
         searchPage.getController().saveLastSate();
-       
+        providerSelectionPage.getController().saveLastState();
+
         DataImportEditorInput<?> input = null;
         query = searchPage.getQuery();
         switch (providerSelectionPage.getQueryType()) {
         case BIOCASE:
         DataImportEditorInput<?> input = null;
         query = searchPage.getQuery();
         switch (providerSelectionPage.getQueryType()) {
         case BIOCASE:
-            input = new BioCaseEditorInput(query, null);
+            input = new BioCaseEditorInput(query, providerSelectionPage.getEndPoint());
             break;
         case GBIF:
             input = new GbifImportEditorInput(query);
             break;
         case GBIF:
             input = new GbifImportEditorInput(query);