ref #8769: structure the configuration elements
authorKatja Luther <k.luther@bgbm.org>
Tue, 24 Nov 2020 13:36:29 +0000 (14:36 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 24 Nov 2020 13:36:29 +0000 (14:36 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java

index c2a14df9bfba62317afa84c3985493b525283503..1b696f7b9a738cd120f918987101b63c59eb7421 100644 (file)
@@ -19,11 +19,14 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.wb.swt.ResourceManager;
@@ -104,12 +107,21 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
            Composite composite = new Composite(parent, SWT.NULL);
         GridLayout gridLayout = new GridLayout();
         gridLayout.numColumns=2;
-        //gridLayout.makeColumnsEqualWidth=true;
-        composite.setLayout(gridLayout);
+        Label labelnewlyCreatedTaxa = new Label(composite, SWT.NONE);
+        labelnewlyCreatedTaxa.setText("Newly Created Taxa");
+        Display display = Display.getDefault();
+        FontData data = display .getSystemFont().getFontData()[0];
+        Font font = new Font(display, data.getName(), data.getHeight(), SWT.BOLD);
+        labelnewlyCreatedTaxa.setFont(font);
         GridData gridData = new GridData();
         gridData.horizontalAlignment = GridData.FILL;
         gridData.grabExcessHorizontalSpace=true;
         gridData.horizontalSpan = 2;
+        labelnewlyCreatedTaxa.setLayoutData(gridData);
+
+        //gridLayout.makeColumnsEqualWidth=true;
+        composite.setLayout(gridLayout);
+
                Composite classificationComp = new Composite(composite, SWT.NULL);
                classificationComp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 2, 1));
                classificationComp.setLayout(new GridLayout(4, false));
@@ -151,31 +163,134 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
             }
         });
 
-//        Composite composite = new Composite(parent, SWT.NULL);
-//        GridLayout gridLayout = new GridLayout();
-//        gridLayout.numColumns=2;
-//        //gridLayout.makeColumnsEqualWidth=true;
-//        composite.setLayout(gridLayout);
-//             GridData gridData = new GridData();
-//             gridData.horizontalAlignment = GridData.FILL;
-//             gridData.grabExcessHorizontalSpace=true;
-//             gridData.horizontalSpan = 2;
-
-               Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
-
-               checkBoxMediaSpecimen.setSelection(abcdImportConfigurator.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) {
-                               abcdImportConfigurator.setAddMediaAsMediaSpecimen(!abcdImportConfigurator.isAddMediaAsMediaSpecimen());
-                       }
-               });
-               checkBoxMediaSpecimen.setLayoutData(gridData);
+        Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+        checkBoxMoveToDefaultClassification.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
+        checkBoxMoveToDefaultClassification.setSelection(abcdImportConfigurator.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) {
+                abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(!abcdImportConfigurator.isMoveNewTaxaToDefaultClassification());
+            }
+        });
+
+        Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+        checkBoxReuseExistingTaxa.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
+        checkBoxReuseExistingTaxa.setSelection(abcdImportConfigurator.isReuseExistingTaxaWhenPossible());
+        checkBoxReuseExistingTaxa.setText("Reuse existing taxa when possible");
+        checkBoxReuseExistingTaxa
+            .setToolTipText("Reuse existing taxa when the name matches the identified name of the specimen");
+        checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                abcdImportConfigurator.setReuseExistingDescriptiveGroups(!abcdImportConfigurator.isReuseExistingDescriptiveGroups());
+            }
+        });
+
+        Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+        checkBoxIgnoreAuthorship.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
+        checkBoxIgnoreAuthorship.setSelection(abcdImportConfigurator.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) {
+                abcdImportConfigurator.setIgnoreAuthorship(!abcdImportConfigurator.isIgnoreAuthorship());
+            }
+        });
+
+        Label labelCode = new Label(composite, SWT.NONE);
+        labelCode.setText("Nomenclatural Code");
+        gridData = new GridData();
+        gridData.horizontalAlignment=SWT.BEGINNING;
+
+        labelCode.setLayoutData(gridData);
         GridDataFactory.fillDefaults();
