2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.io
.e4
.in
.abcd
;
12 import javax
.inject
.Inject
;
14 import org
.eclipse
.jface
.wizard
.WizardPage
;
15 import org
.eclipse
.swt
.SWT
;
16 import org
.eclipse
.swt
.events
.SelectionAdapter
;
17 import org
.eclipse
.swt
.events
.SelectionEvent
;
18 import org
.eclipse
.swt
.layout
.GridData
;
19 import org
.eclipse
.swt
.layout
.GridLayout
;
20 import org
.eclipse
.swt
.widgets
.Button
;
21 import org
.eclipse
.swt
.widgets
.Composite
;
22 import org
.eclipse
.swt
.widgets
.Label
;
23 import org
.eclipse
.swt
.widgets
.Text
;
25 import eu
.etaxonomy
.cdm
.io
.specimen
.abcd206
.in
.Abcd206ImportConfigurator
;
26 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
27 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
34 public class AbcdImportConfiguratorWizardPageE4
extends WizardPage
{
36 public static final String PAGE_NAME
= "AbcdImportConfiguratorWizardPage";
38 private Abcd206ImportConfigurator configurator
;
39 Text textDNAProviderString
;
42 public AbcdImportConfiguratorWizardPageE4() {
44 setTitle("Configure import parameters");
45 setDescription("Tooltips will explain parameters in more detail");
50 public void createControl(Composite parent
) {
51 final Composite composite
= new Composite(parent
, SWT
.NULL
);
52 //composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
53 GridLayout gridLayout
= new GridLayout();
54 composite
.setLayout(gridLayout
);
56 Button checkBoxMediaSpecimen
= new Button(composite
, SWT
.CHECK
);
57 checkBoxMediaSpecimen
.setSelection(configurator
.isAddMediaAsMediaSpecimen());
58 checkBoxMediaSpecimen
.setText("Import media as media specimen");
60 .setToolTipText("Any media attached to a ABCD unit will be imported as a sub derivative of the specimen created from this unit");
61 checkBoxMediaSpecimen
.addSelectionListener(new SelectionAdapter() {
63 public void widgetSelected(SelectionEvent e
) {
64 configurator
.setAddMediaAsMediaSpecimen(!configurator
.isAddMediaAsMediaSpecimen());
68 Button checkBoxIgnoreExisting
= new Button(composite
, SWT
.CHECK
);
69 checkBoxIgnoreExisting
.setSelection(configurator
.isIgnoreImportOfExistingSpecimen());
70 checkBoxIgnoreExisting
.setText("Do not import existing specimens");
71 checkBoxIgnoreExisting
72 .setToolTipText("Specimens that have previously been imported will be ignored in this import");
73 checkBoxIgnoreExisting
.addSelectionListener(new SelectionAdapter() {
75 public void widgetSelected(SelectionEvent e
) {
76 configurator
.setIgnoreImportOfExistingSpecimen(!configurator
.isIgnoreImportOfExistingSpecimen());
80 Button checkBoxIgnoreAuthorship
= new Button(composite
, SWT
.CHECK
);
81 checkBoxIgnoreAuthorship
.setSelection(configurator
.isIgnoreAuthorship());
82 checkBoxIgnoreAuthorship
.setText("Ignore Authorship for name matching");
83 checkBoxIgnoreAuthorship
84 .setToolTipText("Name matching with existing names will be done without "
85 + "the authorship part of the name");
86 checkBoxIgnoreAuthorship
.addSelectionListener(new SelectionAdapter() {
88 public void widgetSelected(SelectionEvent e
) {
89 configurator
.setIgnoreAuthorship(!configurator
.isIgnoreAuthorship());
93 Button checkBoxMapUnitIdToCatalogNumber
= new Button(composite
, SWT
.CHECK
);
94 checkBoxMapUnitIdToCatalogNumber
.setSelection(configurator
.isMapUnitIdToCatalogNumber());
95 checkBoxMapUnitIdToCatalogNumber
.setText("Map UnitID to catalog number");
96 checkBoxMapUnitIdToCatalogNumber
97 .setToolTipText("The UnitID of every ABCD unit will be mapped the catalog number "
99 checkBoxMapUnitIdToCatalogNumber
.addSelectionListener(new SelectionAdapter() {
101 public void widgetSelected(SelectionEvent e
) {
102 configurator
.setMapUnitIdToCatalogNumber(!configurator
.isMapUnitIdToCatalogNumber());
105 //TODO: only one of the mappings can be checked!
106 Button checkBoxMapUnitIdToAccessionNumber
= new Button(composite
, SWT
.CHECK
);
107 checkBoxMapUnitIdToAccessionNumber
.setSelection(configurator
.isMapUnitIdToAccessionNumber());
108 checkBoxMapUnitIdToAccessionNumber
.setText("Map UnitID to accession number");
109 checkBoxMapUnitIdToAccessionNumber
110 .setToolTipText("The UnitID of every ABCD unit will be mapped the accession number "
111 + "of the specimen");
112 checkBoxMapUnitIdToAccessionNumber
.addSelectionListener(new SelectionAdapter() {
114 public void widgetSelected(SelectionEvent e
) {
115 configurator
.setMapUnitIdToAccessionNumber(!configurator
.isMapUnitIdToAccessionNumber());
119 Button checkBoxMapUnitIdToBarcode
= new Button(composite
, SWT
.CHECK
);
120 checkBoxMapUnitIdToBarcode
.setSelection(configurator
.isMapUnitIdToBarcode());
121 checkBoxMapUnitIdToBarcode
.setText("Map UnitID to barcode");
122 checkBoxMapUnitIdToBarcode
123 .setToolTipText("The UnitID of every ABCD unit will be mapped the barcode "
124 + "of the specimen");
125 checkBoxMapUnitIdToBarcode
.addSelectionListener(new SelectionAdapter() {
127 public void widgetSelected(SelectionEvent e
) {
128 configurator
.setMapUnitIdToBarcode(!configurator
.isMapUnitIdToBarcode());
132 Button checkBoxRemoveCountry
= new Button(composite
, SWT
.CHECK
);
133 checkBoxRemoveCountry
.setSelection(configurator
.isRemoveCountryFromLocalityText());
134 checkBoxRemoveCountry
.setText("Remove country from locality text");
135 checkBoxRemoveCountry
136 .setToolTipText("If the locality text contains information about the "
137 + "country which is additionally stored in other ABCD "
138 + "elements then it is removed from the locality text");
139 checkBoxRemoveCountry
.addSelectionListener(new SelectionAdapter() {
141 public void widgetSelected(SelectionEvent e
) {
142 configurator
.setRemoveCountryFromLocalityText(!configurator
.isRemoveCountryFromLocalityText());
146 Button checkBoxMoveToDefaultClassification
= new Button(composite
, SWT
.CHECK
);
147 checkBoxMoveToDefaultClassification
.setSelection(configurator
.isMoveNewTaxaToDefaultClassification());
148 checkBoxMoveToDefaultClassification
.setText("Create new classification for new taxa");
149 checkBoxMoveToDefaultClassification
150 .setToolTipText("For taxa that do not exist in the data base "
151 + "a new classification will be created");
152 checkBoxMoveToDefaultClassification
.addSelectionListener(new SelectionAdapter() {
154 public void widgetSelected(SelectionEvent e
) {
155 configurator
.setMoveNewTaxaToDefaultClassification(!configurator
.isMoveNewTaxaToDefaultClassification());
159 Button checkBoxImportSiblings
= new Button(composite
, SWT
.CHECK
);
160 checkBoxImportSiblings
.setSelection(configurator
.isGetSiblings());
161 checkBoxImportSiblings
.setText("Import all children of cultures or tissue samples");
162 checkBoxImportSiblings
163 .setToolTipText("For a tissue sample or culture all children will be searched and imported");
164 checkBoxImportSiblings
.addSelectionListener(new SelectionAdapter() {
166 public void widgetSelected(SelectionEvent e
) {
167 configurator
.setGetSiblings(checkBoxImportSiblings
.getSelection());
171 Button checkBoxAddIndividualsAssociations
= new Button(composite
, SWT
.CHECK
);
172 checkBoxAddIndividualsAssociations
.setSelection(configurator
.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
173 checkBoxAddIndividualsAssociations
.setText("Create an Individual Association for each Specimen");
174 checkBoxAddIndividualsAssociations
175 .setToolTipText("For each specimen associated to a taxon an indiviadual association to this taxon is created");
176 checkBoxAddIndividualsAssociations
.addSelectionListener(new SelectionAdapter() {
178 public void widgetSelected(SelectionEvent e
) {
179 configurator
.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator
.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
183 Button checkBoxReuseDescriptiveGroups
= new Button(composite
, SWT
.CHECK
);
184 checkBoxReuseDescriptiveGroups
.setSelection(configurator
.isReuseExistingDescriptiveGroups());
185 checkBoxReuseDescriptiveGroups
.setText("Reuse existing descriptive group");
186 checkBoxReuseDescriptiveGroups
187 .setToolTipText("Reuse one of the existing descriptive groups or create a new one for every import");
188 checkBoxReuseDescriptiveGroups
.addSelectionListener(new SelectionAdapter() {
190 public void widgetSelected(SelectionEvent e
) {
191 configurator
.setReuseExistingDescriptiveGroups(!configurator
.isReuseExistingDescriptiveGroups());
195 Button checkBoxReuseExistingTaxa
= new Button(composite
, SWT
.CHECK
);
196 checkBoxReuseExistingTaxa
.setSelection(configurator
.isReuseExistingTaxaWhenPossible());
197 checkBoxReuseExistingTaxa
.setText("Reuse existing taxa when possible");
198 checkBoxReuseExistingTaxa
199 .setToolTipText("Reuse existing taxa when the name matches the identified name of the specimen");
200 checkBoxReuseExistingTaxa
.addSelectionListener(new SelectionAdapter() {
202 public void widgetSelected(SelectionEvent e
) {
203 configurator
.setReuseExistingTaxaWhenPossible(!configurator
.isReuseExistingTaxaWhenPossible());
207 Label labelRef
= new Label(composite
, SWT
.NONE
);
208 labelRef
.setText("Biocase provider for associated DNA");
209 new Label(composite
, SWT
.NONE
);
210 textDNAProviderString
= new Text(composite
, SWT
.NONE
);
211 textDNAProviderString
.setEnabled(true);
212 textDNAProviderString
.setLayoutData(new GridData(SWT
.FILL
, SWT
.TOP
, true, true, 1, 1));
216 setControl(composite
);
219 public void saveConfigToPrefernceStore() {
220 PreferencesUtil
.setStringValue(PreferencePredicate
.AbcdImportConfig
.getKey(), configurator
.toString());
224 public String
createConfigString(){
225 return configurator
.toString();
229 public void setConfigurator(Abcd206ImportConfigurator configurator
) {
230 this.configurator
= configurator
;