ref #8631: layout issues
authorKatja Luther <k.luther@bgbm.org>
Thu, 14 Nov 2019 10:54:49 +0000 (11:54 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 14 Nov 2019 10:54:49 +0000 (11:54 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java

index 874a4f27a9c9d58936fff52d6e8ff00e2071e911..52754b4e6ff1bd5b729f4754204b5f5750216088 100644 (file)
@@ -15,7 +15,6 @@ import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
 import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -94,14 +93,20 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
        @Override
     public void createControl(Composite parent) {
                final Composite composite = new Composite(parent, SWT.NULL);
-               //composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
+
                GridLayout gridLayout = new GridLayout();
+               gridLayout.numColumns=2;
+               //gridLayout.makeColumnsEqualWidth=true;
                composite.setLayout(gridLayout);
-//        if (isPreferencePage){
-//            ListComponent list = new ListComponent(composite, composite.getStyle());
-//        }
+
+
+               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
@@ -112,8 +117,15 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
                                abcdImportConfigurator.setAddMediaAsMediaSpecimen(!abcdImportConfigurator.isAddMediaAsMediaSpecimen());
                        }
                });
+               checkBoxMediaSpecimen.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
 
                Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
+               gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL;
+        gridData.grabExcessHorizontalSpace=true;
+        gridData.horizontalSpan = 2;
+
                checkBoxIgnoreExisting.setSelection(abcdImportConfigurator.isIgnoreImportOfExistingSpecimen());
                checkBoxIgnoreExisting.setText("Do not import existing specimens");
                checkBoxIgnoreExisting
@@ -125,7 +137,15 @@ 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
@@ -138,16 +158,21 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
                        }
                });
 
-               Composite unitIdComposite = new Composite(composite, SWT.NULL);
-               GridLayout gridLayoutUnitId = new GridLayout();
-        gridLayoutUnitId.numColumns=2;
-           unitIdComposite.setLayout(gridLayoutUnitId);
 
-        Label unitIdLabel = new Label(unitIdComposite, SWT.NONE);
+               Label unitIdLabel = new Label(composite, SWT.NONE);
         unitIdLabel.setText(Messages.AbcdImportPreference_map_unit_nr_catalog_number);
-        GridDataFactory.fillDefaults().applyTo(unitIdLabel);
-        checkBoxMapUnitId = new Combo(unitIdComposite, SWT.BORDER| SWT.READ_ONLY);
-        GridDataFactory.fillDefaults().applyTo(checkBoxMapUnitId);
+
+        GridData gridDataUnitId = new GridData();
+        gridDataUnitId.horizontalAlignment=SWT.BEGINNING;
+        unitIdLabel.setLayoutData(gridDataUnitId);
+        GridDataFactory.fillDefaults();
+
+        checkBoxMapUnitId = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
+        gridDataUnitId = new GridData();
+        gridDataUnitId.horizontalAlignment=SWT.BEGINNING;
+        checkBoxMapUnitId.setLayoutData(gridDataUnitId);
+        GridDataFactory.fillDefaults();
+
         checkBoxMapUnitId.add(ACCESSION_NUMBER);
         checkBoxMapUnitId.add(BARCODE);
         checkBoxMapUnitId.add(CATALOGUE_NUMBER);
@@ -163,8 +188,13 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
             checkBoxMapUnitId.select(2);
         }
 
-        GridLayoutFactory.fillDefaults();
-               Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
+
+        Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
+        gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+               checkBoxRemoveCountry.setLayoutData(gridData);
+               GridDataFactory.fillDefaults();
                checkBoxRemoveCountry.setSelection(abcdImportConfigurator.isRemoveCountryFromLocalityText());
                checkBoxRemoveCountry.setText("Remove country from locality text");
                checkBoxRemoveCountry
@@ -179,6 +209,11 @@ 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
@@ -192,6 +227,11 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
                });
 
                Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
+               gridData = new GridData();
+        gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+        gridData.horizontalSpan = 2;
+               checkBoxImportSiblings.setLayoutData(gridData);
+        GridDataFactory.fillDefaults();
                checkBoxImportSiblings.setSelection(abcdImportConfigurator.isGetSiblings());
                checkBoxImportSiblings.setText("Import all children of cultures or tissue samples");
                checkBoxImportSiblings
@@ -204,6 +244,11 @@ 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
@@ -216,6 +261,11 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
         });
 
         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
@@ -228,6 +278,11 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
         });
 
         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
@@ -241,14 +296,16 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
 
 
         if (!isFileImport){
-            Composite dnaComposite = new Composite(composite, SWT.NULL);
-            GridLayout gridLayoutDna = new GridLayout();
-            gridLayoutDna.numColumns=2;
-            dnaComposite.setLayout(gridLayoutDna);
-            Label labelRef = new Label(dnaComposite, SWT.NONE);
+
+            Label labelRef = new Label(composite, SWT.NONE);
+            gridDataUnitId = new GridData();
+            gridDataUnitId.horizontalAlignment=SWT.BEGINNING;
+            labelRef.setLayoutData(gridDataUnitId);
             labelRef.setText("Biocase provider for associated DNA");
-            new Label(dnaComposite, SWT.NONE);
-            textDNAProviderString = new Combo(dnaComposite, SWT.BORDER);
+            GridDataFactory.fillDefaults().applyTo(labelRef);
+
+            textDNAProviderString = new Combo(composite, SWT.BORDER);
+            textDNAProviderString.setLayoutData(gridDataUnitId);
             GridDataFactory.fillDefaults().applyTo(textDNAProviderString);
             textDNAProviderString.add("Do not search for DNA");
 
@@ -272,25 +329,24 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
         }else{
             abcdImportConfigurator.setDnaSoure(null);
         }
-//        GridData gridData = new GridData();
-//        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
-//        gridData.horizontalIndent = 5;
-//      classificationSelection.setLayoutData(gridData);
-        Composite codeComposite = new Composite(composite, SWT.NULL);
-
-        codeComposite.setLayout(gridLayoutUnitId);
-        Label labelCode = new Label(codeComposite, SWT.NONE);
+
+
+        Label labelCode = new Label(composite, SWT.NONE);
         labelCode.setText("Nomenclatural Code");
+        gridData = new GridData();
+        gridData.horizontalAlignment=SWT.BEGINNING;
+
+        labelCode.setLayoutData(gridData);
         GridDataFactory.fillDefaults().applyTo(labelCode);
-        nomenclaturalCodeSelectionCombo = new Combo(codeComposite, SWT.BORDER| SWT.READ_ONLY);
-        GridDataFactory.fillDefaults().applyTo(nomenclaturalCodeSelectionCombo);
+        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());
         }
 
-
-
-        // TODO remember last selection
         nomenclaturalCodeSelectionCombo.addSelectionListener(this);
         int index = 0;
         if (abcdImportConfigurator.getNomenclaturalCode() != null){