+        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
+        gridData = new GridData();
+        gridData.horizontalAlignment=SWT.BEGINNING;
+        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
+        for(NomenclaturalCode code: NomenclaturalCode.values()){
+            nomenclaturalCodeSelectionCombo.add(code.getKey());
+        }
+
+        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
+        int index = 0;
+        if (abcdImportConfigurator.getNomenclaturalCode() != null){
+            for (String label : nomenclaturalCodeSelectionCombo.getItems()){
+                if (label.equals(abcdImportConfigurator.getNomenclaturalCode().getKey())){
+                    nomenclaturalCodeSelectionCombo.select(index);
+                }
+                index++;
+            }
+        }
+
+        Label labelLinkToTaxon = new Label(composite, SWT.NONE);
+        labelLinkToTaxon.setText("Link to Taxon");
+        labelLinkToTaxon.setFont(font);
+
+        Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+        checkBoxAddIndividualsAssociations.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
+        checkBoxAddIndividualsAssociations.setSelection(abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+        checkBoxAddIndividualsAssociations.setText("Create an Individual Association for each Specimen");
+        checkBoxAddIndividualsAssociations
+            .setToolTipText("For each specimen associated to a taxon an indiviadual association to this taxon is created");
+        checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+            }
+        });
+
+        Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+        checkBoxReuseDescriptiveGroups.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
+        checkBoxReuseDescriptiveGroups.setSelection(abcdImportConfigurator.isReuseExistingDescriptiveGroups());
+        checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group");
+        checkBoxReuseDescriptiveGroups
+            .setToolTipText("Reuse one of the existing descriptive groups or create a new one for every import");
+        checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                abcdImportConfigurator.setReuseExistingDescriptiveGroups(!abcdImportConfigurator.isReuseExistingDescriptiveGroups());
+            }
+        });
+
 
+        Label labelSpecimen = new Label(composite, SWT.NONE);
+        labelSpecimen.setText("Specimen");
+        labelSpecimen.setFont(font);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL;
+        gridData.grabExcessHorizontalSpace=true;
+        gridData.horizontalSpan = 2;
+        labelSpecimen.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
                Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
                gridData = new GridData();
         gridData.horizontalAlignment = GridData.FILL;
@@ -196,25 +311,6 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
                checkBoxIgnoreExisting.setLayoutData(gridData);
         GridDataFactory.fillDefaults();
 
-               Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
-               gridData = new GridData();
-        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
-        gridData.horizontalSpan = 2;
-               checkBoxIgnoreAuthorship.setLayoutData(gridData);
-               GridDataFactory.fillDefaults();
-               checkBoxIgnoreAuthorship.setSelection(abcdImportConfigurator.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) {
-                               abcdImportConfigurator.setIgnoreAuthorship(!abcdImportConfigurator.isIgnoreAuthorship());
-                       }
-               });
-
-
                Label unitIdLabel = new Label(composite, SWT.NONE);
         unitIdLabel.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
 
@@ -264,23 +360,7 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
                        }
                });
 
-               Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
-               gridData = new GridData();
-        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
-        gridData.horizontalSpan = 2;
-               checkBoxMoveToDefaultClassification.setLayoutData(gridData);
-        GridDataFactory.fillDefaults();
-               checkBoxMoveToDefaultClassification.setSelection(abcdImportConfigurator.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) {
-                               abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(!abcdImportConfigurator.isMoveNewTaxaToDefaultClassification());
-                       }
-               });
+
 
                Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
                gridData = new GridData();
@@ -299,56 +379,8 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
             }
         });
 
