1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.io.e4.in.abcd;
|
11
|
|
12
|
import javax.inject.Inject;
|
13
|
|
14
|
import org.eclipse.jface.preference.IPreferenceStore;
|
15
|
import org.eclipse.jface.wizard.WizardPage;
|
16
|
import org.eclipse.swt.SWT;
|
17
|
import org.eclipse.swt.events.SelectionAdapter;
|
18
|
import org.eclipse.swt.events.SelectionEvent;
|
19
|
import org.eclipse.swt.layout.GridLayout;
|
20
|
import org.eclipse.swt.widgets.Button;
|
21
|
import org.eclipse.swt.widgets.Composite;
|
22
|
|
23
|
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
|
24
|
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
25
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
26
|
|
27
|
/**
|
28
|
*
|
29
|
* @author pplitzner
|
30
|
*
|
31
|
*/
|
32
|
public class AbcdImportConfiguratorWizardPageE4 extends WizardPage {
|
33
|
|
34
|
public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage";
|
35
|
|
36
|
private Abcd206ImportConfigurator configurator;
|
37
|
|
38
|
@Inject
|
39
|
public AbcdImportConfiguratorWizardPageE4() {
|
40
|
super(PAGE_NAME);
|
41
|
setTitle("Configure import parameters");
|
42
|
setDescription("Tooltips will explain parameters in more detail");
|
43
|
}
|
44
|
|
45
|
// protected AbcdImportConfiguratorWizardPageE4(String title, String description, Abcd206ImportConfigurator configurator, boolean isPreferencePage) {
|
46
|
// super(PAGE_NAME);
|
47
|
// this.configurator = configurator;
|
48
|
// setTitle(title);
|
49
|
// setDescription(description);
|
50
|
// this.isPreferencePage = isPreferencePage;
|
51
|
// }
|
52
|
//
|
53
|
// public static AbcdImportConfiguratorWizardPageE4 createPreferencePage(Abcd206ImportConfigurator configurator){
|
54
|
// return new AbcdImportConfiguratorWizardPageE4("Configure import parameters",
|
55
|
// "Tooltips will explain parameters in more detail", configurator, true);
|
56
|
// }
|
57
|
|
58
|
|
59
|
|
60
|
/** {@inheritDoc} */
|
61
|
@Override
|
62
|
public void createControl(Composite parent) {
|
63
|
final Composite composite = new Composite(parent, SWT.NULL);
|
64
|
//composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
|
65
|
GridLayout gridLayout = new GridLayout();
|
66
|
composite.setLayout(gridLayout);
|
67
|
// if (isPreferencePage){
|
68
|
// ListComponent list = new ListComponent(composite, composite.getStyle());
|
69
|
// }
|
70
|
|
71
|
Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
|
72
|
checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
|
73
|
checkBoxMediaSpecimen.setText("Import media as media specimen");
|
74
|
checkBoxMediaSpecimen
|
75
|
.setToolTipText("Any media attached to a ABCD unit will be imported as a sub derivative of the specimen created from this unit");
|
76
|
checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
|
77
|
@Override
|
78
|
public void widgetSelected(SelectionEvent e) {
|
79
|
configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
|
80
|
}
|
81
|
});
|
82
|
|
83
|
Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
|
84
|
checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
|
85
|
checkBoxIgnoreExisting.setText("Do not import existing specimens");
|
86
|
checkBoxIgnoreExisting
|
87
|
.setToolTipText("Specimens that have previously been imported will be ignored in this import");
|
88
|
checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
|
89
|
@Override
|
90
|
public void widgetSelected(SelectionEvent e) {
|
91
|
configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
|
92
|
}
|
93
|
});
|
94
|
|
95
|
Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
|
96
|
checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
|
97
|
checkBoxIgnoreAuthorship.setText("Ignore Authorship for name matching");
|
98
|
checkBoxIgnoreAuthorship
|
99
|
.setToolTipText("Name matching with existing names will be done without "
|
100
|
+ "the authorship part of the name");
|
101
|
checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
|
102
|
@Override
|
103
|
public void widgetSelected(SelectionEvent e) {
|
104
|
configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
|
105
|
}
|
106
|
});
|
107
|
|
108
|
Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
|
109
|
checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
|
110
|
checkBoxMapUnitIdToCatalogNumber.setText("Map UnitID to catalog number");
|
111
|
checkBoxMapUnitIdToCatalogNumber
|
112
|
.setToolTipText("The UnitID of every ABCD unit will be mapped the catalog number "
|
113
|
+ "of the specimen");
|
114
|
checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
|
115
|
@Override
|
116
|
public void widgetSelected(SelectionEvent e) {
|
117
|
configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
|
118
|
}
|
119
|
});
|
120
|
//TODO: only one of the mappings can be checked!
|
121
|
Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
|
122
|
checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
|
123
|
checkBoxMapUnitIdToAccessionNumber.setText("Map UnitID to accession number");
|
124
|
checkBoxMapUnitIdToAccessionNumber
|
125
|
.setToolTipText("The UnitID of every ABCD unit will be mapped the accession number "
|
126
|
+ "of the specimen");
|
127
|
checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
|
128
|
@Override
|
129
|
public void widgetSelected(SelectionEvent e) {
|
130
|
configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
|
131
|
}
|
132
|
});
|
133
|
|
134
|
Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
|
135
|
checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
|
136
|
checkBoxMapUnitIdToBarcode.setText("Map UnitID to barcode");
|
137
|
checkBoxMapUnitIdToBarcode
|
138
|
.setToolTipText("The UnitID of every ABCD unit will be mapped the barcode "
|
139
|
+ "of the specimen");
|
140
|
checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
|
141
|
@Override
|
142
|
public void widgetSelected(SelectionEvent e) {
|
143
|
configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
|
144
|
}
|
145
|
});
|
146
|
|
147
|
Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
|
148
|
checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
|
149
|
checkBoxRemoveCountry.setText("Remove country from locality text");
|
150
|
checkBoxRemoveCountry
|
151
|
.setToolTipText("If the locality text contains information about the "
|
152
|
+ "country which is additionally stored in other ABCD "
|
153
|
+ "elements then it is removed from the locality text");
|
154
|
checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
|
155
|
@Override
|
156
|
public void widgetSelected(SelectionEvent e) {
|
157
|
configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
|
158
|
}
|
159
|
});
|
160
|
|
161
|
Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
|
162
|
checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
|
163
|
checkBoxMoveToDefaultClassification.setText("Create new classification for new taxa");
|
164
|
checkBoxMoveToDefaultClassification
|
165
|
.setToolTipText("For taxa that do not exist in the data base "
|
166
|
+ "a new classification will be created");
|
167
|
checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
|
168
|
@Override
|
169
|
public void widgetSelected(SelectionEvent e) {
|
170
|
configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
|
171
|
}
|
172
|
});
|
173
|
|
174
|
Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
|
175
|
checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
|
176
|
checkBoxImportSiblings.setText("Import all children of cultures or tissue samples");
|
177
|
checkBoxImportSiblings
|
178
|
.setToolTipText("For a tissue sample or culture all children will be searched and imported");
|
179
|
checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
|
180
|
@Override
|
181
|
public void widgetSelected(SelectionEvent e) {
|
182
|
configurator.setGetSiblings(checkBoxImportSiblings.getSelection());
|
183
|
}
|
184
|
});
|
185
|
|
186
|
Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
|
187
|
checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
188
|
checkBoxAddIndividualsAssociations.setText("Create an Individual Association for each Specimen");
|
189
|
checkBoxAddIndividualsAssociations
|
190
|
.setToolTipText("For each specimen associated to a taxon an indiviadual association to this taxon is created");
|
191
|
checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
|
192
|
@Override
|
193
|
public void widgetSelected(SelectionEvent e) {
|
194
|
configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
195
|
}
|
196
|
});
|
197
|
|
198
|
Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
|
199
|
checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
|
200
|
checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group");
|
201
|
checkBoxReuseDescriptiveGroups
|
202
|
.setToolTipText("Reuse one of the existing descriptive groups or create a new one for every import");
|
203
|
checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
|
204
|
@Override
|
205
|
public void widgetSelected(SelectionEvent e) {
|
206
|
configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
|
207
|
}
|
208
|
});
|
209
|
|
210
|
Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
|
211
|
checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
|
212
|
checkBoxReuseExistingTaxa.setText("Reuse existing taxa when possible");
|
213
|
checkBoxReuseExistingTaxa
|
214
|
.setToolTipText("Reuse existing taxa when the name matches the identified name of the specimen");
|
215
|
checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
|
216
|
@Override
|
217
|
public void widgetSelected(SelectionEvent e) {
|
218
|
configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
|
219
|
}
|
220
|
});
|
221
|
|
222
|
|
223
|
setControl(composite);
|
224
|
}
|
225
|
|
226
|
public void saveConfigToPrefernceStore() {
|
227
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
|
228
|
configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
229
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN,
|
230
|
configurator.isAddMediaAsMediaSpecimen());
|
231
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS,
|
232
|
configurator.isAllowReuseOtherClassifications());
|
233
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS,
|
234
|
configurator.isDeduplicateClassifications());
|
235
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES,
|
236
|
configurator.isDeduplicateReferences());
|
237
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS,
|
238
|
configurator.isGetSiblings());
|
239
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP,
|
240
|
configurator.isIgnoreAuthorship());
|
241
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN,
|
242
|
configurator.isIgnoreImportOfExistingSpecimen());
|
243
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER,
|
244
|
configurator.isMapUnitIdToAccessionNumber());
|
245
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE,
|
246
|
configurator.isMapUnitIdToBarcode());
|
247
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER,
|
248
|
configurator.isMapUnitIdToCatalogNumber());
|
249
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION,
|
250
|
configurator.isMoveNewTaxaToDefaultClassification());
|
251
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN,
|
252
|
configurator.isOverwriteExistingSpecimens());
|
253
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS,
|
254
|
configurator.isReuseExistingDescriptiveGroups());
|
255
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA,
|
256
|
configurator.isReuseExistingMetaData());
|
257
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
|
258
|
configurator.isReuseExistingTaxaWhenPossible());
|
259
|
|
260
|
}
|
261
|
|
262
|
public String createConfigString(){
|
263
|
return configurator.toString();
|
264
|
|
265
|
}
|
266
|
|
267
|
public void setConfigurator(Abcd206ImportConfigurator configurator) {
|
268
|
this.configurator = configurator;
|
269
|
}
|
270
|
|
271
|
protected IPreferenceStore doGetPreferenceStore() {
|
272
|
return PreferencesUtil.getPreferenceStore();
|
273
|
}
|
274
|
}
|