Project

General

Profile

« Previous | Next » 

Revision da948591

Added by Katja Luther almost 7 years ago

add abcd import configuration to preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java
13 13
import java.util.ArrayList;
14 14
import java.util.List;
15 15

  
16
import org.eclipse.jface.wizard.WizardPage;
16
import org.eclipse.jface.preference.IPreferenceStore;
17 17
import org.eclipse.swt.SWT;
18 18
import org.eclipse.swt.events.SelectionAdapter;
19 19
import org.eclipse.swt.events.SelectionEvent;
......
22 22
import org.eclipse.swt.widgets.Composite;
23 23

  
24 24
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
25
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.ListComponent;
25
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.AbstractPreferenceWizard;
26
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
27
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
26 28

  
27 29
/**
28 30
 *
29 31
 * @author pplitzner
30 32
 *
31 33
 */
32
public class AbcdImportConfiguratorWizardPage extends WizardPage {
34
public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard {
33 35

  
34 36
	public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage";
35 37

  
......
70 72
	@Override
71 73
    public void createControl(Composite parent) {
72 74
		final Composite composite = new Composite(parent, SWT.NULL);
73

  
75
		//composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
74 76
		GridLayout gridLayout = new GridLayout();
75 77
		composite.setLayout(gridLayout);
76
        if (isPreferencePage){
77
            ListComponent list = new ListComponent(composite, composite.getStyle());
78
        }
78
//        if (isPreferencePage){
79
//            ListComponent list = new ListComponent(composite, composite.getStyle());
80
//        }
79 81

  
80 82
		Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
81 83
		checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
......
126 128
				configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
127 129
			}
128 130
		});
129

  
131
//TODO: only one of the mappings can be checked!
130 132
		Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
131 133
		checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
132 134
		checkBoxMapUnitIdToAccessionNumber.setText("Map UnitID to accession number");
......
176 178
		checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
177 179
			@Override
178 180
			public void widgetSelected(SelectionEvent e) {
179
				configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
181
				configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
180 182
			}
181 183
		});
182 184

  
185
		Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
186
		checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
187
		checkBoxImportSiblings.setText("Import all children of cultures or tissue samples");
188
		checkBoxImportSiblings
189
        .setToolTipText("for a tissue sample or culture all children will be searched and imported");
190
		checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
191
            @Override
192
            public void widgetSelected(SelectionEvent e) {
193
                configurator.setGetSiblings(!configurator.isGetSiblings());
194
            }
195
        });
196

  
197
        Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
198
        checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
199
        checkBoxAddIndividualsAssociations.setText("Create an Individual Association for each Specimen");
200
        checkBoxAddIndividualsAssociations
201
        .setToolTipText("for each specimen associated to a taxon an indiviadual association to this taxon is created");
202
        checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
203
            @Override
204
            public void widgetSelected(SelectionEvent e) {
205
                configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
206
            }
207
        });
208

  
209
        Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
210
        checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
211
        checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group");
212
        checkBoxReuseDescriptiveGroups
213
        .setToolTipText("reuse one of the existing descriptive groups or create a new one for every import");
214
        checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
215
            @Override
216
            public void widgetSelected(SelectionEvent e) {
217
                configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
218
            }
219
        });
220

  
221
        Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
222
        checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
223
        checkBoxReuseExistingTaxa.setText("Reuse existing taxa when possible");
224
        checkBoxReuseExistingTaxa
225
        .setToolTipText("reuse existing taxa when the name matches the identified name of the specimen");
226
        checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
227
            @Override
228
            public void widgetSelected(SelectionEvent e) {
229
                configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
230
            }
231
        });
232

  
233

  
183 234
		setControl(composite);
184 235
	}
185 236

  
237
	 public void saveConfigToPrefernceStore() {
238
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
239
	                configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
240
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN,
241
                    configurator.isAddMediaAsMediaSpecimen());
242
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS,
243
                    configurator.isAllowReuseOtherClassifications());
244
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS,
245
                    configurator.isDeduplicateClassifications());
246
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES,
247
                    configurator.isDeduplicateReferences());
248
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS,
249
                    configurator.isGetSiblings());
250
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP,
251
                    configurator.isIgnoreAuthorship());
252
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN,
253
                    configurator.isIgnoreImportOfExistingSpecimen());
254
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER,
255
                    configurator.isMapUnitIdToAccessionNumber());
256
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE,
257
                    configurator.isMapUnitIdToBarcode());
258
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER,
259
                    configurator.isMapUnitIdToCatalogNumber());
260
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION,
261
                    configurator.isMoveNewTaxaToDefaultClassification());
262
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN,
263
                    configurator.isOverwriteExistingSpecimens());
264
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS,
265
                    configurator.isReuseExistingDescriptiveGroups());
266
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA,
267
                    configurator.isReuseExistingMetaData());
268
	        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
269
                    configurator.isReuseExistingTaxaWhenPossible());
270

  
271
	    }
272

  
273
	 public String createConfigString(){
274
	    return configurator.toString();
275

  
276
	 }
277

  
278
	 protected IPreferenceStore doGetPreferenceStore() {
279
	        return PreferencesUtil.getPreferenceStore();
280
	    }
186 281
}

Also available in: Unified diff