-        Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
-        gridData = new GridData();
-        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
-        gridData.horizontalSpan = 2;
-        checkBoxAddIndividualsAssociations.setLayoutData(gridData);
-        GridDataFactory.fillDefaults();
-        checkBoxAddIndividualsAssociations.setSelection(abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
-        checkBoxAddIndividualsAssociations.setText("Create an Individual Association for each Specimen");
-        checkBoxAddIndividualsAssociations
-               .setToolTipText("For each specimen associated to a taxon an indiviadual association to this taxon is created");
-        checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
-            }
-        });
 
-        Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
-        gridData = new GridData();
-        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
-        gridData.horizontalSpan = 2;
-        checkBoxReuseDescriptiveGroups.setLayoutData(gridData);
-        GridDataFactory.fillDefaults();
-        checkBoxReuseDescriptiveGroups.setSelection(abcdImportConfigurator.isReuseExistingDescriptiveGroups());
-        checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group");
-        checkBoxReuseDescriptiveGroups
-               .setToolTipText("Reuse one of the existing descriptive groups or create a new one for every import");
-        checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                abcdImportConfigurator.setReuseExistingDescriptiveGroups(!abcdImportConfigurator.isReuseExistingDescriptiveGroups());
-            }
-        });
 
-        Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
-        gridData = new GridData();
-        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
-        gridData.horizontalSpan = 2;
-        checkBoxReuseExistingTaxa.setLayoutData(gridData);
-        GridDataFactory.fillDefaults();
-        checkBoxReuseExistingTaxa.setSelection(abcdImportConfigurator.isReuseExistingTaxaWhenPossible());
-        checkBoxReuseExistingTaxa.setText("Reuse existing taxa when possible");
-        checkBoxReuseExistingTaxa
-               .setToolTipText("Reuse existing taxa when the name matches the identified name of the specimen");
-        checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                abcdImportConfigurator.setReuseExistingDescriptiveGroups(!abcdImportConfigurator.isReuseExistingDescriptiveGroups());
-            }
-        });
 
 
         if (!isFileImport){
@@ -388,33 +420,34 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
             abcdImportConfigurator.setDnaSoure(null);
         }
 
-
-        Label labelCode = new Label(composite, SWT.NONE);
-        labelCode.setText("Nomenclatural Code");
+        Label labelMedia = new Label(composite, SWT.NONE);
+        labelMedia.setText("Media");
+        labelMedia.setFont(font);
         gridData = new GridData();
-        gridData.horizontalAlignment=SWT.BEGINNING;
+        gridData.horizontalAlignment = GridData.FILL;
+        gridData.grabExcessHorizontalSpace=true;
+        gridData.horizontalSpan = 2;
+        labelMedia.setLayoutData(gridData);
 
-        labelCode.setLayoutData(gridData);
-        GridDataFactory.fillDefaults();
-        nomenclaturalCodeSelectionCombo = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
+
+        Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
+
+        checkBoxMediaSpecimen.setSelection(abcdImportConfigurator.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) {
+                abcdImportConfigurator.setAddMediaAsMediaSpecimen(!abcdImportConfigurator.isAddMediaAsMediaSpecimen());
+            }
+        });
         gridData = new GridData();
-        gridData.horizontalAlignment=SWT.BEGINNING;
-        nomenclaturalCodeSelectionCombo.setLayoutData(gridData);
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+        checkBoxMediaSpecimen.setLayoutData(gridData);
         GridDataFactory.fillDefaults();
-        for(NomenclaturalCode code: NomenclaturalCode.values()){
-            nomenclaturalCodeSelectionCombo.add(code.getKey());
-        }
 
-        nomenclaturalCodeSelectionCombo.addSelectionListener(this);
-        int index = 0;
-        if (abcdImportConfigurator.getNomenclaturalCode() != null){
-            for (String label : nomenclaturalCodeSelectionCombo.getItems()){
-                if (label.equals(abcdImportConfigurator.getNomenclaturalCode().getKey())){
-                    nomenclaturalCodeSelectionCombo.select(index);
-                }
-                index++;
-            }
-        }
 
                setControl(composite);
        }