From c92df786045f6bfb77a29d263786bafbde958a93 Mon Sep 17 00:00:00 2001 From: Patrick Plitzner Date: Mon, 26 Sep 2016 08:52:57 +0200 Subject: [PATCH 1/1] ref #3573 Add streamlined ABCD import configurator page --- .../AbcdImportConfiguratorWizardPage.java | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java new file mode 100644 index 000000000..039b36407 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java @@ -0,0 +1,163 @@ +// $Id$ +/** +* Copyright (C) 2007 EDIT +* European Distributed Institute of Taxonomy +* http://www.e-taxonomy.eu +* +* The contents of this file are subject to the Mozilla Public License Version 1.1 +* See LICENSE.TXT at the top of this package for the full license terms. +*/ + +package eu.etaxonomy.taxeditor.io.wizard; + +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + +import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; +import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportState; + +/** + * + * @author pplitzner + * + */ +public class AbcdImportConfiguratorWizardPage extends WizardPage { + + public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage"; + + private Abcd206ImportConfigurator configurator; + + protected AbcdImportConfiguratorWizardPage(String title, String description, Abcd206ImportConfigurator configurator) { + super(PAGE_NAME); + this.configurator = configurator; + setTitle(title); + setDescription(description); + } + + public static AbcdImportConfiguratorWizardPage createPage(Abcd206ImportConfigurator configurator){ + return new AbcdImportConfiguratorWizardPage("Configure import parameters", + "Tooltips will explain parameters in more detail", configurator); + } + + + + /** {@inheritDoc} */ + @Override + public void createControl(Composite parent) { + final Composite composite = new Composite(parent, SWT.NULL); + + GridLayout gridLayout = new GridLayout(); + composite.setLayout(gridLayout); + + Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK); + checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen()); + checkBoxMediaSpecimen.setText("Import media as media specimen"); + checkBoxMediaSpecimen + .setToolTipText("Any media attached to a ABCD unit will be imported as a sub derivative of the specimen created from this unit"); + checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen()); + } + }); + + Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK); + checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen()); + checkBoxIgnoreExisting.setText("Do not import existing specimens"); + checkBoxIgnoreExisting + .setToolTipText("Specimens that have previously been imported will be ignored in this import"); + checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen()); + } + }); + + Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK); + checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship()); + checkBoxIgnoreAuthorship.setText("Ignore Authorship for name matching"); + checkBoxIgnoreAuthorship + .setToolTipText("Name matching with existing names will be done without " + + "the authorship part of the name"); + checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship()); + } + }); + + Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK); + checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber()); + checkBoxMapUnitIdToCatalogNumber.setText("Map UnitID to catalog number"); + checkBoxMapUnitIdToCatalogNumber + .setToolTipText("The UnitID of every ABCD unit will be mapped the catalog number " + + "of the specimen"); + checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber()); + } + }); + + Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK); + checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber()); + checkBoxMapUnitIdToAccessionNumber.setText("Map UnitID to accession number"); + checkBoxMapUnitIdToAccessionNumber + .setToolTipText("The UnitID of every ABCD unit will be mapped the accession number " + + "of the specimen"); + checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber()); + } + }); + + Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK); + checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode()); + checkBoxMapUnitIdToBarcode.setText("Map UnitID to barcode"); + checkBoxMapUnitIdToBarcode + .setToolTipText("The UnitID of every ABCD unit will be mapped the barcode " + + "of the specimen"); + checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode()); + } + }); + + Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK); + checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText()); + checkBoxRemoveCountry.setText("Remove country from locality text"); + checkBoxRemoveCountry + .setToolTipText("If the locality text contains information about the " + + "country which is additionally stored in other ABCD " + + "elements then it is removed from the locality text"); + checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText()); + } + }); + + Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK); + checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification()); + checkBoxMoveToDefaultClassification.setText("Create new classification for new taxa"); + checkBoxMoveToDefaultClassification + .setToolTipText("For taxa that do not exist in the data base " + + "a new classification will be created"); + checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText()); + } + }); + + setControl(composite); + } + +} -- 2.34.1