Merge branch 'release/4.4.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / AbcdImportConfiguratorWizardPage.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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
11 package eu.etaxonomy.taxeditor.io.wizard;
12
13 import org.eclipse.jface.wizard.WizardPage;
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.events.SelectionAdapter;
16 import org.eclipse.swt.events.SelectionEvent;
17 import org.eclipse.swt.layout.GridLayout;
18 import org.eclipse.swt.widgets.Button;
19 import org.eclipse.swt.widgets.Composite;
20
21 import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
22 import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportState;
23
24 /**
25 *
26 * @author pplitzner
27 *
28 */
29 public class AbcdImportConfiguratorWizardPage extends WizardPage {
30
31 public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage";
32
33 private Abcd206ImportConfigurator<Abcd206ImportState, ?> configurator;
34
35 protected AbcdImportConfiguratorWizardPage(String title, String description, Abcd206ImportConfigurator<Abcd206ImportState, ?> configurator) {
36 super(PAGE_NAME);
37 this.configurator = configurator;
38 setTitle(title);
39 setDescription(description);
40 }
41
42 public static AbcdImportConfiguratorWizardPage createPage(Abcd206ImportConfigurator<Abcd206ImportState, ?> configurator){
43 return new AbcdImportConfiguratorWizardPage("Configure import parameters",
44 "Tooltips will explain parameters in more detail", configurator);
45 }
46
47
48
49 /** {@inheritDoc} */
50 @Override
51 public void createControl(Composite parent) {
52 final Composite composite = new Composite(parent, SWT.NULL);
53
54 GridLayout gridLayout = new GridLayout();
55 composite.setLayout(gridLayout);
56
57 Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
58 checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
59 checkBoxMediaSpecimen.setText("Import media as media specimen");
60 checkBoxMediaSpecimen
61 .setToolTipText("Any media attached to a ABCD unit will be imported as a sub derivative of the specimen created from this unit");
62 checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
63 @Override
64 public void widgetSelected(SelectionEvent e) {
65 configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
66 }
67 });
68
69 Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
70 checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
71 checkBoxIgnoreExisting.setText("Do not import existing specimens");
72 checkBoxIgnoreExisting
73 .setToolTipText("Specimens that have previously been imported will be ignored in this import");
74 checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
75 @Override
76 public void widgetSelected(SelectionEvent e) {
77 configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
78 }
79 });
80
81 Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
82 checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
83 checkBoxIgnoreAuthorship.setText("Ignore Authorship for name matching");
84 checkBoxIgnoreAuthorship
85 .setToolTipText("Name matching with existing names will be done without "
86 + "the authorship part of the name");
87 checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
88 @Override
89 public void widgetSelected(SelectionEvent e) {
90 configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
91 }
92 });
93
94 Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
95 checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
96 checkBoxMapUnitIdToCatalogNumber.setText("Map UnitID to catalog number");
97 checkBoxMapUnitIdToCatalogNumber
98 .setToolTipText("The UnitID of every ABCD unit will be mapped the catalog number "
99 + "of the specimen");
100 checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
101 @Override
102 public void widgetSelected(SelectionEvent e) {
103 configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
104 }
105 });
106
107 Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
108 checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
109 checkBoxMapUnitIdToAccessionNumber.setText("Map UnitID to accession number");
110 checkBoxMapUnitIdToAccessionNumber
111 .setToolTipText("The UnitID of every ABCD unit will be mapped the accession number "
112 + "of the specimen");
113 checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
114 @Override
115 public void widgetSelected(SelectionEvent e) {
116 configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
117 }
118 });
119
120 Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
121 checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
122 checkBoxMapUnitIdToBarcode.setText("Map UnitID to barcode");
123 checkBoxMapUnitIdToBarcode
124 .setToolTipText("The UnitID of every ABCD unit will be mapped the barcode "
125 + "of the specimen");
126 checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
127 @Override
128 public void widgetSelected(SelectionEvent e) {
129 configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
130 }
131 });
132
133 Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
134 checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
135 checkBoxRemoveCountry.setText("Remove country from locality text");
136 checkBoxRemoveCountry
137 .setToolTipText("If the locality text contains information about the "
138 + "country which is additionally stored in other ABCD "
139 + "elements then it is removed from the locality text");
140 checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
141 @Override
142 public void widgetSelected(SelectionEvent e) {
143 configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
144 }
145 });
146
147 Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
148 checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
149 checkBoxMoveToDefaultClassification.setText("Create new classification for new taxa");
150 checkBoxMoveToDefaultClassification
151 .setToolTipText("For taxa that do not exist in the data base "
152 + "a new classification will be created");
153 checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
154 @Override
155 public void widgetSelected(SelectionEvent e) {
156 configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
157 }
158 });
159
160 setControl(composite);
161 }
162
163 }