61e9c1517e7eacf946aea58a46effbfe65aaa5f4
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / dataimport / SpecimenSearchWizardPage.java
1 // $Id$
2 /**
3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
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.
9 */
10 package eu.etaxonomy.taxeditor.editor.view.dataimport;
11
12 import java.util.Calendar;
13
14 import org.eclipse.jface.wizard.WizardPage;
15 import org.eclipse.swt.widgets.Composite;
16
17 import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
18 import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchController;
19
20
21 /**
22 * Wizard page for entering search parameters
23 * @author pplitzner
24 * @date 12.09.2013
25 *
26 */
27 public class SpecimenSearchWizardPage extends WizardPage{
28
29 private SpecimenSearchController specimenSearchController;
30
31 protected SpecimenSearchWizardPage(String pageName) {
32 super(pageName);
33 setDescription("Specify search parameters for external search query.");
34 setTitle("Search Specimens");
35 }
36
37 /* (non-Javadoc)
38 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
39 */
40 @Override
41 public void createControl(Composite parent) {
42 specimenSearchController = SpecimenSearchController.getInstance(parent);
43 setControl(specimenSearchController.getComposite());
44 }
45
46 /**
47 * Returns an {@link OccurenceQuery} filled with the parameters defined in this wizard page
48 * @return
49 */
50 public OccurenceQuery getQuery() {
51 String accessionNumber = specimenSearchController.getAccessionNumber();
52 String collector = specimenSearchController.getCollector();
53 String collectorsNumber = specimenSearchController.getCollectorNumber();
54 String country = specimenSearchController.getCountry();
55 Calendar dateFrom = specimenSearchController.getDateFrom();
56 Calendar dateTo = specimenSearchController.getDateTo();
57 String herbarium = specimenSearchController.getHerbarium();
58 String locality = specimenSearchController.getLocality();
59 String taxonName = specimenSearchController.getTaxonName();
60 return new OccurenceQuery(taxonName, collector, collectorsNumber, accessionNumber, herbarium, country, locality, dateFrom, dateTo);
61 }
62
63 /**
64 * @return the specimenSearchController
65 */
66 public SpecimenSearchController getController() {
67 return specimenSearchController;
68 }
69
70
71
72 }