1
|
/**
|
2
|
* Copyright (C) 2018 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
|
package eu.etaxonomy.taxeditor.preference;
|
10
|
|
11
|
import java.net.URI;
|
12
|
|
13
|
import org.eclipse.jface.layout.GridLayoutFactory;
|
14
|
import org.eclipse.swt.SWT;
|
15
|
import org.eclipse.swt.custom.CLabel;
|
16
|
import org.eclipse.swt.events.SelectionAdapter;
|
17
|
import org.eclipse.swt.events.SelectionEvent;
|
18
|
import org.eclipse.swt.events.SelectionListener;
|
19
|
import org.eclipse.swt.layout.GridData;
|
20
|
import org.eclipse.swt.layout.GridLayout;
|
21
|
import org.eclipse.swt.widgets.Button;
|
22
|
import org.eclipse.swt.widgets.Combo;
|
23
|
import org.eclipse.swt.widgets.Composite;
|
24
|
import org.eclipse.swt.widgets.Control;
|
25
|
import org.eclipse.swt.widgets.Label;
|
26
|
|
27
|
import eu.etaxonomy.cdm.api.application.ICdmRepository;
|
28
|
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
|
29
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
30
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
|
31
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
32
|
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
|
33
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
34
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
35
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
36
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
37
|
|
38
|
/**
|
39
|
* @author k.luther
|
40
|
* @since 23.03.2018
|
41
|
*
|
42
|
*/
|
43
|
public class AbcdImportPreference extends CdmPreferencePage implements IE4PreferencePage, SelectionListener {
|
44
|
|
45
|
/**
|
46
|
*
|
47
|
*/
|
48
|
private static final String CATALOGUE_NUMBER = "Catalogue number";
|
49
|
|
50
|
/**
|
51
|
*
|
52
|
*/
|
53
|
private static final String BARCODE = "Barcode";
|
54
|
|
55
|
/**
|
56
|
*
|
57
|
*/
|
58
|
private static final String ACCESSION_NUMBER = "Accession number";
|
59
|
|
60
|
protected Abcd206ImportConfigurator configurator;
|
61
|
|
62
|
protected Combo nomenclaturalCodeSelectionCombo;
|
63
|
|
64
|
protected boolean allowOverride = true;
|
65
|
protected boolean override = true;
|
66
|
protected CdmPreference preference = null;
|
67
|
Combo textDNAProviderString;
|
68
|
private Composite composite;
|
69
|
|
70
|
|
71
|
Button checkBoxMediaSpecimen;
|
72
|
Button checkBoxIgnoreExisting;
|
73
|
Button checkBoxIgnoreAuthorship;
|
74
|
Combo checkBoxMapUnitId;
|
75
|
// Button checkBoxMapUnitIdToAccessionNumber;
|
76
|
// Button checkBoxMapUnitIdToBarcode;
|
77
|
Button checkBoxRemoveCountry;
|
78
|
Button checkBoxMoveToDefaultClassification;
|
79
|
Button checkBoxImportSiblings;
|
80
|
Button checkBoxAddIndividualsAssociations;
|
81
|
Button checkBoxReuseDescriptiveGroups;
|
82
|
Button checkBoxReuseExistingTaxa;
|
83
|
|
84
|
|
85
|
Combo useLocalOrAdmin;
|
86
|
|
87
|
@Override
|
88
|
protected Control createContents(Composite parent) {
|
89
|
getValues();
|
90
|
|
91
|
if (!isAdminPreference && !allowOverride){
|
92
|
Label label = new Label(parent, SWT.NONE);
|
93
|
label.setText("The CDM settings don't allow to set the abcd import preference locally. If you need to make local settings, please ask an administrator.");
|
94
|
this.noDefaultAndApplyButton();
|
95
|
return parent;
|
96
|
}
|
97
|
composite = new Composite(parent, SWT.NULL);
|
98
|
GridLayout gridLayout = new GridLayout();
|
99
|
composite.setLayout(gridLayout);
|
100
|
|
101
|
final CLabel description = new CLabel(composite, SWT.NULL);
|
102
|
description.setText(Messages.AbcdImportPreference_description);
|
103
|
checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
|
104
|
checkBoxMediaSpecimen.setText(Messages.AbcdImportPreference_media_as_mediaSpecimen);
|
105
|
checkBoxMediaSpecimen
|
106
|
.setToolTipText(Messages.AbcdImportPreference_media_as_subUnit);
|
107
|
checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
|
108
|
@Override
|
109
|
public void widgetSelected(SelectionEvent e) {
|
110
|
configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
|
111
|
setApply(true);
|
112
|
}
|
113
|
});
|
114
|
|
115
|
checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
|
116
|
|
117
|
checkBoxIgnoreExisting.setText(Messages.AbcdImportPreference_not_import_existing_specimen);
|
118
|
checkBoxIgnoreExisting
|
119
|
.setToolTipText(Messages.AbcdImportPreference_not_import_existing_specimen_tooltip);
|
120
|
checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
|
121
|
@Override
|
122
|
public void widgetSelected(SelectionEvent e) {
|
123
|
configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
|
124
|
setApply(true);
|
125
|
}
|
126
|
});
|
127
|
|
128
|
checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
|
129
|
|
130
|
checkBoxIgnoreAuthorship.setText(Messages.AbcdImportPreference_ignore_author);
|
131
|
checkBoxIgnoreAuthorship
|
132
|
.setToolTipText(Messages.AbcdImportPreference_ignore_author_tooltip);
|
133
|
checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
|
134
|
@Override
|
135
|
public void widgetSelected(SelectionEvent e) {
|
136
|
configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
|
137
|
setApply(true);
|
138
|
}
|
139
|
});
|
140
|
|
141
|
|
142
|
GridData gridData = new GridData();
|
143
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
144
|
gridData.horizontalIndent = 9;
|
145
|
gridData.minimumWidth=100;
|
146
|
// classificationSelection.setLayoutData(gridData);
|
147
|
Label unitIdLabel = new Label(composite, SWT.NONE);
|
148
|
unitIdLabel.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
|
149
|
checkBoxMapUnitId = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
|
150
|
checkBoxMapUnitId.setLayoutData(gridData);
|
151
|
checkBoxMapUnitId.add(ACCESSION_NUMBER);
|
152
|
checkBoxMapUnitId.add(BARCODE);
|
153
|
checkBoxMapUnitId.add(CATALOGUE_NUMBER);
|
154
|
checkBoxMapUnitId
|
155
|
.setToolTipText(Messages.AbcdImportPreference_map_unit_number_catalog_number_tooltip);
|
156
|
checkBoxMapUnitId.addSelectionListener(this);
|
157
|
|
158
|
checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
|
159
|
|
160
|
checkBoxRemoveCountry.setText(Messages.AbcdImportPreference_remove_country_from_locality);
|
161
|
checkBoxRemoveCountry
|
162
|
.setToolTipText(Messages.AbcdImportPreference_remove_country_from_locality_tooltip);
|
163
|
checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
|
164
|
@Override
|
165
|
public void widgetSelected(SelectionEvent e) {
|
166
|
configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
|
167
|
setApply(true);
|
168
|
}
|
169
|
});
|
170
|
|
171
|
checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
|
172
|
checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
|
173
|
checkBoxMoveToDefaultClassification.setText(Messages.AbcdImportPreference_create_new_classification_new_taxa);
|
174
|
checkBoxMoveToDefaultClassification
|
175
|
.setToolTipText(Messages.AbcdImportPreference_create_new_classification_new_taxa_tooltip);
|
176
|
checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
|
177
|
@Override
|
178
|
public void widgetSelected(SelectionEvent e) {
|
179
|
configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
|
180
|
setApply(true);
|
181
|
}
|
182
|
});
|
183
|
|
184
|
checkBoxImportSiblings = new Button(composite, SWT.CHECK);
|
185
|
|
186
|
checkBoxImportSiblings.setText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues);
|
187
|
checkBoxImportSiblings
|
188
|
.setToolTipText(Messages.AbcdImportPreference_import_all_children_for_cultures_or_tissues_tooltip);
|
189
|
checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
|
190
|
@Override
|
191
|
public void widgetSelected(SelectionEvent e) {
|
192
|
configurator.setGetSiblings(!configurator.isGetSiblings());
|
193
|
setApply(true);
|
194
|
}
|
195
|
});
|
196
|
|
197
|
checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
|
198
|
|
199
|
checkBoxAddIndividualsAssociations.setText(Messages.AbcdImportPreference_create_Individual_Association);
|
200
|
checkBoxAddIndividualsAssociations
|
201
|
.setToolTipText(Messages.AbcdImportPreference_create_Individual_Association_tooltip);
|
202
|
checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
|
203
|
@Override
|
204
|
public void widgetSelected(SelectionEvent e) {
|
205
|
configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
206
|
setApply(true);
|
207
|
}
|
208
|
});
|
209
|
|
210
|
checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
|
211
|
|
212
|
checkBoxReuseDescriptiveGroups.setText(Messages.AbcdImportPreference_reuse_descriptive_group);
|
213
|
checkBoxReuseDescriptiveGroups
|
214
|
.setToolTipText(Messages.AbcdImportPreference_reuse_descriptive_group_tooltip);
|
215
|
checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
|
216
|
@Override
|
217
|
public void widgetSelected(SelectionEvent e) {
|
218
|
configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
|
219
|
setApply(true);
|
220
|
}
|
221
|
});
|
222
|
|
223
|
checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
|
224
|
|
225
|
checkBoxReuseExistingTaxa.setText(Messages.AbcdImportPreference_reuse_existing_taxa);
|
226
|
checkBoxReuseExistingTaxa
|
227
|
.setToolTipText(Messages.AbcdImportPreference_reuse_existing_taxa_tooltip);
|
228
|
checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
|
229
|
@Override
|
230
|
public void widgetSelected(SelectionEvent e) {
|
231
|
configurator.setReuseExistingTaxaWhenPossible(!configurator.isReuseExistingTaxaWhenPossible());
|
232
|
setApply(true);
|
233
|
}
|
234
|
});
|
235
|
GridData sepGrid = createTextGridData();
|
236
|
Label separator = new Label(composite, SWT.HORIZONTAL|SWT.SEPARATOR);
|
237
|
separator.setLayoutData(sepGrid);
|
238
|
separator.setVisible(false);
|
239
|
Label labelRef = new Label(composite, SWT.NONE);
|
240
|
labelRef.setText("Biocase provider for associated DNA");
|
241
|
textDNAProviderString = new Combo(composite, SWT.BORDER);
|
242
|
|
243
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
244
|
gridData.horizontalIndent = 9;
|
245
|
gridData.minimumWidth=200;
|
246
|
|
247
|
textDNAProviderString.setLayoutData(gridData);
|
248
|
GridLayoutFactory.fillDefaults();
|
249
|
String biocaseProvider = null;
|
250
|
CdmPreference pref = null;
|
251
|
|
252
|
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.BioCaseProvider);
|
253
|
biocaseProvider = pref!= null? pref.getValue():null;
|
254
|
|
255
|
if (!isAdminPreference && ((pref != null && pref.isAllowOverride()) || pref == null) ){
|
256
|
biocaseProvider = PreferencesUtil.getStringValue(PreferencePredicate.BioCaseProvider.getKey(), true);
|
257
|
}
|
258
|
if (biocaseProvider != null){
|
259
|
String items[] = biocaseProvider.split(";");
|
260
|
textDNAProviderString.setItems(items);
|
261
|
}
|
262
|
|
263
|
textDNAProviderString.setEnabled(true);
|
264
|
// textDNAProviderString.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
|
265
|
textDNAProviderString.addSelectionListener(this);
|
266
|
|
267
|
Label nomenclaturalCodeLabel = new Label(composite, SWT.NONE);
|
268
|
nomenclaturalCodeLabel.setText("Nomenclatural Code");
|
269
|
nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
|
270
|
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
271
|
gridData.horizontalIndent = 9;
|
272
|
nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
|
273
|
GridLayoutFactory.fillDefaults();
|
274
|
for(NomenclaturalCode code: NomenclaturalCode.values()){
|
275
|
nomenclaturalCodeSelectionCombo.add(code.getKey());
|
276
|
}
|
277
|
|
278
|
nomenclaturalCodeSelectionCombo.addSelectionListener(this);
|
279
|
if (preference != null){
|
280
|
allowOverride = preference.isAllowOverride();
|
281
|
}
|
282
|
|
283
|
Label sep = new Label(composite, SWT.HORIZONTAL|SWT.SEPARATOR);
|
284
|
sep.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false));
|
285
|
GridLayoutFactory.fillDefaults();
|
286
|
useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
|
287
|
if (!isAdminPreference){
|
288
|
useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
|
289
|
useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
|
290
|
|
291
|
}else{
|
292
|
useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
|
293
|
useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
|
294
|
}
|
295
|
|
296
|
if (!isAdminPreference){
|
297
|
if (override && allowOverride){
|
298
|
useLocalOrAdmin.select(1);
|
299
|
}else{
|
300
|
useLocalOrAdmin.select(0);
|
301
|
composite.setEnabled(false);
|
302
|
}
|
303
|
}else{
|
304
|
if (allowOverride){
|
305
|
useLocalOrAdmin.select(0);
|
306
|
}else{
|
307
|
useLocalOrAdmin.select(1);
|
308
|
}
|
309
|
}
|
310
|
useLocalOrAdmin.addSelectionListener(this);
|
311
|
if (!allowOverride && !isAdminPreference){
|
312
|
useLocalOrAdmin.setEnabled(false);
|
313
|
}
|
314
|
GridData gridDataLocal = new GridData();
|
315
|
gridDataLocal = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
|
316
|
// gridDataLocal.horizontalIndent = 9;
|
317
|
gridDataLocal.minimumWidth=100;
|
318
|
gridDataLocal.widthHint= nomenclaturalCodeSelectionCombo.getBorderWidth();
|
319
|
useLocalOrAdmin.setLayoutData(gridDataLocal);
|
320
|
GridLayoutFactory.fillDefaults();
|
321
|
setSelections();
|
322
|
|
323
|
return composite;
|
324
|
}
|
325
|
|
326
|
@Override
|
327
|
public void widgetSelected(SelectionEvent e) {
|
328
|
if (e.getSource().equals(nomenclaturalCodeSelectionCombo)){
|
329
|
this.configurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
|
330
|
}
|
331
|
if (e.getSource().equals(checkBoxMapUnitId)){
|
332
|
String text = checkBoxMapUnitId.getText();
|
333
|
if (text.equals(ACCESSION_NUMBER)){
|
334
|
this.configurator.setMapUnitIdToAccessionNumber(true);
|
335
|
this.configurator.setMapUnitIdToBarcode(false);
|
336
|
this.configurator.setMapUnitIdToCatalogNumber(false);
|
337
|
}else if (text.equals(BARCODE)){
|
338
|
this.configurator.setMapUnitIdToAccessionNumber(false);
|
339
|
this.configurator.setMapUnitIdToBarcode(true);
|
340
|
this.configurator.setMapUnitIdToCatalogNumber(false);
|
341
|
}else{
|
342
|
this.configurator.setMapUnitIdToAccessionNumber(false);
|
343
|
this.configurator.setMapUnitIdToBarcode(false);
|
344
|
this.configurator.setMapUnitIdToCatalogNumber(true);
|
345
|
}
|
346
|
}
|
347
|
if (e.getSource().equals(useLocalOrAdmin)){
|
348
|
if (useLocalOrAdmin.getText().equals(LocalOrDefaultEnum.Default.getLabel()) || useLocalOrAdmin.getText().equals(LocalOrDefaultEnum.Database.getLabel())){
|
349
|
composite.setEnabled(false);
|
350
|
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(configurator, preference.getValue());
|
351
|
setSelections();
|
352
|
|
353
|
if (isAdminPreference){
|
354
|
allowOverride = false;
|
355
|
}else{
|
356
|
override = false;
|
357
|
}
|
358
|
}else{
|
359
|
composite.setEnabled(true);
|
360
|
if (isAdminPreference){
|
361
|
allowOverride = true;
|
362
|
}else{
|
363
|
override = true;
|
364
|
}
|
365
|
}
|
366
|
}
|
367
|
|
368
|
if (e.getSource().equals(textDNAProviderString)){
|
369
|
String textDnaProvider = textDNAProviderString.getText();
|
370
|
try{
|
371
|
this.configurator.setDnaSoure(URI.create(textDnaProvider));
|
372
|
}catch(IllegalArgumentException iae){
|
373
|
//do not set as dna source
|
374
|
}
|
375
|
}
|
376
|
this.setApply(true);
|
377
|
|
378
|
|
379
|
// PreferencesUtil.recursiveSetEnabled(composite, override);
|
380
|
setApply(true);
|
381
|
|
382
|
}
|
383
|
|
384
|
@Override
|
385
|
public boolean performOk() {
|
386
|
if (!isApply()){
|
387
|
return true;
|
388
|
}
|
389
|
if (configurator != null){
|
390
|
try{
|
391
|
configurator.setDnaSoure(URI.create(textDNAProviderString.getText()));
|
392
|
}catch(IllegalArgumentException e){
|
393
|
//dna provider is not an uri
|
394
|
}
|
395
|
String configString = configurator.toString();
|
396
|
|
397
|
|
398
|
if (override){
|
399
|
PreferencesUtil.setStringValue(PreferencePredicate.AbcdImportConfig.getKey(), configString);
|
400
|
PreferencesUtil.setBooleanValue( PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), override);
|
401
|
|
402
|
}else{
|
403
|
PreferencesUtil.setBooleanValue( PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), override);
|
404
|
}
|
405
|
PreferencesUtil.setStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, "");
|
406
|
|
407
|
|
408
|
}
|
409
|
return true;
|
410
|
}
|
411
|
|
412
|
/**
|
413
|
* {@inheritDoc}
|
414
|
*/
|
415
|
@Override
|
416
|
public void widgetDefaultSelected(SelectionEvent e) {
|
417
|
// TODO Auto-generated method stub
|
418
|
|
419
|
}
|
420
|
|
421
|
@Override
|
422
|
protected void performDefaults() {
|
423
|
configurator = Abcd206ImportConfigurator.NewInstance(null,null);
|
424
|
configurator.setNomenclaturalCode(PreferencesUtil.getPreferredNomenclaturalCode());
|
425
|
override = false;
|
426
|
setSelections();
|
427
|
setApply(true);
|
428
|
}
|
429
|
|
430
|
@Override
|
431
|
public void getValues() {
|
432
|
isAdminPreference = false;
|
433
|
configurator = Abcd206ImportConfigurator.NewInstance(null,null);
|
434
|
ICdmRepository controller;
|
435
|
controller = CdmStore.getCurrentApplicationConfiguration();
|
436
|
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AbcdImportConfig);
|
437
|
preference = controller.getPreferenceService().find(key);
|
438
|
|
439
|
if (preference != null ){
|
440
|
allowOverride = preference.isAllowOverride();
|
441
|
}else{
|
442
|
preference = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AbcdImportConfig, configurator.toString());
|
443
|
}
|
444
|
|
445
|
override = PreferencesUtil.getBooleanValue(
|
446
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), true) != null? PreferencesUtil.getBooleanValue(
|
447
|
PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), true):false;
|
448
|
if (allowOverride && override){
|
449
|
String configString = PreferencesUtil.getStringValue(PreferencePredicate.AbcdImportConfig.getKey(), true);
|
450
|
configurator = Abcd206ImportConfigurator.NewInstance(null, null);
|
451
|
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(configurator, configString);
|
452
|
}else{
|
453
|
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(configurator, preference.getValue());
|
454
|
}
|
455
|
}
|
456
|
|
457
|
protected void setSelections(){
|
458
|
checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
|
459
|
checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
|
460
|
checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
|
461
|
if (configurator.isMapUnitIdToAccessionNumber()){
|
462
|
checkBoxMapUnitId.select(0);
|
463
|
}else if (configurator.isMapUnitIdToBarcode()){
|
464
|
checkBoxMapUnitId.select(1);
|
465
|
}else{
|
466
|
checkBoxMapUnitId.select(2);
|
467
|
}
|
468
|
|
469
|
|
470
|
checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
|
471
|
checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
|
472
|
checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
|
473
|
checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
|
474
|
checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
|
475
|
|
476
|
textDNAProviderString.setText(configurator.getDnaSoure()!= null? configurator.getDnaSoure().toString():"");
|
477
|
int index = 0;
|
478
|
if (configurator.getNomenclaturalCode() != null){
|
479
|
for (String label : nomenclaturalCodeSelectionCombo.getItems()){
|
480
|
if (label.equals(configurator.getNomenclaturalCode().getKey())){
|
481
|
nomenclaturalCodeSelectionCombo.select(index);
|
482
|
}
|
483
|
index++;
|
484
|
}
|
485
|
}else{
|
486
|
for (String label : nomenclaturalCodeSelectionCombo.getItems()){
|
487
|
NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode();
|
488
|
if (label.equals(code.getKey())){
|
489
|
nomenclaturalCodeSelectionCombo.select(index);
|
490
|
configurator.setNomenclaturalCode(code);
|
491
|
}
|
492
|
index++;
|
493
|
}
|
494
|
|
495
|
}
|
496
|
|
497
|
}
|
498
|
|
499
|
}
|