adapt biocase import views
authorKatja Luther <k.luther@bgbm.org>
Tue, 24 Nov 2020 10:50:48 +0000 (11:50 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 24 Nov 2020 10:50:48 +0000 (11:50 +0100)
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportConfiguratorWizardPageE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/DataImportViewE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SaveImportedSpecimenActionE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionController.java

index e38132b99e0084afea176930562991bc3815581f..3afa745a73a380f70d9808a7794ba407af64ada4 100644 (file)
@@ -31,6 +31,7 @@ page.name.38 = Allgemein
 page.name.39 = Nomenklatur-Code
 page.name.100 = Verbreitungs-Daten
 page.name.101 = Term Editor
+page.name.201 = Term Tree Editor
 page.name.102 = Name Details View
 page.name.103 = Namensmerkmale
 view.name = Datenquelle
index 6deed3f8ebe56488f0cf3fc88d77ccfee1bfe95c..3cb5f4e2c2f28e32d03081b75a74b6f848cd6f82 100755 (executable)
          id="eu.etaxonomy.taxeditor.preferences.termEditor"
          name="%page.name.101">
    </page>
+   <page
+         category="eu.etaxonomy.taxeditor.preference.UIPreferences"
+         class="eu.etaxonomy.taxeditor.preference.TermTreePreference"
+         id="eu.etaxonomy.taxeditor.preferences.termTreeEditor"
+         name="%page.name.201">
+   </page>
    <page
          category="eu.etaxonomy.taxeditor.preference.UIPreferences"
          class="eu.etaxonomy.taxeditor.preference.SupplementalDataPreferences"
index ad7b9ca82306a040a4543484d86df377ad9e00f9..7c6bae97fd2b29b85c0bb77788cc7ebc4b61e8a6 100644 (file)
@@ -52,9 +52,6 @@ public class AbcdImportConfiguratorWizardPageE4 extends WizardPage {
                //composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
                GridLayout gridLayout = new GridLayout();
                composite.setLayout(gridLayout);
-//        if (isPreferencePage){
-//            ListComponent list = new ListComponent(composite, composite.getStyle());
-//        }
 
                Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
                checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
index 8f1e1a63d6d46e585469846333236ffeb27693d2..c2a14df9bfba62317afa84c3985493b525283503 100644 (file)
@@ -25,14 +25,20 @@ import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.ResourceManager;
 
+import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.taxeditor.databaseAdmin.wizard.AbstractPreferenceWizard;
 import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
 
 /**
  *
@@ -48,6 +54,9 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
     private static final String BARCODE = "Barcode";
 
     private static final String CATALOGUE_NUMBER = "Catalogue number";
+    private Text textClassification;
+    private Button btnBrowseClassification;
+    private Button btnClear;
 
        private Abcd206ImportConfigurator abcdImportConfigurator;
 
@@ -92,18 +101,65 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
        /** {@inheritDoc} */
        @Override
     public void createControl(Composite parent) {
-               final Composite composite = new Composite(parent, SWT.NULL);
-
-               GridLayout gridLayout = new GridLayout();
-               gridLayout.numColumns=2;
-               //gridLayout.makeColumnsEqualWidth=true;
-               composite.setLayout(gridLayout);
-
+           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;
+               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));
+
+               Label labelClassification = new Label(classificationComp, SWT.TOP);
+               labelClassification.setText("Classification");
+//             labelClassification.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+        textClassification = new Text(classificationComp, SWT.BORDER);
+        textClassification.setEnabled(false);
+        textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
+        if (abcdImportConfigurator.getClassificationUuid() != null){
+            if (abcdImportConfigurator.getClassificationName() != null){
+                textClassification.setText(abcdImportConfigurator.getClassificationName());
+            }else{
+                Classification classification = CdmStore.getService(IClassificationService.class).load(abcdImportConfigurator.getClassificationUuid());
+                textClassification.setText(classification.getTitleCache());
+            }
+        }
+        btnBrowseClassification = new Button(classificationComp, SWT.NONE);
+        btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+        btnBrowseClassification.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                Classification classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class,parent.getShell(), null, null);
+                if(classification!=null){
+                    textClassification.setText(classification.getTitleCache());
+                    abcdImportConfigurator.setClassificationUuid(classification.getUuid());
+                    abcdImportConfigurator.setClassificationName(classification.getTitleCache());
+                }
+            }
+        });
+        btnClear = new Button(classificationComp, SWT.NONE);
+        btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+        btnClear.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                abcdImportConfigurator.setClassificationUuid(null);
+                textClassification.setText("");
+            }
+        });
 
-               GridData gridData = new GridData();
-               gridData.horizontalAlignment = GridData.FILL;
-               gridData.grabExcessHorizontalSpace=true;
-               gridData.horizontalSpan = 2;
+//        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);
 
@@ -403,6 +459,8 @@ public class AbcdImportConfiguratorWizardPage extends AbstractPreferenceWizard i
 //TODO: check prior or message
                 abcdImportConfigurator.setDnaSoure(null);
             }
+
+
             PreferencesUtil.setStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, abcdImportConfigurator.toString());
 
 
index 4d99db22204769f156711774592c30fc3d54aaae..ff68a78a2e1c62f8b2bd9b22ed8ddb40de6b5a16 100644 (file)
@@ -1426,6 +1426,10 @@ public class PreferencesUtil implements IPreferenceKeys {
                      config.setRemoveCountryFromLocalityText(Boolean.valueOf(valueString));
                  }else if (keyString.equals("getSiblings")){
                      config.setGetSiblings(Boolean.valueOf(valueString));
+                 }else if (keyString.equals("classificationUUID")){
+                     config.setClassificationUuid(UUID.fromString(valueString));
+                 }else if (keyString.equals("classificationName")){
+                     config.setClassificationName(valueString);
                  }else if (keyString.equals("dnaSource")){
                      try{
                          config.setDnaSoure(URI.create(valueString));
index 263be806e5d995d59b48913ebf644495c34f5aa8..18c9b5a7bf51033a0c16061ca2c8dd4997535d93 100644 (file)
@@ -38,13 +38,11 @@ import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.wb.swt.ResourceManager;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
 import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
-import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.databaseAdmin.wizard.ImportPreferencesWizard;
 import eu.etaxonomy.taxeditor.model.IContextListener;
@@ -53,7 +51,6 @@ import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
 import eu.etaxonomy.taxeditor.workbench.part.IEditorAreaPart;
 
 /**
@@ -78,9 +75,9 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     private SaveImportedSpecimenActionE4 saveImportedSpecimenAction;
 
-    private Text textClassification;
+//    private Text textClassification;
 
-    private Classification classification;
+//    private Classification classification;
 
     protected Text textReferenceString;
 
@@ -95,13 +92,13 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     private Abcd206ImportConfigurator config;
 
-    public Classification getClassification() {
-               return classification;
-       }
-
-       public void setClassification(Classification classification) {
-               this.classification = classification;
-       }
+//    public Classification getClassification() {
+//             return classification;
+//     }
+//
+//     public void setClassification(Classification classification) {
+//             this.classification = classification;
+//     }
 
        private Button btnBrowseClassification;
 
@@ -142,20 +139,20 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
         composite_1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
         composite_1.setLayout(new GridLayout(3, false));
 
-        Label label = new Label(composite_1, SWT.TOP);
-        label.setText("Classification");
-        label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
-        textClassification = new Text(composite_1, SWT.BORDER);
-        textClassification.setEnabled(false);
-        GridData gd_textClassification = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
-//        gd_textClassification.widthHint = 118;
-        textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
-        btnBrowseClassification = new Button(composite_1, SWT.NONE);
-        btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
-        btnBrowseClassification.addListener(SWT.Selection, this);
-        btnClear = new Button(composite_1, SWT.NONE);
-        btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
-        btnClear.addListener(SWT.Selection, this);
+//        Label label = new Label(composite_1, SWT.TOP);
+//        label.setText("Classification");
+//        label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+//        textClassification = new Text(composite_1, SWT.BORDER);
+//        textClassification.setEnabled(false);
+//        GridData gd_textClassification = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+////        gd_textClassification.widthHint = 118;
+//        textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
+//        btnBrowseClassification = new Button(composite_1, SWT.NONE);
+//        btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+//        btnBrowseClassification.addListener(SWT.Selection, this);
+//        btnClear = new Button(composite_1, SWT.NONE);
+//        btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+//        btnClear.addListener(SWT.Selection, this);
         //source reference
 
         Label labelRef = new Label(composite_1, SWT.NONE);
@@ -226,7 +223,12 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
         importButton.addSelectionListener(new SelectionAdapter(){
             @Override
             public void widgetSelected(SelectionEvent e) {
-                saveImportedSpecimenAction.run();
+                IWizard wizard = new ImportPreferencesWizard();
+                WizardDialog dialog = new WizardDialog(e.display.getActiveShell(), wizard);
+                int status = dialog.open();
+                if (status == 0){
+                    saveImportedSpecimenAction.run();
+                }
             }
         });
 //        new Label(composite_2, SWT.NONE);
@@ -364,25 +366,25 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     @Override
        public void handleEvent(Event event) {
-           if(event.widget==btnBrowseClassification){
-               classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, event.widget.getDisplay().getActiveShell(), null, null);
-               if(classification!=null){
-                   textClassification.setText(classification.getTitleCache());
-               }
-           }
-           else if(event.widget==btnClear){
-               classification = null;
-               textClassification.setText("");
-           }
-
-           else {
+//         if(event.widget==btnBrowseClassification){
+//             classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, event.widget.getDisplay().getActiveShell(), null, null);
+//             if(classification!=null){
+//                 textClassification.setText(classification.getTitleCache());
+//             }
+//         }
+//         else if(event.widget==btnClear){
+//             classification = null;
+//             textClassification.setText("");
+//         }
+
+//         else {
                if(event.widget == table){
                    TableItem[] item = table.getSelection();
                    if (item.length == 1){
                        Object o = item[0].getData();
                    }
                }
-           }
+//         }
        }
 
     public String getReferenceString() {
index a28d0f58f944b29150d8e1ccbacf1a0083d3911e..10d6de569c2d8b76c209d6ee24bd17ec08236e27 100644 (file)
@@ -114,9 +114,9 @@ public class SaveImportedSpecimenActionE4 extends Action {
                 bioCaseOccurrenceQuery = new OccurenceQuery(unitIdsBioCase);
                 configuratorAbcd.setOccurenceQuery(bioCaseOccurrenceQuery);
 
-                if (dataImportView.getClassification() != null){
-                    configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid());
-                }
+//                if (dataImportView.getClassification() != null){
+//                    configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid());
+//                }
                 if (dataImportView.getReferenceString() != null){
                     configuratorAbcd.setSourceReferenceTitle(dataImportView.getReferenceString());
                 }
index 861624ca76ed3ad45e4b0c9ba3b18d26c3882adc..0b4203a0ad936fc1a6eeb4c5c54f8adee40e48a1 100644 (file)
@@ -25,7 +25,6 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.DisposeEvent;
 import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
@@ -52,7 +51,7 @@ public class SpecimenProviderSelectionComposite extends Composite {
     private final Combo txtAccessPoint;
     private final Button btnGbif;
     private final Button btnBioCaseProvider;
-    private final Label lblAccessPointUrl;
+//    private final Label lblAccessPointUrl;
 
     private String[] items;
 
@@ -76,19 +75,24 @@ public class SpecimenProviderSelectionComposite extends Composite {
             tableWrapLayout.numColumns = 2;
             setLayout(tableWrapLayout);
         }
-
-        btnGbif = new Button(this, SWT.RADIO);
-        toolkit.adapt(btnGbif, true, true);
-        btnGbif.setText("GBIF");
-        new Label(this, SWT.NONE);
-
         btnBioCaseProvider = new Button(this, SWT.RADIO);
         toolkit.adapt(btnBioCaseProvider, true, true);
         btnBioCaseProvider.setText("BioCASE Provider");
+        btnBioCaseProvider.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 2));
 //        txtAccessPoint = new Combo(this, SWT.BORDER);
 //
-
+        Label lblAccessPointUrl = new Label(this, SWT.NONE);
+        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
+        toolkit.adapt(lblAccessPointUrl, true, true);
+        lblAccessPointUrl.setText("Access Point URL");
         txtAccessPoint = new Combo(this, SWT.BORDER);
+        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        toolkit.adapt(txtAccessPoint, true, true);
+//        new Label(this, SWT.NONE);
+        btnGbif = new Button(this, SWT.RADIO);
+        toolkit.adapt(btnGbif, true, true);
+        btnGbif.setText("GBIF");
+        btnGbif.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 2));
         Set<String> itemList = new HashSet<>();
         URL url;
         String response = null;
@@ -170,10 +174,10 @@ public class SpecimenProviderSelectionComposite extends Composite {
         items = new String[itemList.size()];
         items = itemList.toArray(items);
 
-        GridData dataProviderUri = new GridData();
-        dataProviderUri.horizontalAlignment = GridData.FILL;
-        dataProviderUri.horizontalSpan = 3;
-        txtAccessPoint.setLayoutData(dataProviderUri);
+//        GridData dataProviderUri = new GridData();
+//        dataProviderUri.horizontalAlignment = GridData.FILL;
+//        dataProviderUri.horizontalSpan = 3;
+//        txtAccessPoint.setLayoutData(dataProviderUri);
       //  providerURI.setVisible(false);
 
         ContentProposalAdapter adapter = new ContentProposalAdapter(txtAccessPoint, new ComboContentAdapter(), getProposalProvider(), null, null);
@@ -182,13 +186,9 @@ public class SpecimenProviderSelectionComposite extends Composite {
 //        String[] proposals = new String[providerURI.getItems().length];
 
 
-        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        toolkit.adapt(txtAccessPoint, true, true);
 
-        lblAccessPointUrl = new Label(this, SWT.NONE);
-        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
-        toolkit.adapt(lblAccessPointUrl, true, true);
-        lblAccessPointUrl.setText("Access Point URL");
+//
+
 
     }
 
@@ -201,9 +201,9 @@ public class SpecimenProviderSelectionComposite extends Composite {
     public Combo getTxtAccessPoint() {
         return txtAccessPoint;
     }
-    public Label getLblAccessPointUrl() {
-        return lblAccessPointUrl;
-    }
+//    public Label getLblAccessPointUrl() {
+//        return lblAccessPointUrl;
+//    }
 
     /**
      * @return
index 31e3f87dcdd6cd6c92bd462e8a7684856d010ec1..3e48a306481f7ad9b304d904c6c8592f44dcecb6 100644 (file)
@@ -61,8 +61,6 @@ public class SpecimenProviderSelectionController implements Listener{
         composite.getTxtAccessPoint().addListener(SWT.Modify, this);
         composite.getBtnGbif().setSelection(true);
         composite.getTxtAccessPoint().setEnabled(false);
-        composite.getLblAccessPointUrl().setEnabled(false);
-
         loadLastState();
     }
 
@@ -83,7 +81,7 @@ public class SpecimenProviderSelectionController implements Listener{
             }
             composite.getBtnGbif().setSelection(false);
             composite.getTxtAccessPoint().setEnabled(true);
-            composite.getLblAccessPointUrl().setEnabled(true);
+
 
         }
     }
@@ -96,10 +94,8 @@ public class SpecimenProviderSelectionController implements Listener{
     public void handleEvent(Event event) {
         if(event.widget==composite.getBtnBioCaseProvider()){
             composite.getTxtAccessPoint().setEnabled(true);
-            composite.getLblAccessPointUrl().setEnabled(true);
         }
         else if(event.widget==composite.getBtnGbif()){
-            composite.getLblAccessPointUrl().setEnabled(false);
             composite.getTxtAccessPoint().setEnabled(false);
         }
         wizard.getContainer().updateButtons();