merge from trunk
authorCherian Mathew <c.mathew@bgbm.org>
Tue, 11 Nov 2014 17:59:01 +0000 (17:59 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Tue, 11 Nov 2014 17:59:01 +0000 (17:59 +0000)
86 files changed:
.gitattributes
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.application/pom.xml
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.bulkeditor/pom.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar
eu.etaxonomy.taxeditor.cdmlib/pom.xml
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/pom.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/DataImportEditorContextMenu.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/SpecimenImportView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.feature.platform/feature.xml
eu.etaxonomy.taxeditor.feature.platform/pom.xml
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.feature/pom.xml
eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.help/pom.xml
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/pom.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java
eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.printpublisher/pom.xml
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/icons/character_data_derivate-16x16-32.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/pom.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/AbstractMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/OriginalLabelDataElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataController.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/OpenUrlSelectorWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CurrentDeterminationDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/OriginalLabelDataSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/PrimerGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationTextDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SequenceGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/UpdateDataSourceHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchCompositeController.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/CdmSectionPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.test/pom.xml
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product
eu.etaxonomy.taxeditor/pom.xml
eu.etaxonomy.taxeditor/rcp.target
pom.xml

index d661362f97c2145fc189d4944556d3425d615970..0361e5956d45bedee638dc6614e58354d81c2137 100644 (file)
@@ -536,6 +536,8 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/d
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/CreateDerivateContextMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/DerivateViewContextMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/SingleReadSequenceContextMenu.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDragListener.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java -text
@@ -1117,6 +1119,7 @@ eu.etaxonomy.taxeditor.store/icons/binary.gif -text
 eu.etaxonomy.taxeditor.store/icons/bookmark.gif -text
 eu.etaxonomy.taxeditor.store/icons/category.gif -text
 eu.etaxonomy.taxeditor.store/icons/change.gif -text
+eu.etaxonomy.taxeditor.store/icons/character_data_derivate-16x16-32.png -text
 eu.etaxonomy.taxeditor.store/icons/clear.gif -text
 eu.etaxonomy.taxeditor.store/icons/close.gif -text
 eu.etaxonomy.taxeditor.store/icons/close_view.gif -text
@@ -1510,6 +1513,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/Lay
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MinMaxTextSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MultilanguageTextElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/OriginalLabelDataElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PartialElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/PointElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RootElement.java -text
@@ -1527,8 +1531,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/group/grant
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/AbstractCdmComposite.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/DerivedUnitGeneralDetailElementMVC.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/GeographicPointElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataController.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermCombo.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermComboController.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/DateElement.java -text
@@ -1705,6 +1708,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occ
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenSourceCollectionDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractUnboundEntityCollectionSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationCloningDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationCloningDetailSection.java -text
@@ -1714,11 +1718,16 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occ
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationPrimerDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationPrimerDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/PrimerGeneralDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationTextDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SequenceContigFileCollectionDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SequenceGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SequenceGeneralDetailSection.java -text
index d4c616a67dcc0f4318f0bf772f4204e3eebe6d7d..c0a1e5305a51085dc4c3b011580435e32ee755ba 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Application
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
 Bundle-Vendor: EDIT
 Bundle-Localization: OSGI-INF/l10n/plugin
index 20e1dfcca44cd067df817318071270dc06a4858d..eade0b2f589707db8585fb8e4915d315235c0840 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>3.3.8-SNAPSHOT</version>
+    <version>3.4.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
index 105be8f47d934e6c023f96f3ed106ca83e6a5912..9d80b139ca1f9133fc06dbe7791a89a0af6bc847 100644 (file)
@@ -45,7 +45,7 @@ public class ApplicationUtil extends AbstractUtility {
             // this is a stable version
             return version;
         } else {
-            return BETA_PREFIX + version;
+            return BETA_PREFIX + " " + version;
         }
 
     }
index 46562b2ce1c2e895a8ebcbdbe6dde4b775112bf5..8baea95b92bab2b281a65f9e050699c8a0fa8fed 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Bulkeditor Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
index adaebb3e7a0461837642faebeb7cfaffc71a9f12..f3242396cf6859591351e57e55b93bd46d8f1519 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 73c2c8022f83bfbfbd5d787b32e93904dcb666d5..bbf96039323bb7d7fa31456058cd8b135a7a3ecd 100644 (file)
@@ -87,6 +87,7 @@ public class DeleteHandler extends AbstractHandler {
                                        
                                        LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);
                                        DeleteResult result = new DeleteResult();       
+                                       result.setError();
                                        try {
                                                ICdmApplicationConfiguration controller;
                                                controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
@@ -94,21 +95,27 @@ public class DeleteHandler extends AbstractHandler {
                                                if (object instanceof SpecimenOrObservationBase){
                                                        
                                                        IOccurrenceService service = controller.getOccurrenceService();
+                                                       service.load(((SpecimenOrObservationBase) object).getUuid());
                                                        result = service.delete((SpecimenOrObservationBase)object);
                                                } else if (object instanceof Reference){
                                                        IReferenceService service = controller.getReferenceService();
+                                                       service.load(((Reference) object).getUuid());
                                                        result = service.delete((Reference)object);
                                                } else if (object instanceof Group){
                                                        IGroupService service = controller.getGroupService();
+                                                       service.load(((Group) object).getUuid());
                                                        result = service.delete((Group) object);
                                                }else if (object instanceof User){
                                                        IUserService service = controller.getUserService();
+                                                       service.load(((User) object).getUuid());
                                                        result = service.delete((User) object);
                                                } else if (object instanceof TaxonNameBase){
                                                        INameService service = controller.getNameService();
+                                                       service.load(((TaxonNameBase) object).getUuid());
                                                        result = service.delete((TaxonNameBase)object);
                                                } else if (object instanceof TaxonBase){
                                                        ITaxonService service = controller.getTaxonService();
+                                                       service.load(((TaxonBase) object).getUuid());
                                                        if (object instanceof Taxon){
                                                                result = service.deleteTaxon((Taxon)object, null, null);
                                                        }else{
@@ -116,16 +123,18 @@ public class DeleteHandler extends AbstractHandler {
                                                        }
                                                } else if (object instanceof TeamOrPersonBase){
                                                        IAgentService service = controller.getAgentService();
+                                                       object = service.load(((TeamOrPersonBase) object).getUuid());
                                                        result = service.delete((TeamOrPersonBase)object);
                                                }
                                        } catch (Exception e){
-                                               MessagingUtils.messageDialog("Could not delete", getClass(), e.getMessage(), null);
+                                               MessagingUtils.messageDialog("Exception occured. Could not delete", getClass(), e.getMessage(), null);
                                        }
                                        if (result.isError()){
                                                MessagingUtils.messageDialog("Could not delete", getClass(), result.getExceptions().get(0).getMessage(), null);
                                        }
-                                       ((BulkEditor) editor).removeAnnotatedLine(annotation);
-                                       
+                                       if (result.isOk()){
+                                               ((BulkEditor) editor).removeAnnotatedLine(annotation);
+                                       }
                                }                               
                        }
                }else{
index 40552f0cad21a403b6800de403692eaaf5c918e3..9bbc0cb9b273fb8fd4157e2bd089a1ddfd15d221 100644 (file)
        <classpathentry exported="true" kind="lib" path="lib/batik-util-1.7.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/batik-xml-1.7.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-commons-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-ext-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-io-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-model-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-persistence-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-print-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-remote-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.3.8-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.3.8-SNAPSHOT.jar" sourcepath="lib/cdmlib-services-3.3.8-SNAPSHOT-sources.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/cglib-nodep-2.2.2.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.aopalliance-1.0.0.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.4.0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.4.0-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.4.0-SNAPSHOT.jar"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index c46b5097a7c1bbba665f1e57fc0fbd0f72cd1d96..86c822eedfa5d158510fbe37bed66ee5da24fea5 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: CDM Library Dependencies Plugin
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Eclipse-BundleShape: dir
 Export-Package: com.google.api,
  com.google.api.detect,
@@ -430,22 +430,6 @@ Bundle-ClassPath: .,
  lib/batik-util-1.7.jar,
  lib/batik-xml-1.7.jar,
  lib/c3p0-0.9.2.jar,
- lib/cdmlib-commons-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-commons-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-ext-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-ext-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-io-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-io-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-model-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-model-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-persistence-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-persistence-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-print-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-print-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-remote-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-remote-3.3.8-SNAPSHOT.jar,
- lib/cdmlib-services-3.3.8-SNAPSHOT-sources.jar,
- lib/cdmlib-services-3.3.8-SNAPSHOT.jar,
  lib/cglib-nodep-2.2.2.jar,
  lib/com.springsource.org.aopalliance-1.0.0.jar,
  lib/com.springsource.org.apache.commons.logging-1.1.1.jar,
@@ -611,5 +595,21 @@ Bundle-ClassPath: .,
  lib/h2mig_pagestore_addon.jar,
  lib/spring-security-remoting-3.1.3.RELEASE.jar,
  lib/jena-core-2.11.2.jar,
- lib/jena-iri-1.0.2.jar
+ lib/jena-iri-1.0.2.jar,
+ lib/cdmlib-commons-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-commons-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-ext-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-ext-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-io-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-io-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-model-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-model-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-persistence-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-persistence-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-print-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-print-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-remote-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-remote-3.4.0-SNAPSHOT.jar,
+ lib/cdmlib-services-3.4.0-SNAPSHOT-sources.jar,
+ lib/cdmlib-services-3.4.0-SNAPSHOT.jar
 Import-Package: eu.etaxonomy.cdm.api.application
index 44b1fd43918244e71204809a7c78356b621347e6..4278186a308eab1d97e68320d77d18fc08166442 100644 (file)
@@ -23,22 +23,6 @@ bin.includes = META-INF/,\
                lib/batik-util-1.7.jar,\\r
                lib/batik-xml-1.7.jar,\\r
                lib/c3p0-0.9.2.jar,\\r
-               lib/cdmlib-commons-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-commons-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-ext-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-ext-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-io-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-io-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-model-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-model-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-persistence-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-persistence-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-print-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-print-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-remote-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-remote-3.3.8-SNAPSHOT.jar,\\r
-               lib/cdmlib-services-3.3.8-SNAPSHOT-sources.jar,\\r
-               lib/cdmlib-services-3.3.8-SNAPSHOT.jar,\\r
                lib/cglib-nodep-2.2.2.jar,\\r
                lib/com.springsource.org.aopalliance-1.0.0.jar,\\r
                lib/com.springsource.org.apache.commons.logging-1.1.1.jar,\\r
@@ -203,6 +187,23 @@ bin.includes = META-INF/,\
                lib/odfdom-0.8.jar,\\r
                lib/h2mig_pagestore_addon.jar,\\r
                lib/spring-security-remoting-3.1.3.RELEASE.jar,\\r
+               lib/cdmlib-commons-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-commons-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-ext-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-ext-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-io-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-io-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-model-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-model-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-persistence-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-persistence-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-print-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-print-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-remote-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-remote-3.4.0-SNAPSHOT.jar,\\r
+               lib/cdmlib-services-3.4.0-SNAPSHOT-sources.jar,\\r
+               lib/cdmlib-services-3.4.0-SNAPSHOT.jar,\\r
+               lib/spring-security-remoting-3.1.3.RELEASE.jar,\\r
                lib/jena-core-2.11.2.jar,\\r
                lib/jena-iri-1.0.2.jar\r
 jars.compile.order = .\r
index 9fb167cc8644ced846238dee40784f7341832719..4cf488ee33f1a17bac6e7badc2adfac6cf54f75d 100644 (file)
Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar and b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar differ
index 25f118068392d39fda76feea6c855dfb3633db17..f131a431cbf20a8f2194c84912950bd3e0a6485b 100644 (file)
Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar and b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar differ
index 1bc1c579e13314be772913fcf15d8ca0a0b4dc25..51ab1e367dc7cdae518b909e2bc62186f4b53038 100644 (file)
@@ -3,7 +3,7 @@
   <parent>\r
     <groupId>eu.etaxonomy</groupId>\r
     <artifactId>taxeditor-parent</artifactId>\r
-    <version>3.3.8-SNAPSHOT</version>\r
+    <version>3.4.0-SNAPSHOT</version>\r
   </parent>\r
   <modelVersion>4.0.0</modelVersion>\r
   <artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
index 11da103872c8d8303729eb0b2915e1ab58aba9c1..0718ed6fb01b4e5cbef12f07296c5ac48e55f31c 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Editor Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
 Bundle-Vendor: %Bundle-Vendor.0
 Bundle-Localization: OSGI-INF/l10n/plugin
index 5617ce118fc762b669b027f669b09d55e3b75687..8788f3911b4eea20de1ca748fa26495ea7683b9f 100644 (file)
                commandId="taxeditor-editor.useExistingImage"
                label="%command.label.50"
                style="push">
-            <visibleWhen
-                  checkEnabled="false">
+            <visibleWhen>
                <reference
                      definitionId="isImageGallery">
                </reference>
                    <equals
                          value="eu.etaxonomy.taxeditor.editor.view.media">
                    </equals>
-                   <equals
-                         value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
-                   </equals>
                 </or>
              </with>
           </activeWhen>
             class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
             commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler">
       </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler"
+            commandId="org.eclipse.ui.edit.delete">
+         <activeWhen>
+            <with
+                  variable="activePartId">
+               <equals
+                     value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
    </extension>
    <extension
          name="%extension.name"
index 1c6e3e8c5e0945045713ef8b7d3562dd4d50760e..da6a8af2debc17899cd751175c23fe4640af33b8 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
        <groupId>eu.etaxonomy</groupId>
        <artifactId>taxeditor-parent</artifactId>
-    <version>3.3.8-SNAPSHOT</version>
+    <version>3.4.0-SNAPSHOT</version>
   </parent>
   
   <modelVersion>4.0.0</modelVersion>
index d556221c8047671c0d13d992bea81a35e6644b08..4c2735fc52620dc6847b40af8def4416b37f497e 100644 (file)
@@ -31,6 +31,7 @@ import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper;
 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 public class DataImportEditorContextMenu extends CompoundContributionItem {
@@ -47,7 +48,7 @@ public class DataImportEditorContextMenu extends CompoundContributionItem {
                     @Override
                     public void fill(Menu menu, int index) {
                         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-                        final IEditorPart activeEditor = window.getActivePage().getActiveEditor();
+                        final IEditorPart activeEditor = AbstractUtility.getActiveEditor();
                         final ISelection selection = window.getActivePage().getSelection();
                         if(selection instanceof StructuredSelection){
                             final StructuredSelection structuredSelection = (StructuredSelection)selection;
index 264e23b8469ebe1fa80c6903e6571dc1fed0410e..7c47c3151ea32736c41d834889839ffecac4d333 100644 (file)
@@ -69,6 +69,8 @@ public class SpecimenImportView extends DataImportView<SpecimenOrObservationBase
             TransientCdmRepository repo =
                     new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
             configurator.setCdmAppController(repo);
+            configurator.setAddMediaAsMediaSpecimen(true);
+            configurator.setDeterminationOnFieldUnitLevel(true);
 
             CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
             importer.invoke(configurator);
index 9d915e29ad188b8063b81a1a381cabe460d9885b..ec743254295cc25407643fd674219102a1f6bfc1 100644 (file)
@@ -31,6 +31,7 @@ import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.api.service.dto.DerivateHierarchyDTO;
 import eu.etaxonomy.cdm.api.service.pager.Pager;
 import eu.etaxonomy.cdm.api.service.search.SearchResult;
 import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
@@ -915,6 +916,24 @@ public class TransientOccurenceService implements IOccurrenceService {
                return defaultService.findWithoutFlush(uuid);
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listFieldUnitsByAssociatedTaxon(java.util.Set, eu.etaxonomy.cdm.model.taxon.Taxon, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
+     */
+    @Override
+    public Collection<FieldUnit> listFieldUnitsByAssociatedTaxon(Set<TaxonRelationshipEdge> includeRelationships,
+            Taxon associatedTaxon, Integer maxDepth, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints,
+            List<String> propertyPaths) {
+        return defaultService.listFieldUnitsByAssociatedTaxon(includeRelationships, associatedTaxon, maxDepth, pageSize, pageNumber, orderHints, propertyPaths);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#assembleDerivateHierarchyDTO(eu.etaxonomy.cdm.model.occurrence.FieldUnit, java.util.UUID)
+     */
+    @Override
+    public DerivateHierarchyDTO assembleDerivateHierarchyDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid) {
+        return defaultService.assembleDerivateHierarchyDTO(fieldUnit, associatedTaxonUuid);
+    }
+
     /* (non-Javadoc)
      * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getNonCascadedAssociatedElements(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.api.conversation.ConversationHolder)
      */
@@ -923,4 +942,12 @@ public class TransientOccurenceService implements IOccurrenceService {
         return defaultService.getNonCascadedAssociatedElements(specimen);
     }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#deleteDerivateHierarchy(eu.etaxonomy.cdm.model.common.ICdmBase)
+     */
+    @Override
+    public DeleteResult deleteDerivateHierarchy(ICdmBase arg0) {
+        return defaultService.deleteDerivateHierarchy(arg0);
+    }
+
 }
index e5cf609ec1f1b0107d1390e490281e41dfe9a094..bf2c7ae39f6725469fe2a9c1496ad9f5510ca9fd 100644 (file)
@@ -83,6 +83,7 @@ import eu.etaxonomy.cdm.persistence.query.OrderHint;
 import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
 import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
 import eu.etaxonomy.cdm.strategy.merge.IMergeStrategy;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
 
 /**
  * @author pplitzner
@@ -1314,7 +1315,7 @@ public class TransientTaxonService implements ITaxonService {
      * @see eu.etaxonomy.cdm.api.service.ITaxonService#findTaxaAndNamesForEditor(eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator)
      */
     @Override
-    public List<UuidAndTitleCache<TaxonBase>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator) {
+    public List<UuidAndTitleCache<IdentifiableEntity>> findTaxaAndNamesForEditor(IFindTaxaAndNamesConfigurator configurator) {
         return defaultTaxonService.findTaxaAndNamesForEditor(configurator);
     }
 
index 3d27e75c8f5ae1459f5ff177f5d97b5cf044f945..263d12a243fb7f5dd281ed1cef05cb5a4cc47aca 100644 (file)
@@ -16,6 +16,7 @@ import eu.etaxonomy.cdm.model.molecular.SingleRead;
 import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 
 public class DerivateContentProvider implements ITreeContentProvider {
@@ -56,7 +57,7 @@ public class DerivateContentProvider implements ITreeContentProvider {
             value = ((TreeNode) element).getValue();
         }
         Set<Object> children = new LinkedHashSet<Object>();
-        if(value instanceof DnaSample){
+        if(value instanceof DnaSample && ((DnaSample) value).getRecordBasis()==SpecimenOrObservationType.DnaSample){
             DnaSample dnaSample = (DnaSample)value;
             Set<Sequence> sequences = dnaSample.getSequences();
             for (Sequence sequence : sequences) {
@@ -101,7 +102,7 @@ public class DerivateContentProvider implements ITreeContentProvider {
             element = ((TreeNode) element).getValue();
         }
 
-        if(element instanceof DnaSample){
+        if(element instanceof DnaSample && ((DnaSample) element).getRecordBasis()==SpecimenOrObservationType.DnaSample){
             DnaSample dnaSample = (DnaSample)element;
             if(!dnaSample.getSequences().isEmpty()){// || !dnaSample.getAmplifications().isEmpty()){
                 return true;
index 69f175743e030568b3e904015de829284f4a00b2..d9a10fe892d5c6bd67b694dbbe61e315cde7a395 100644 (file)
@@ -21,6 +21,7 @@ import eu.etaxonomy.cdm.model.molecular.Sequence;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -103,7 +104,7 @@ public class DerivateDropListener extends ViewerDropAdapter {
         TreeNode fromParentNode = draggedNode.getParent();
         Object fromParentSpecimen = null;
         if(fromParentNode!=null){
-            fromParentNode.getValue();
+            fromParentSpecimen = fromParentNode.getValue();
         }
 
         // drag'n'drop for SpecimenOrObservationBase
@@ -112,8 +113,9 @@ public class DerivateDropListener extends ViewerDropAdapter {
             DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
             SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
             //check if type is a sub derivate type
-            if(!fromParentNode.equals(targetNode)//don't drag on direct parent node
-                    && fromParentSpecimen instanceof SpecimenOrObservationBase<?>){
+            if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
+            && fromParentNode!=null
+            && !fromParentNode.equals(targetNode)){//don't drag on direct parent node)
                 return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
             }
         }
@@ -127,9 +129,9 @@ public class DerivateDropListener extends ViewerDropAdapter {
         }
 
         // drag'n'drop for Sequence
-        else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample ){
+        else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
             Sequence sequence = (Sequence)draggedNodeValue;
-            if(fromParentSpecimen instanceof DnaSample){
+            if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
                 return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
             }
         }
index ad5c4f329930de15aadd744f362cdff36b6be940..a971784de2b3d74d020967abaf6011d9ce70a2de 100644 (file)
@@ -14,6 +14,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.dnd.DND;
@@ -25,7 +26,6 @@ import org.eclipse.swt.widgets.Tree;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IMemento;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.part.EditorPart;
 
@@ -36,7 +36,6 @@ import eu.etaxonomy.cdm.model.molecular.Sequence;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
@@ -51,7 +50,7 @@ import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
  */
 public class DerivateView extends EditorPart implements IPartContentHasFactualData, IDirtyMarkable,
         IConversationEnabled, IPartContentHasDetails, IPartContentHasMedia, IPartContentHasSupplementalData,
-        IContextListener, ISelectionChangedListener {
+        ISelectionChangedListener {
 
        /**
      * Key used for storing a single DerivateView in a memento
@@ -83,7 +82,6 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
      * Default constructor
      */
     public DerivateView() {
-        CdmStore.getContextManager().addContextListener(this);
     }
 
     /* (non-Javadoc)
@@ -251,6 +249,19 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         changed(null);
     }
 
+    /**
+     * Refreshes the derivate hierarchy tree and expands the tree
+     * to show and select the given object.
+     *
+     * @param expandTo the object to which the tree should be expanded
+     */
+    public void refreshTree(Object expandTo){
+        refreshTree();
+        TreeSelection selection = (TreeSelection) viewer.getSelection();
+        viewer.expandToLevel(selection.getFirstElement(), 1);
+        viewer.setSelection(new StructuredSelection(new TreeNode(expandTo)));
+    }
+
     /**
      * Refreshes the derivate hierarchy tree
      */
@@ -260,6 +271,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         viewer.refresh();
     }
 
+
     private void generateMultiLinkSingleReads() {
         Set<SingleRead> multiLinkSingleReads = new HashSet<SingleRead>();
         for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
@@ -277,64 +289,6 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         return this.multiLinkSingleReads;
     }
 
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void contextStop(IMemento memento, IProgressMonitor monitor) {
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.model.IContextListener#contextStart(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void contextStart(IMemento memento, IProgressMonitor monitor) {
-//        if(memento == null){
-//            return;
-//        }
-//        IMemento editorMementos = memento.getChild(DERIVATE_VIEW_MEMENTO_KEY);
-//            DerivateViewEditorInput input = new DerivateViewEditorInput(UUID.fromString(editorInput.getString(DerivateViewEditorInput.UUID_MEMENTO_KEY)));
-//                try {
-//                    EditorUtil.open(input);
-//                } catch (PartInitException e) {
-//                    AbstractUtility.error(getClass(), "Error opening an editor window", e);
-//                }
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.model.IContextListener#contextRefresh(org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void contextRefresh(IProgressMonitor monitor) {
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.model.IContextListener#workbenchShutdown(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
-//        if (!conversation.isBound()) {
-//            conversation.bind();
-//        }
-//        conversation.close();
-//        if(memento == null){
-//            return;
-//        }
-//
-//        IEditorInput input = getEditorInput();
-//        if(input instanceof IPersistable){
-//            memento.createChild(DERIVATE_VIEW_MEMENTO_KEY);
-//            ((IPersistable) input).saveState(memento);
-//        }
-    }
-
     /* (non-Javadoc)
      * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
      */
index b956e86c779337c9dc9e6335f021c44b07749fe0..9c65824d4ca8af488788ae8978e07b318adefd25 100644 (file)
@@ -57,24 +57,26 @@ public class CreateDerivateContextMenu extends CompoundContributionItem {
                             if(selectedTreeNode.getValue() instanceof FieldUnit){
                                 createMenuItem(addMenu, "Specimen", selectedTreeNode, DerivedUnit.class, SpecimenOrObservationType.PreservedSpecimen);
                                 new MenuItem(addMenu, SWT.SEPARATOR);
-                                createMenuItem(addMenu, "Tissue Sample", selectedTreeNode, DerivedUnit.class, SpecimenOrObservationType.TissueSample);
+                                createMenuItem(addMenu, "Tissue Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.TissueSample);
                                 createMenuItem(addMenu, "DNA Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample);
                                 createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media);
                             }
                             //context menu for Specimen
                             else if(selectedTreeNode.getValue() instanceof DerivedUnit && ((DerivedUnit)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
 
-                                createMenuItem(addMenu, "Tissue Sample", selectedTreeNode, DerivedUnit.class, SpecimenOrObservationType.TissueSample);
+                                createMenuItem(addMenu, "Tissue Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.TissueSample);
                                 createMenuItem(addMenu, "DNA Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample);
                                 createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media);
                             }
                             //context menu for TissueSample
-                            else if(selectedTreeNode.getValue() instanceof DerivedUnit && ((DerivedUnit)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                            else if(selectedTreeNode.getValue() instanceof DnaSample && ((DnaSample)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.TissueSample){
                                createMenuItem(addMenu, "DnaSample", selectedTreeNode, DnaSample.class, null);
+                               createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media);
                             }
                             //context menu for DnaSample
-                            else if(selectedTreeNode.getValue() instanceof DnaSample){
+                            else if(selectedTreeNode.getValue() instanceof DnaSample && ((DnaSample)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.DnaSample){
                                 createMenuItem(addMenu, "Consensus Sequence", selectedTreeNode, Sequence.class, null);
+                                createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media);
                             }
                             //context menu for Sequence
                             else if(selectedTreeNode.getValue() instanceof Sequence){
@@ -123,21 +125,32 @@ public class CreateDerivateContextMenu extends CompoundContributionItem {
          */
         @Override
         public void widgetSelected(SelectionEvent e) {
+            Object createdElement = null;
             Object selectedDerivate = selectedNode.getValue();
-            if(selectedDerivate instanceof DnaSample){
+            if(selectedDerivate instanceof DnaSample && ((DnaSample) selectedDerivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
                 DnaSample dnaSample = (DnaSample)selectedDerivate;
                 if(childClass.equals(Sequence.class)){
-                    dnaSample.addSequence(Sequence.NewInstance(""));//why does this not have DnaSample as constructor parameter?
+                    Sequence newInstance = Sequence.NewInstance("");
+                    dnaSample.addSequence(newInstance);//why does this not have DnaSample as constructor parameter?
+                    createdElement = newInstance;
                 }
             }
             else if(selectedDerivate instanceof Sequence){
-                ((Sequence) selectedDerivate).addSingleRead(SingleRead.NewInstance());
+                SingleRead newInstance = SingleRead.NewInstance();
+                ((Sequence) selectedDerivate).addSingleRead(newInstance);
+                createdElement = newInstance;
             }
             else if(selectedDerivate instanceof SpecimenOrObservationBase && DerivedUnit.class.isAssignableFrom(childClass)){
                 SpecimenOrObservationBase<?> specimenOrObservationBase = (SpecimenOrObservationBase<?>)selectedDerivate;
                 DerivedUnit derivedUnit;
                 if(childClass.equals(DnaSample.class)){
                     derivedUnit = DnaSample.NewInstance();
+                    if(specimenType==SpecimenOrObservationType.DnaSample){
+                        derivedUnit.setRecordBasis(SpecimenOrObservationType.DnaSample);
+                    }
+                    else if(specimenType==SpecimenOrObservationType.TissueSample){
+                        derivedUnit.setRecordBasis(SpecimenOrObservationType.TissueSample);
+                    }
                 }
                 else if(childClass.equals(MediaSpecimen.class)){
                     derivedUnit = MediaSpecimen.NewInstance(specimenType);
@@ -150,6 +163,7 @@ public class CreateDerivateContextMenu extends CompoundContributionItem {
                 specimenOrObservationBase.addDerivationEvent(DerivationEvent.NewSimpleInstance(specimenOrObservationBase, derivedUnit, DerivationEventType.GATHERING_IN_SITU()));
                 derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
                 derivedUnit.getTitleCache(); //update title cache
+                createdElement = derivedUnit;
             }
 
             //refresh view
@@ -157,7 +171,7 @@ public class CreateDerivateContextMenu extends CompoundContributionItem {
             if(activePart instanceof DerivateView){
                 DerivateView derivateView = (DerivateView)activePart;
                 derivateView.changed(null);
-                derivateView.refreshTree();
+                derivateView.refreshTree(createdElement);
             }
         }
     }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java
new file mode 100644 (file)
index 0000000..7f8cc9b
--- /dev/null
@@ -0,0 +1,78 @@
+// $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.editor.view.derivate.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.operation.DeleteDerivateOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * @author pplitzner
+ * @date Oct 21, 2014
+ *
+ */
+public class DeleteDerivateHandler extends AbstractHandler {
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveSite(event).getSelectionProvider().getSelection();
+
+        IWorkbenchPart part = HandlerUtil.getActivePart(event);
+        IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
+
+        try {
+            String label = event.getCommand().getName();
+
+            IUndoContext undoContext = EditorUtil.getUndoContext();
+
+            if(selection.size()>0){
+                Object object = selection.iterator().next();
+
+                if(object instanceof TreeNode){
+                    TreeNode treeNode = (TreeNode)object;
+                    Object value = ((TreeNode) object).getValue();
+                    if(value instanceof SpecimenOrObservationBase<?> || value instanceof Sequence || value instanceof SingleRead){
+                        DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, postOperationEnabled);
+                        AbstractUtility.executeOperation(deleteDerivateOperation);
+                    }
+                }
+                else{
+                    MessagingUtils.error(getClass(), "Selection is not valid for this delete handler", null);
+                }
+            }
+
+        } catch (NotDefinedException e) {
+            MessagingUtils.warn(getClass(), "Command name not set.");
+        }
+        return null;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java
new file mode 100644 (file)
index 0000000..9ef9450
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+ * 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.editor.view.derivate.operation;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * @author pplitzner
+ * @date Oct 21, 2014
+ *
+ */
+public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
+
+    public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
+            IPostOperationEnabled postOperationEnabled) {
+        super(label, undoContext, element, postOperationEnabled);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse
+     * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        return postExecute(null);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
+     * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        return execute(monitor, info);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
+     * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        return postExecute(element);
+    }
+}
index 21e0de374261e6dca5b2368943d8c95d95e2cccd..79596d803cae8b712484510a082650a04108ede2 100644 (file)
@@ -2,18 +2,11 @@
 <feature
       id="eu.etaxonomy.taxeditor.feature.platform"
       label="Taxeditor Dependencies"
-      version="3.3.8.qualifier"
+      version="3.4.0.qualifier"
       os="linux,macosx,win32"
       ws="cocoa,gtk,win32"
       arch="x86,x86_64">
 
-   <!--license url="http://www.eclipse.org/legal/epl-v10.html">
-      The contents of this file are subject to the Eclipse Public License Version 1.0 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
-http://www.eclipse.org/legal/epl-v10.html
-
-Software distributed under the License is distributed on an &quot;AS IS&quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
-   </license-->
-
    <url>
       <update label="EDIT Taxonomic Editor" url="http://wp5.e-taxonomy.eu/taxeditor/update"/>
    </url>
index 61024e776b5de89afd893b7a695745dfb3255c7a..d7e0536d4226d8700b8ea8a7babc4c1ddbbd0039 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
index e16cb13673bd132098479969c5a3aaa917593e30..df501596241cb7adca55d5d4fa705bdef4692091 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="eu.etaxonomy.taxeditor.feature"
       label="Taxonomic Editor"
-      version="3.3.8.qualifier"
+      version="3.4.0.qualifier"
       provider-name="EDIT"
       plugin="eu.etaxonomy.taxeditor.application"
       os="linux,macosx,win32"
       [Enter Copyright Description here.]
    </copyright>
 
-   <!--license url="http://www.mozilla.org/MPL/">
-      The contents of this file are subject to the Mozilla Public License Version 1.1 (the &quot;License&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
-http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an &quot;AS IS&quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
-   </license-->
-
    <url>
       <update label="EDIT Taxonomic Editor" url="http://cybertaxonomy.eu/download/taxeditor/update/"/>
    </url>
index 5633fac66b7d60787e4779d07a21aac986a44ff0..d553aec651a999eb45752257d101155d75466219 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
index 543e164e2bfbdc01ca2b27d0bc6cdee4063b0d1c..9af1f6d9c2abec616084ccf4c992c33de9bfcc19 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Help
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
 Bundle-Vendor: EDIT
 Require-Bundle: org.eclipse.ui,
index 8fa6ae67c98550ac1471f2d804fd90ae844ed08b..be078cd807b17934d07a6c351953d59202178476 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 87cf5d4596b9e0294d9fee96eab4a56b1aad733f..0c596eaf6ed7f8c0009e30663ecf54ac6041d3b9 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Navigation Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.navigation,
index 3ff2a55770b900f0e28aa40378d3d4d574488a43..67c35d572774424ab4cbbbe485c8dd12ccaee1af 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>3.3.8-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 905e4b847568bf7edc58557f9681f3cfd6f07284..8a1ca9d9a74d824624a923cac844ab97719d6e36 100644 (file)
@@ -38,6 +38,7 @@ import org.eclipse.ui.part.ViewPart;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
@@ -209,7 +210,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
         *
         * @param result a {@link java.util.List} object.
         */
-       protected void displaySearchResult(List<UuidAndTitleCache<TaxonBase>> result) {
+       protected void displaySearchResult(List<UuidAndTitleCache<IdentifiableEntity>> result) {
                if(result.size() > 0){
                        resultViewer.setInput(result);
                        status.setText(result.size() + " entities found");
@@ -297,7 +298,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                        monitor.beginTask("", 100);
                        monitor.worked(20);
 
-                       final List<UuidAndTitleCache<TaxonBase>> searchResult = CdmStore.getSearchManager().findTaxaAndNames(configurator);
+                       final List<UuidAndTitleCache<IdentifiableEntity>> searchResult = CdmStore.getSearchManager().findTaxaAndNames(configurator);
                        monitor.worked(40);
 
                        if(! monitor.isCanceled()){
index 99e8e0c56b64293f199b2a1da07d258434f8c337..2b4b2ade6f166a2da787877be7bc7ccb268e6b41 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Printpublisher Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Require-Bundle: org.eclipse.osgi,
  org.eclipse.ui,
  eu.etaxonomy.taxeditor.cdmlib,
index a200a1a507910be7aae177184f2377bc33fd3ed5..6aaf4e7fcdb68fbe6d895282a06f041d6543e7b0 100644 (file)
@@ -4,7 +4,7 @@
        <parent>
                <artifactId>taxeditor-parent</artifactId>
                <groupId>eu.etaxonomy</groupId>
-               <version>3.3.8-SNAPSHOT</version>
+               <version>3.4.0-SNAPSHOT</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index ca6afae0565ab77a6774286598660ec1e0f14a40..9b30b76b8d26907629b46460ec24e243daa10ba1 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: DataStore Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 3.3.8.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.cdm,
@@ -58,7 +58,12 @@ Require-Bundle: org.eclipse.osgi,
  org.eclipse.jface.text,
  org.eclipse.ui.forms,
  eu.etaxonomy.taxeditor.cdmlib,
- org.eclipse.nebula.widgets.compositetable;bundle-version="1.0.0"
+ org.eclipse.nebula.widgets.compositetable,
+ org.eclipse.core.databinding,
+ org.eclipse.core.databinding.beans,
+ org.eclipse.core.databinding.observable,
+ org.eclipse.core.databinding.property,
+ org.eclipse.jface.databinding
 Import-Package: org.eclipse.core.commands,
  org.eclipse.core.commands.operations,
  org.eclipse.core.expressions,
diff --git a/eu.etaxonomy.taxeditor.store/icons/character_data_derivate-16x16-32.png b/eu.etaxonomy.taxeditor.store/icons/character_data_derivate-16x16-32.png
new file mode 100644 (file)
index 0000000..b9dd5ef
Binary files /dev/null and b/eu.etaxonomy.taxeditor.store/icons/character_data_derivate-16x16-32.png differ
index f21f025332867f66dcfd89cbe3785bca91abe53d..5273219f82e4586152b33e882360b484391a96a4 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
        <groupId>eu.etaxonomy</groupId>
        <artifactId>taxeditor-parent</artifactId>
-       <version>3.3.8-SNAPSHOT</version>
+       <version>3.4.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
index 4b946fa36f118ca55a29402cc11a601c4fd4d0e8..4c946a9a53b2541f01ca7ef3267303f6bb945179 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -14,7 +14,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardContainer;
 import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IEditorReference;
@@ -33,16 +32,16 @@ import eu.etaxonomy.cdm.io.common.IIoConfigurator;
  * @version 1.0
  */
 public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> extends Wizard implements IImportWizard {
-       
-       protected final String CONFIGURATION_PAGE = "CONFIGURATION_PAGE"; 
-       
+
+       protected final String CONFIGURATION_PAGE = "CONFIGURATION_PAGE";
+
        private GenericConfiguratorWizardPage pageConfiguration;
        private NomenclaturalCodeWizardPage pageNomenclaturalCode;
 
        private IWorkbench workbench;
 
        private IStructuredSelection selection;
-       
+
 
        /* (non-Javadoc)
         * @see org.eclipse.jface.wizard.Wizard#addPages()
@@ -51,25 +50,30 @@ public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> exten
        @Override
        public void addPages() {
                super.addPages();
-               
+
                pageConfiguration = GenericConfiguratorWizardPage.Import(CONFIGURATION_PAGE, getConfigurator());
                this.addPage(pageConfiguration);
-               
+
                pageNomenclaturalCode = new NomenclaturalCodeWizardPage((IImportConfigurator)getConfigurator());
                this.addPage(pageNomenclaturalCode);
-               
-               
+
+
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.wizard.Wizard#setContainer(org.eclipse.jface.wizard.IWizardContainer)
         */
        @Override
        public void setContainer(IWizardContainer wizardContainer) {
-               super.setContainer(wizardContainer);
-               checkForUnsavedEditors();
+               if(existUnsavedEditors()){
+                   MessageDialog.open(MessageDialog.WARNING, getShell(), "Unsaved editors", "Please save all open editors before executing " +
+                           "an import operation. The import operation will be cancelled", SWT.NONE);
+               }
+               else{
+                   super.setContainer(wizardContainer);
+               }
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
         */
@@ -78,28 +82,28 @@ public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> exten
                this.setWorkbench(workbench);
                this.setSelection(selection);
        }
-       
-       protected void checkForUnsavedEditors(){
+
+       protected boolean existUnsavedEditors(){
                IWorkbenchPage activePage = getWorkbench().getActiveWorkbenchWindow().getActivePage();
-               
                if(activePage != null){
                        for (IEditorReference reference : activePage.getEditorReferences()) {
                                IEditorPart editor = reference.getEditor(false);
                                if(editor.isDirty()){
-                                       
-                                       MessageDialog.open(MessageDialog.WARNING, getShell(), "Unsaved editors", "Please save all open editors before executing " +
-                                                       "an import operation. The import operation will be cancelled", SWT.NONE);
-                                       
-                                       performCancel();
-                                       if(getContainer() instanceof WizardDialog){
-                                               ((WizardDialog)getContainer()).close();
-                                       }
-                                       
+                                       return true;
                                }
                        }
                }
+               return false;
        }
-       
+
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.wizard.Wizard#canFinish()
+        */
+       @Override
+       public boolean canFinish() {
+           return !existUnsavedEditors();
+       }
+
        /**
         * <p>getConfigurator</p>
         *
index 81947acc6f825c1f27784eb3654ca83bdcb10c10..d1d90b90b6448072f2e5723f9c8eec196f4671a5 100644 (file)
@@ -147,6 +147,8 @@ public class ImageResources {
     public static final String SINGLE_READ_DERIVATE = "single_read_derivate";
     public static final String SINGLE_READ_DERIVATE_MULTILINK = "single_read_derivate_multilink";
 
+    public static final String CHARACTER_DATA_DERIVATE = "character_data_derivate";
+
 
 
        /***************************************************************************
@@ -347,6 +349,9 @@ public class ImageResources {
                        "single_read_derivate-16x16-32.png");
                registerImage(registry, SINGLE_READ_DERIVATE_MULTILINK,
                        "single_read_derivate_multilink-16x16-32.png");
+               registerImage(registry, CHARACTER_DATA_DERIVATE,
+                       "character_data_derivate-16x16-32.png");
+
        }
 
        private void registerImage(ImageRegistry registry, String key,
index 9fc72e2b883a582e44396a7c9be12fc2aa3bfa12..23e6825e38192a9c63de4dd6f5e2daa86db0c334 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.parser;
 
@@ -29,10 +29,10 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class ParseHandler{
 
        private TaxonNameBase taxonNameBase;
-       
+
        private class MatchMatrix {
                List<TaxonNameBase> duplicateNames = new ArrayList<TaxonNameBase>();
-               
+
                List<INomenclaturalReference> duplicateReferences = new ArrayList<INomenclaturalReference>();
                List<INomenclaturalReference> duplicateInReferences = new ArrayList<INomenclaturalReference>();
 
@@ -50,10 +50,10 @@ public class ParseHandler{
        private NonViralName name;
 
        private boolean doResolveInReferences;
-       
+
        /**
-        * Creates a new instance 
-        * 
+        * Creates a new instance
+        *
         * @param textWidget
         * @param name
         */
@@ -64,7 +64,7 @@ public class ParseHandler{
                        this.name = (NonViralName) HibernateProxyHelper.deproxy(name);
                }
        }
-       
+
        /**
         * Factory method to create a new instance of the this class
         *
@@ -74,9 +74,9 @@ public class ParseHandler{
         */
        public static ParseHandler NewInstance(TaxonNameBase name){
                return new ParseHandler(name);
-               
+
        }
-       
+
        /**
         * Parses a given string and returns a <code>TaxonNameBase</code> instance with the
         * results of the parsing.
@@ -95,17 +95,17 @@ public class ParseHandler{
 //             if (name.hasProblem()) {
 //                     name.setFullTitleCache(unparsedNameString);
 //             }
-               
+
                return name;
        }
-       
+
        public static TaxonNameBase parseName(String unparsedNameString, Rank rank){
                TaxonNameBase name = nonViralNameParser.parseFullName(unparsedNameString,
                                PreferencesUtil.getPreferredNomenclaturalCode(), rank);
-               
+
                return name;
        }
-       
+
        /**
         * Creates an empty <code>TaxonNameBase</code> instance with the nomenclatural code
         * currently set in preferences.
@@ -115,7 +115,7 @@ public class ParseHandler{
        public static TaxonNameBase createEmptyName(){
                return nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode());
        }
-       
+
        /**
         * Parses the string that was entered into the text widget and returns a
         * NonViralName object that resulted from the parsing process.
@@ -123,7 +123,7 @@ public class ParseHandler{
         * @return      The parsed NonViralName object
         */
        public NonViralName parse(String unparsedNameString){
-               
+
 //             String unparsedNameString = "";
 //             try {
 //                     Method getText;
@@ -133,18 +133,18 @@ public class ParseHandler{
 //                     // we should never get here
 //                     StoreUtil.error(this.getClass(), "Error trying to invoke getText method", e);
 //             }
-               
-               
+
+
                nonViralNameParser.parseReferencedName(name, unparsedNameString,
                                name.getRank(), true);
 
 //             if (name.hasProblem()) {
 //                     name.setFullTitleCache(unparsedNameString);
 //             }
-               
+
                return name;
        }
-       
+
        /**
         * Parses the string that was entered into the text widget and returns a
         * NonViralName object that resulted from the parsing process.
@@ -157,39 +157,40 @@ public class ParseHandler{
         * @return      The parsed NonViralName object
         */
        public NonViralName parseAndResolveDuplicates(String unparsedNameString){
-               
+
                NonViralName parsedName = parse(unparsedNameString);
-               
+
                MatchMatrix matchMatrix = findMatches(parsedName);
-               
+
                resolveDuplicates(parsedName, matchMatrix);
-               
+
                return parsedName;
        }
-               
-       
-       
-       
-       /** 
+
+
+
+
+       /**
         * @param name The name to resolve duplicates for.
         */
        private void resolveDuplicates(NonViralName name, MatchMatrix matchMatrix) {
                resolveDuplicateNames(name, matchMatrix);
-               
+
                resolveAllDuplicateAuthors(name, matchMatrix);
-               
+
                resolveDuplicateReferences(name, matchMatrix);
-               
-               if(matchMatrix.duplicateInReferences != null)
-                       resolveDuplicateInReferences(name, matchMatrix);
+
+               if(matchMatrix.duplicateInReferences != null) {
+            resolveDuplicateInReferences(name, matchMatrix);
+        }
        }
 
 
-       /** 
+       /**
         * @param name The name to resolve duplicates for.
         */
        private void resolveDuplicateNames(NonViralName name, MatchMatrix matchMatrix) {
-                               
+
                if (matchMatrix.duplicateNames.size() == 1){
                        name = (NonViralName) matchMatrix.duplicateNames.iterator().next();
                }else if(matchMatrix.duplicateNames.size() > 1){
@@ -198,27 +199,27 @@ public class ParseHandler{
                }
        }
 
-       /** 
+       /**
         * @param name The name to resolve duplicates for.
         */
        private void resolveDuplicateReferences(NonViralName name, MatchMatrix matchMatrix) {
                if(matchMatrix.duplicateReferences.size() == 1){
                        // exactly one match. We assume that the user wants this reference
-                       INomenclaturalReference duplicate = matchMatrix.duplicateReferences.iterator().next();  
+                       INomenclaturalReference duplicate = matchMatrix.duplicateReferences.iterator().next();
                        name.setNomenclaturalReference(duplicate);
                }else if(matchMatrix.duplicateReferences.size() > 1){
                        // FIXME TODO resolve multiple duplications. Use first match for a start
                        INomenclaturalReference duplicate = matchMatrix.duplicateReferences.iterator().next();
                        name.setNomenclaturalReference(duplicate);
-               }               
+               }
        }
 
-       /** 
+       /**
         * @param name The name to resolve duplicates for.
         */
        private void resolveDuplicateInReferences(NonViralName name, MatchMatrix matchMatrix) {
                Reference reference = (Reference) HibernateProxyHelper.deproxy(name.getNomenclaturalReference());
-               
+
                if(matchMatrix.duplicateInReferences.size() > 0){
                        Reference inReference = (Reference) matchMatrix.duplicateInReferences.iterator().next();
                        reference.setInReference(inReference);
@@ -227,58 +228,58 @@ public class ParseHandler{
                        MessagingUtils.warn(this.getClass(), reference.getTitleCache());
                }
        }
-       
 
-       /** 
+
+       /**
         * @param name The name to resolve duplicates for.
         */
        private void resolveAllDuplicateAuthors(NonViralName name, MatchMatrix matchMatrix) {
-               
+
                if(matchMatrix.duplicateCombinationAuthorTeams.size() > 0){
                        name.setCombinationAuthorTeam(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
                        Reference reference = (Reference) name.getNomenclaturalReference();
                        if(reference != null){
-                               reference.setAuthorTeam(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
+                               reference.setAuthorship(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
                        }
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
-               
+
                if(matchMatrix.duplicateExCombinationAuthorTeams.size() > 0){
                        name.setExCombinationAuthorTeam(matchMatrix.duplicateExCombinationAuthorTeams.iterator().next());
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
-               
+
                if(matchMatrix.duplicateBasionymAuthorTeams.size() > 0){
                        name.setBasionymAuthorTeam(matchMatrix.duplicateBasionymAuthorTeams.iterator().next());
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
-               
+
                if(matchMatrix.duplicateExBasionymAuthorTeams.size() > 0){
                        name.setExBasionymAuthorTeam(matchMatrix.duplicateExBasionymAuthorTeams.iterator().next());
                        // FIXME TODO resolve multiple duplications. We use first match for a start.
                }
        }
-       
-       /** 
+
+       /**
         * Splits a NonViralName into its parts and calls methods to find matches for these
         * parts in the database.
-        * 
+        *
         * @param name  The NonViralName to find matches for.
         */
        private MatchMatrix findMatches(NonViralName name){
-               
+
                MatchMatrix matchMatrix = new MatchMatrix();
-               
+
                matchMatrix.duplicateNames = findMatchingLatinNames(name);
-               
-               matchMatrix.duplicateCombinationAuthorTeams = findMatchingAuthors((TeamOrPersonBase) name.getCombinationAuthorTeam());
-               matchMatrix.duplicateExCombinationAuthorTeams = findMatchingAuthors((TeamOrPersonBase) name.getExCombinationAuthorTeam());
-               matchMatrix.duplicateBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) name.getBasionymAuthorTeam());
-               matchMatrix.duplicateExBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) name.getExBasionymAuthorTeam());
-               
+
+               matchMatrix.duplicateCombinationAuthorTeams = findMatchingAuthors(name.getCombinationAuthorTeam());
+               matchMatrix.duplicateExCombinationAuthorTeams = findMatchingAuthors(name.getExCombinationAuthorTeam());
+               matchMatrix.duplicateBasionymAuthorTeams = findMatchingAuthors(name.getBasionymAuthorTeam());
+               matchMatrix.duplicateExBasionymAuthorTeams = findMatchingAuthors(name.getExBasionymAuthorTeam());
+
                INomenclaturalReference nomenclaturalReference = name.getNomenclaturalReference();
-               
-               // check if the reference has an inreference and also check if the inReference already exists 
+
+               // check if the reference has an inreference and also check if the inReference already exists
                if(nomenclaturalReference != null){
                        Reference inReference = ((Reference)nomenclaturalReference).getInReference();
                        if(inReference != null){
@@ -286,18 +287,20 @@ public class ParseHandler{
                                matchMatrix.duplicateInReferences = findMatchingNomenclaturalReference(inReference);
                        }
                }
-               
+
                matchMatrix.duplicateReferences = findMatchingNomenclaturalReference(nomenclaturalReference);
-               
+
                return matchMatrix;
        }
-       
+
        /**
         * @param nomenclaturalReference        The NomenclaturalReference to find matches for.
         * @return      A <code>List</code> of possibly matching NomenclaturalReference's.
         */
        private List<INomenclaturalReference> findMatchingNomenclaturalReference(INomenclaturalReference nomenclaturalReference) {
-               if(nomenclaturalReference == null) return new ArrayList<INomenclaturalReference>();
+               if(nomenclaturalReference == null) {
+            return new ArrayList<INomenclaturalReference>();
+        }
                try{
                        return CdmStore.getService(ICommonService.class).findMatching(nomenclaturalReference, MatchStrategyConfigurator.ReferenceMatchStrategy());
                }catch (MatchException e) {
@@ -315,7 +318,7 @@ public class ParseHandler{
                if(authorTeam == null){
                        return new ArrayList<TeamOrPersonBase>();
                }
-               
+
                try{
                        return CdmStore.getService(ICommonService.class).findMatching(authorTeam, MatchStrategyConfigurator.TeamOrPersonMatchStrategy());
                }catch (MatchException e) {
@@ -332,7 +335,7 @@ public class ParseHandler{
 
                try {
                        return CdmStore.getService(ICommonService.class).findMatching(taxonNameBase, MatchStrategyConfigurator.NonViralNameMatchStrategy());
-                       
+
                } catch (MatchException e) {
                        MessagingUtils.error(this.getClass(), "Error finding matching names", e);
                }
index acf22fdb817f525016477f62757f37e0720a723f..c8a7fc5b2fd1cfe72070784482bc38c0b2756e31 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * 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.
  */
@@ -44,11 +44,11 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.wizard.VocabularyTermWizard;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
@@ -63,17 +63,17 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
 
        private Button toggleButton;
        protected HashMap<DefinedTermBase<T>, Button> menuButtons;
-       
+
        protected Button newButton;
        protected Button editButton;
        protected Button removeButton;
-               
+
        protected CheckboxTableViewer tableViewer;
-       
+
        private boolean state = true;
-       private boolean vocabularyIsEditable;
+       private final boolean vocabularyIsEditable;
        private ConversationHolder conversation;
-       
+
        /**
         * Constructs a new menu preference page.
         *
@@ -93,7 +93,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                vocabularyIsEditable = editable;
                setDescription(description);
        }
-       
+
        protected List<T> getTerms(){
                return TermStore.getTerms(getTermClass());
        }
@@ -105,38 +105,40 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
         */
        @Override
        public Control createContents(Composite parent) {
-               
+
                Composite container = new Composite(parent, SWT.NULL);
                final GridLayout gridLayout = new GridLayout();
                gridLayout.numColumns = 2;
                container.setLayout(gridLayout);
-       
+
                tableViewer = CheckboxTableViewer.newCheckList(container, SWT.NULL);
                GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
                tableLayoutData.heightHint = 300;
                tableViewer.getTable().setLayoutData(tableLayoutData);
-               
+
                tableViewer.setContentProvider(new DefinedTermBaseContentProvider());
                tableViewer.setLabelProvider(new DefinedTermBaseLabelProvider());
 
                refresh(getTerms());
-               
+
                tableViewer.addCheckStateListener(new ICheckStateListener() {
-                       
+
                        @Override
                        public void checkStateChanged(CheckStateChangedEvent arg0) {
                                checkNoneChecked();
                        }
                });
-               
+
                Composite buttonContainer = new Composite(container, SWT.NULL);
                GridData buttonContainerLayoutData = new GridData();
                buttonContainerLayoutData.verticalAlignment = SWT.TOP;
                buttonContainer.setLayoutData(buttonContainerLayoutData);
                buttonContainer.setLayout(new GridLayout());
-               
-               if(vocabularyIsEditable) createEditButtons(buttonContainer);
-               
+
+               if(vocabularyIsEditable) {
+            createEditButtons(buttonContainer);
+        }
+
                toggleButton = new Button(buttonContainer, SWT.PUSH);
                toggleButton.setText("Toggle");
                toggleButton.addSelectionListener(new SelectionAdapter(){
@@ -150,9 +152,9 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                                checkNoneChecked();
                        }
                });
-               
+
                createAdditionalContent(container);
-               
+
                return container;
        }
 
@@ -175,7 +177,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
         * @param container a {@link org.eclipse.swt.widgets.Composite} object.
         */
        protected void createAdditionalContent(Composite container) {
-               // implement where needed               
+               // implement where needed
        }
 
        /* (non-Javadoc)
@@ -206,18 +208,18 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                         */
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), getConversationHolder()); 
-                               
-                               WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
+                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), getConversationHolder());
+
+                               WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
                            if(dialog.open() == IStatus.OK){
                                tableViewer.setInput(getTerms());
                            }
                        }
 
-                       
+
                });
        }
-       
+
        /**
         * Implement this method in MenuPreference Pages where the vocabulary should be editable, editable flag
         * is set.
@@ -229,23 +231,23 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                         */
                        @Override
                        public void widgetSelected(SelectionEvent event) {
-                               
-                               ICommandService commandService = (ICommandService)  StoreUtil.getService(ICommandService.class);
+
+                               ICommandService commandService = (ICommandService)  AbstractUtility.getService(ICommandService.class);
 
                                Command command = commandService.getCommand(DefinedTermEditor.OPEN_COMMAND_ID);
-                               
+
                                IParameter parameter;
                                try {
                                        parameter = command.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid");
-                               
+
                                        Parameterization[] parameterizations = new Parameterization[]{
                                                        new Parameterization(parameter, TermType.valueOf(getTermClass().getSimpleName()).getUuid().toString())
                                        };
-                                       
+
                                        ParameterizedCommand pCommand = new ParameterizedCommand(command, parameterizations);
-                                       
+
                                        if (command.isEnabled()) {
-                                               IHandlerService handlerService = (IHandlerService) StoreUtil.getService(IHandlerService.class);
+                                               IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
                                                try {
                                                        handlerService.executeCommand(pCommand, null);
                                                } catch (NotDefinedException e) {
@@ -264,13 +266,14 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                                                        "An exception occured while trying to open the Term Editor",
                                                        e);
                                }
-                               
+
                        }
                });
        }
 
        /** {@inheritDoc} */
-       public void init(IWorkbench workbench) {
+       @Override
+    public void init(IWorkbench workbench) {
                setPreferenceStore(PreferencesUtil.getPreferenceStore());
                getConversationHolder().bind();
        }
@@ -282,7 +285,8 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
        /**
         * <p>performDefaults</p>
         */
-       protected void performDefaults() {
+       @Override
+    protected void performDefaults() {
                tableViewer.setAllChecked(true);
        }
 
@@ -304,23 +308,23 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                if(checkNoneChecked()){
                        return false;
                }
-               
+
                getConversationHolder().commit(true);
-               
+
                List<T> preferredTerms = new ArrayList<T>();
                for (Object element : getTableViewer().getCheckedElements()){
                        preferredTerms.add((T) element);
                }
-               
+
                CdmStore.getTermManager().setPreferredTerms(preferredTerms, getTerms());
-               
+
                PreferencesUtil.firePreferencesChanged(this.getClass());
-               
+
                return true;
        }
-       
+
        private boolean checkNoneChecked(){
-               
+
                if(tableViewer.getCheckedElements().length == 0){
                        setMessage("Please check at least one item", WARNING);
                        return true;
@@ -329,14 +333,14 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                        return false;
                }
        }
-       
+
        /**
         * <p>getTermClass</p>
         *
         * @return a {@link java.lang.Class} object.
         */
        protected abstract Class<T> getTermClass();
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
         */
@@ -347,7 +351,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                }
                return conversation;
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
         */
index 00a999bd835a197d2a17f7243d8f25cea94fedcd..8b151109d24e2cf12f5d26087a06c041ea6319ae 100644 (file)
@@ -17,8 +17,6 @@ import java.util.EnumSet;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.swt.widgets.Display;
-import org.hibernate.collection.internal.AbstractPersistentCollection;
-import org.hibernate.proxy.AbstractLazyInitializer;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 import org.springframework.security.access.PermissionEvaluator;
@@ -32,7 +30,6 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IService;
 import eu.etaxonomy.cdm.config.ICdmSource;
 import eu.etaxonomy.cdm.database.DbSchemaValidation;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
 import eu.etaxonomy.cdm.ext.geo.IEditGeoService;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Language;
@@ -100,7 +97,7 @@ public class CdmStore {
        protected static CdmStore getDefault() {
                if (instance != null && instance.isConnected) {
                        return instance;
-               } else if (instance == null || !instance.isConnected) {
+               } else{// if (instance == null || !instance.isConnected) {
 
                        MessagingUtils
                                        .warningDialog(
@@ -110,10 +107,8 @@ public class CdmStore {
                                                        + "connected to a datasource. You may choose a datasource to connect to or create a new one in the datasource view.");
 
                        AbstractUtility.showView(CdmDataSourceViewPart.ID);
-
+                       return null;
                }
-
-               throw new RuntimeException();
        }
 
        /**
@@ -129,7 +124,7 @@ public class CdmStore {
                        MessagingUtils.messageDialog("Connection to CDM Source Failed", CdmStore.class, "Could not connect to target CDM Source", e);
                }
 
-               
+
        }
 
        /**
@@ -203,7 +198,7 @@ public class CdmStore {
 
        private CdmStore(ICdmApplicationConfiguration applicationController,
                        ICdmSource cdmSource) {
-               this.applicationConfiguration = applicationController;          
+               this.applicationConfiguration = applicationController;
                this.cdmSource = cdmSource;
                isConnected = true;
        }
@@ -512,7 +507,7 @@ public class CdmStore {
                }
                return null;
        }
-       
+
        /**
         * <p>
         * getDataSource
index 91316ef4295e71f11807aabf8da11734c480e39e..5aab63bc8e094599ba57b38e9a5f651e7c4686e7 100644 (file)
@@ -29,6 +29,7 @@ import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurato
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.RelationshipBase;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
@@ -97,7 +98,7 @@ public class SearchManager {
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
         * @return a {@link java.util.List} object.
         */
-       public List<UuidAndTitleCache<TaxonBase>> findTaxaAndNames(IFindTaxaAndNamesConfigurator<TaxonBase> configurator){
+       public List<UuidAndTitleCache<IdentifiableEntity>> findTaxaAndNames(IFindTaxaAndNamesConfigurator<TaxonBase> configurator){
                return CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator);
        }
 
index db37406d42e9673f27a5e6c072bef21039db4c17..a4754ca91b16209fce35b94e9232401cd6015c84 100644 (file)
@@ -84,10 +84,10 @@ public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelecti
        protected String getTitle(Reference cdmObject) {
                if(cdmObject == null){
                        return "";
-               }else if(cdmObject.getAuthorTeam() == null){
+               }else if(cdmObject.getAuthorship() == null){
                        return super.getTitle(cdmObject);
                }else{
-                       return ReferenceDefaultCacheStrategy.putAuthorToEndOfString(cdmObject.getTitleCache(), cdmObject.getAuthorTeam().getTitleCache());
+                       return ReferenceDefaultCacheStrategy.putAuthorToEndOfString(cdmObject.getTitleCache(), cdmObject.getAuthorship().getTitleCache());
                }
        }
 
index 6cb8a02a346cafc51eeeb32c35052c4351d7e754..03f76ed7ce5a57d1fe595afa9768eed9e01d7775 100644 (file)
@@ -37,6 +37,7 @@ import org.eclipse.ui.forms.widgets.ExpandableComposite;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.internal.forms.widgets.FormFonts;
+import org.joda.time.DateTime;
 import org.joda.time.Partial;
 import org.springframework.security.core.GrantedAuthority;
 
@@ -56,6 +57,7 @@ import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IEnumTerm;
 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
+import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.common.Marker;
@@ -85,6 +87,7 @@ import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
 import eu.etaxonomy.cdm.model.media.Rights;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.name.NameRelationship;
 import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
 import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
@@ -100,8 +103,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
-import eu.etaxonomy.taxeditor.ui.mvc.OriginalLabelDataController;
-import eu.etaxonomy.taxeditor.ui.mvc.OriginalLabelDataElement;
+import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
 import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
 import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
@@ -239,11 +241,16 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDeta
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.CurrentSampleDesignationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationHistoryDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationTextDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
@@ -1812,6 +1819,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
+    public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
     public PreservedSpecimenDeterminationDetailSection createPreservedSpecimenDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         PreservedSpecimenDeterminationDetailSection section = new PreservedSpecimenDeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
@@ -2157,6 +2170,12 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+    public OriginalLabelDataElement createOriginalLabelDataElement(ICdmFormElement parentElement) {
+        OriginalLabelDataElement element = new OriginalLabelDataElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
     public PreservedSpecimenDetailElement createPreservedSpecimenDetailElement(ICdmFormElement parentElement) {
         PreservedSpecimenDetailElement element = new PreservedSpecimenDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
@@ -2175,6 +2194,12 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+    public SampleDesignationDetailElement createSampleDesignationDetailElement(ICdmFormElement parentElement) {
+        SampleDesignationDetailElement element = new SampleDesignationDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
     /**
      * @param parentElement
      * @param element
@@ -2329,6 +2354,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
+    public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
     public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
         CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
         addAndAdaptSection(parentElement, section);
@@ -2341,6 +2372,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
+    public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
     public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
         DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
         addAndAdaptSection(parentElement, section);
@@ -2551,6 +2588,8 @@ public class CdmFormFactory extends FormToolkit {
             if (descriptionElement.getFeature().equals(Feature.PROTOLOGUE())) {
                 element = new ProtologueElement(this, parentElement, descriptionElement, removeListener, style);
             }
+        } else if (entity instanceof Identifier) {
+            element = new SampleDesignationTextDetailElement(this, parentElement, (Identifier<DnaSample>) entity, removeListener, backgroundColor, style);
         }
 
         if (element == null) {
@@ -2639,6 +2678,14 @@ public class CdmFormFactory extends FormToolkit {
         return labelElement;
     }
 
+    public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
+        Label label = new Label(formElement.getLayoutComposite(), style);
+        label.setText(labelText+" (yyyy-MM-dd)");
+        DateElement dateElement = new DateElement(formElement.getLayoutComposite(), dateTime, style);
+        dateElement.initController(this, formElement);
+        return dateElement;
+    }
+
     /**
      * <p>
      * Getter for the field <code>selectionProvider</code>.
@@ -2729,14 +2776,4 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    /**
-     * @param parentElement
-     * @return
-     */
-    public OriginalLabelDataController createOriginalLabelDataController(AbstractCdmDetailSection<DerivedUnitFacade> parentElement) {
-        OriginalLabelDataElement originalLabelDataElement = new OriginalLabelDataElement(parentElement.getLayoutComposite(), SWT.NONE);
-        originalLabelDataElement.initController(this, parentElement);
-        return originalLabelDataElement.getController();
-    }
-
 }
index bd16aa177bad08711ced3edfd7773859ac7d8276..a3b2e3e6b4979f1b8e72ce1041b2ae719ec418e5 100644 (file)
@@ -62,12 +62,12 @@ public class MinMaxTextSection extends AbstractFormSection<DerivedUnitFacade> {
                switch(unitType) {
                        case ELEVATION:
                                text_minVal = formFactory.createNumberTextWithLabelElement(this, "Min [m] : ", getMinimum(), style);
-                               text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);    
+                               text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);
                                break;
                        default:
                                text_minVal = formFactory.createNumberTextWithLabelElement(this, "Min [m] : ", getMinimum(), style);
-                               text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);                                                            
-                               break;                  
+                               text_maxVal = formFactory.createNumberTextWithLabelElement(this, "Max [m] : ", getMaximum(), style);
+                               break;
                }
                text_freeText = formFactory.createTextWithLabelElement(this,
                                "Freetext : ", getFreetext(), style);
@@ -87,6 +87,7 @@ public class MinMaxTextSection extends AbstractFormSection<DerivedUnitFacade> {
        public void setEntity(DerivedUnitFacade gatheringEvent) {
                super.setEntity(gatheringEvent);
                updateValues();
+               updateTitle();
        }
 
        private void updateValues() {
@@ -166,10 +167,26 @@ public class MinMaxTextSection extends AbstractFormSection<DerivedUnitFacade> {
                } else if (eventSource == text_freeText) {
                        updateFreetext();
                }
+        updateTitle();
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
 
-
+    private void updateTitle(){
+        String title = "";
+        if(text_minVal.getText()!=null){
+            title += text_minVal.getText();
+        }
+        if(text_maxVal.getText()!=null && !text_maxVal.getText().equals("")){
+            if(!title.equals("")){
+                title += " - "+text_maxVal.getText();
+            }
+        }
+        if(title.equals("") && text_freeText.getText()!=null){
+            title = text_freeText.getText();
+        }
+        this.setText(title);
+        layout();
+    }
 
        /*
         * (non-Javadoc)
@@ -186,7 +203,7 @@ public class MinMaxTextSection extends AbstractFormSection<DerivedUnitFacade> {
        private void updateMinimum() {
                switch(unitType) {
                case ELEVATION:
-                       getEntity().setAbsoluteElevation(text_minVal.getDouble().intValue());
+                       getEntity().setAbsoluteElevation(text_minVal.getDouble()!=null?text_minVal.getDouble().intValue():null);
                        break;
                case DIST_TO_GROUND:
                        getEntity().setDistanceToGround(text_minVal.getDouble());
@@ -215,7 +232,7 @@ public class MinMaxTextSection extends AbstractFormSection<DerivedUnitFacade> {
        private void updateMaximum() {
                switch(unitType) {
                case ELEVATION:
-                       getEntity().setAbsoluteElevationMax(text_maxVal.getDouble().intValue());
+                       getEntity().setAbsoluteElevationMax(text_maxVal.getDouble()!=null?text_maxVal.getDouble().intValue():null);
                        break;
                case DIST_TO_GROUND:
                        getEntity().setDistanceToGroundMax(text_maxVal.getDouble());
index e5f21b4deb11fce9d0aa3be249f39b03becc9248..57fade3d9416c81b3dc0ac9d1918352cee360288 100644 (file)
@@ -57,35 +57,47 @@ public class NumberWithLabelElement extends TextWithLabelElement {
        }
 
        /**
-        * <p>getInteger</p>
-        *
-        * @return a {@link java.lang.Integer} object.
+        * Get the value of this field as an {@link Integer}.
+        * @return the Integer value or null if {@link NumberFormatException} occurs.
         */
        public Integer getInteger() {
                String text = super.getText().trim();
-               return text.equals("") ? 0 : new Integer(text);
+               try {
+                   return text.equals("") ? 0 : new Integer(text);
+        } catch (NumberFormatException e) {
+            exception = e;
+        }
+               return null;
        }
 
        /**
-        * <p>getFloat</p>
-        *
-        * @return a {@link java.lang.Float} object.
+        * Get the value of this field as a {@link Float}.
+        * @return the Float value or null if {@link NumberFormatException} occurs.
         */
        public Float getFloat(){
-               String text = super.getText();
-               return new Float(text);
+           String text = super.getText();
+           try {
+               return new Float(text);
+           } catch (NumberFormatException e) {
+               exception = e;
+           }
+           return null;
        }
 
        /**
-        * <p>getDouble</p>
-        *
-        * @return a {@link java.lang.Float} object.
+        * Get the value of this field as an {@link Double}.
+        * @return the Double value or null if {@link NumberFormatException} occurs.
         */
        public Double getDouble(){
-               String text = super.getText();
-               return new Double(text);
+           String text = super.getText();
+           try {
+               return new Double(text);
+           } catch (NumberFormatException e) {
+               exception = e;
+           }
+           return null;
        }
-       
+
        private String getStringRepresentation(Object number){
                if(number != null){
                        return number.toString();
@@ -102,20 +114,22 @@ public class NumberWithLabelElement extends TextWithLabelElement {
                String value = text.getText();
                if(StringUtils.isBlank(value)){
                        text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+                       super.modifyText(event);
                        return;
                }
 
                try{
 
-                       Float number = Float.parseFloat(value);
+                       Float number = Float.parseFloat(value);
 
                        if((start != null && number < start) || (end != null && number > end)){
-                               throw new NumberFormatException("You entered a number that is not within the allowed bounds.");
+                               exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");
+                               throw exception;
                        }
 
                }catch(NumberFormatException e){
                        text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-                       firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
+                       firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event));
                        exception = e;
                        return;
                }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/OriginalLabelDataElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/OriginalLabelDataElement.java
new file mode 100644 (file)
index 0000000..e5753d1
--- /dev/null
@@ -0,0 +1,63 @@
+// $Id$
+/**
+ * Copyright (C) 2014 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.ui.element;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.mvc.OriginalLabelDataField;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date 17.06.2014
+ *
+ */
+public class OriginalLabelDataElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+    private TextWithLabelElement textOriginalLabelData;
+
+    /**
+     * @param formFactory
+     * @param formElement
+     */
+    public OriginalLabelDataElement(CdmFormFactory formFactory,
+            ICdmFormElement formElement) {
+        super(formFactory, formElement);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
+     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
+     */
+    @Override
+    protected void createControls(ICdmFormElement formElement,
+            DerivedUnitFacade entity, int style) {
+        new OriginalLabelDataField(formElement.getLayoutComposite(), style, entity.innerDerivedUnit(), getFormFactory());
+//        textOriginalLabelData = formFactory.createTextWithLabelElement(formElement,
+//                "Original Label Data", entity.innerDerivedUnit().getOriginalLabelInfo(), SWT.MULTI);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+     * .lang.Object)
+     */
+    @Override
+    public void handleEvent(Object eventSource) {
+        if (eventSource == textOriginalLabelData) {
+            getEntity().innerDerivedUnit().setOriginalLabelInfo(textOriginalLabelData.getText());
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataController.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataController.java
deleted file mode 100644 (file)
index d085ec3..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2014 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.ui.mvc;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.mvc.interfaces.CdmCompositeController;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 17.06.2014
- *
- */
-public class OriginalLabelDataController extends AbstractCdmDetailElement<DerivedUnitFacade> implements CdmCompositeController{
-
-    private final OriginalLabelDataElement originalLabelDataElement;
-
-    /**
-     * @param dateTimeElement
-     * @param formFactory
-     * @param parentElement
-     * @param initialDateTime
-     * @param none
-     */
-    public OriginalLabelDataController(CdmFormFactory formFactory, ICdmFormElement parentElement, OriginalLabelDataElement originalLabelDataElement, int style) {
-        super(formFactory, parentElement);
-        this.originalLabelDataElement = originalLabelDataElement;
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.element.IRelevantFormElement#setIrrelevant(boolean)
-     */
-    @Override
-    public void setIrrelevant(boolean irrelevant) {
-        // TODO Auto-generated method stub
-
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#setEnabled(boolean)
-     */
-    @Override
-    public void setEnabled(boolean enabled) {
-        originalLabelDataElement.setEnabled(enabled);
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
-     */
-    @Override
-    public boolean isEnabled() {
-        return originalLabelDataElement.isEnabled();
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, java.lang.Object, int)
-     */
-    @Override
-    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-        originalLabelDataElement.getText().setText(entity.getTitleCache());
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
-     */
-    @Override
-    public void handleEvent(Object eventSource) {
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataElement.java
deleted file mode 100644 (file)
index d064f6d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2014 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.ui.mvc;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-
-/**
- * @author pplitzner
- * @date 17.06.2014
- *
- */
-public class OriginalLabelDataElement extends AbstractCdmComposite<OriginalLabelDataController>{
-    private final Text text;
-
-    /**
-     * @param parent
-     * @param style
-     */
-    public OriginalLabelDataElement(Composite parent, int style) {
-        super(parent, style);
-        {
-            TableWrapLayout tableWrapLayout = new TableWrapLayout();
-            tableWrapLayout.verticalSpacing = 0;
-            tableWrapLayout.topMargin = 0;
-            tableWrapLayout.rightMargin = 0;
-            tableWrapLayout.leftMargin = 0;
-            tableWrapLayout.horizontalSpacing = 0;
-            tableWrapLayout.bottomMargin = 0;
-            tableWrapLayout.numColumns = 3;
-            setLayout(tableWrapLayout);
-        }
-
-        Label lblOriginalLabelData = new Label(this, SWT.NONE);
-        lblOriginalLabelData.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
-        lblOriginalLabelData.setText("Original Label Data");
-
-        text = new Text(this, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
-        text.setEditable(false);
-        text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        new Label(this, SWT.NONE);
-
-        // TODO Auto-generated constructor stub
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.mvc.AbstractCdmComposite#initInternalController(eu.etaxonomy.taxeditor.ui.element.CdmFormFactory, eu.etaxonomy.taxeditor.ui.element.ICdmFormElement)
-     */
-    @Override
-    protected void initInternalController(CdmFormFactory formFactory, ICdmFormElement parentElement) {
-        controller = new OriginalLabelDataController(formFactory, parentElement, this, SWT.NONE);
-    }
-
-    public Text getText() {
-        return text;
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/OriginalLabelDataField.java
new file mode 100644 (file)
index 0000000..3603e4d
--- /dev/null
@@ -0,0 +1,113 @@
+// $Id$
+/**
+* Copyright (C) 2014 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.ui.mvc;
+
+import java.util.List;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.BeansObservables;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.databinding.swt.SWTObservables;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
+
+/**
+ * @author pplitzner
+ * @date 23.06.2014
+ *
+ */
+public class OriginalLabelDataField extends Composite {
+
+    private DataBindingContext m_bindingContext;
+    private DerivedUnit derivedUnit = null;
+    private final Text originalLabelInfoText;
+    private CdmFormFactory formFactory;
+
+    public OriginalLabelDataField(Composite parent, int style, DerivedUnit newDerivedUnit, CdmFormFactory formFactory) {
+        this(parent, style);
+        setDerivedUnit(newDerivedUnit);
+        this.formFactory = formFactory;
+    }
+
+    public OriginalLabelDataField(Composite parent, int style) {
+        super(parent, style);
+        setLayout(new GridLayout(2, false));
+
+        new Label(this, SWT.NONE).setText("Original Label Data");
+
+        originalLabelInfoText = new Text(this, SWT.BORDER | SWT.WRAP | SWT.MULTI);
+        originalLabelInfoText.addModifyListener(new ModifyListener() {
+            @Override
+            public void modifyText(ModifyEvent e) {
+                if(formFactory!=null){
+                    List<IPropertyChangeListener> propertyChangeListeners = formFactory.getPropertyChangeListeners();
+                    for (IPropertyChangeListener iPropertyChangeListener : propertyChangeListeners) {
+                        iPropertyChangeListener.propertyChange(new CdmPropertyChangeEvent(OriginalLabelDataField.this, e));
+                    }
+                }
+            }
+        });
+        originalLabelInfoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+        if (derivedUnit != null) {
+            m_bindingContext = initDataBindings();
+        }
+    }
+
+    @Override
+    protected void checkSubclass() {
+        // Disable the check that prevents subclassing of SWT components
+    }
+
+    private DataBindingContext initDataBindings() {
+        IObservableValue originalLabelInfoObserveWidget = SWTObservables.observeText(originalLabelInfoText, SWT.Modify);
+        IObservableValue originalLabelInfoObserveValue = BeansObservables
+                .observeValue(derivedUnit, "originalLabelInfo");
+        //
+        DataBindingContext bindingContext = new DataBindingContext();
+        //
+        bindingContext.bindValue(originalLabelInfoObserveWidget, originalLabelInfoObserveValue, null, null);
+        //
+        return bindingContext;
+    }
+
+    public DerivedUnit getDerivedUnit() {
+        return derivedUnit;
+    }
+
+    public void setDerivedUnit(DerivedUnit newDerivedUnit) {
+        setDerivedUnit(newDerivedUnit, true);
+    }
+
+    public void setDerivedUnit(DerivedUnit newDerivedUnit, boolean update) {
+        derivedUnit = newDerivedUnit;
+        if (update) {
+            if (m_bindingContext != null) {
+                m_bindingContext.dispose();
+                m_bindingContext = null;
+            }
+            if (derivedUnit != null) {
+                m_bindingContext = initDataBindings();
+            }
+        }
+    }
+
+}
index 52edbe8a6f119c221a2eb5c5d8e97c780384f8fa..9fafead8120721bc81c7396822d2314201132347 100644 (file)
@@ -62,7 +62,7 @@ public class DateElement extends AbstractCdmComposite<DateElementController> {
             setLayout(tableWrapLayout);
         }
 
-        textDate = new Text(this, SWT.BORDER);
+        textDate = new Text(this, SWT.BORDER | SWT.WRAP);
         textDate.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
         toolkit.adapt(textDate, true, true);
     }
index 12bcab92169b0318100cbe566bc56d8b9d09055a..3bacbb7a91485e9881d40888cb4297d64531af7f 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -31,48 +31,48 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
  * @version 1.0
  */
 public class OpenUrlSelectorWizard extends Wizard {
-       
-       private MobotOpenUrlServiceWrapper openUrlServiceWrapper;
 
-       private MobotOpenUrlQuery query;
-       
+       private final MobotOpenUrlServiceWrapper openUrlServiceWrapper;
+
+       private final MobotOpenUrlQuery query;
+
        private OpenUrlReference openUrlReference;
-       
-       private CdmFormFactory formFactory;
+
+       private final CdmFormFactory formFactory;
 
        private URI openUrlReferenceImageUri;
-       
-       private Reference reference;
-       
-       private String referenceDetail;
-       
-       
-       
+
+       private final Reference reference;
+
+       private final String referenceDetail;
+
+
+
        /**
-        * @param openUrlSelectorElement 
+        * @param openUrlSelectorElement
         * @param reference
         */
        public OpenUrlSelectorWizard(Reference reference, String referenceDetail) {
                if(reference == null){
                        throw new IllegalArgumentException("Reference may not be empty");
                }
-               
+
                this.reference = reference;
                this.referenceDetail = referenceDetail;
-               
+
                setWindowTitle("Mobot Open Url");
                setNeedsProgressMonitor(true);
-               
+
                formFactory = new CdmFormFactory(Display.getDefault());
-               
+
                openUrlServiceWrapper = new MobotOpenUrlServiceWrapper();
                openUrlServiceWrapper.setBaseUrl(PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.OPENURL_ACCESS_POINT));
-               
+
                query  = new MobotOpenUrlQuery();
-               
+
                query.refType = ReferenceType.getReferenceType(reference);
-               if(reference.getAuthorTeam() != null){
-                       query.authorName = reference.getAuthorTeam().getTitleCache();
+               if(reference.getAuthorship() != null){
+                       query.authorName = reference.getAuthorship().getTitleCache();
                }
                query.abbreviation = reference.getTitle();
                if(reference.getInReference() != null){
@@ -86,19 +86,19 @@ public class OpenUrlSelectorWizard extends Wizard {
                query.publicationPlace = reference.getPlacePublished();
                query.publisherName = reference.getPublisher();
                query.volume = reference.getVolume();
-               
+
                query.startPage = referenceDetail;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.wizard.Wizard#addPages()
         */
        @Override
        public void addPages() {
-               
+
                addPage(new OpenUrlResultPage());
                addPage(new OpenUrlReferencePage());
-               
+
                super.addPages();
        }
 
index 34f1cbbcc2b2a3b05c392f1ca94c658796673ee9..1d4a8cc3388c4fcd9565413acfedad9edf98e9da 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -14,6 +14,7 @@ import java.util.Arrays;
 import java.util.Collection;
 
 import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.ToolBarManager;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.SWT;
@@ -46,43 +47,44 @@ public class CurrentDeterminationDetailSection extends
                        int style) {
                super(formFactory, conversation, parentElement, "Current Determination", style);
        }
-       
+
        @Override
        protected Control createToolbar() {
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-               
-               Action addAction = new Action("add", Action.AS_PUSH_BUTTON){
+
+               Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
                        /* (non-Javadoc)
                         * @see org.eclipse.jface.action.Action#run()
                         */
                        @Override
                        public void run() {
                                DeterminationEvent element = createNewElement();
-                               
+
                                // set as preferred determination
                                getEntity().setPreferredDetermination(element);
-                               
+
                                if(element != null){
-                                       if(! getSection().isExpanded())
-                                               getSection().setExpanded(true);
-                                       internalUpdateSection(true); 
+                                       if(! getSection().isExpanded()) {
+                        getSection().setExpanded(true);
+                    }
+                                       internalUpdateSection(true);
                                }
                        }
                };
                addAction.setImageDescriptor(new ImageDescriptor() {
-                       
+
                        @Override
                        public ImageData getImageData() {
                                return ImageResources.getImage(ImageResources.ADD_ICON).getImageData();
                        }
                });
                addAction.setToolTipText(getTooltipString());
-               
+
                toolBarManager.add(addAction);
-               
+
                return toolBarManager.createControl(this);
        }
-       
+
        @Override
        public void refresh() {
                internalUpdateSection(false);
@@ -96,7 +98,7 @@ public class CurrentDeterminationDetailSection extends
                DeterminationEvent preferredDetermination = entity.getPreferredDetermination();
                return preferredDetermination != null ? Arrays.asList(new DeterminationEvent[]{preferredDetermination}) : null;
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.ui.section.occurrence.AbstractDeterminationEventDetailSection#createNewElement()
         */
@@ -106,7 +108,7 @@ public class CurrentDeterminationDetailSection extends
                newElement.setPreferredFlag(true);
                return newElement;
        }
-       
+
 
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
index 00c732c4d3d3be9796a19b4c0228801778c11c67..a2be5ed29e1f1417ad5bb9efae318074bb3b323a 100644 (file)
@@ -51,7 +51,7 @@ public class DerivedUnitGeneralDetailElement extends
        private TextWithLabelElement text_accessionNumber;
        private GatheringEventUnitElement element_elevation;
 
-       
+
 
        /**
         * @param formFactory
@@ -75,9 +75,8 @@ public class DerivedUnitGeneralDetailElement extends
                toggleableText_titleCache = formFactory.createToggleableTextField(
                                formElement, "Title Cache", entity.getTitleCache(),
                                entity.isProtectedTitleCache(), style);
-               combo_specorobstype = formFactory
-                               .createEnumComboElement(SpecimenOrObservationType.class,
-                                               formElement, style);
+
+        combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
                combo_specorobstype.setSelection(entity.getType());
                selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
                                formElement, "Country",
@@ -89,7 +88,7 @@ public class DerivedUnitGeneralDetailElement extends
                                entity.getExactLocation(), style);
                element_elevation = formFactory.createGatheringEventUnitElement(
                                formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
-               
+
                element_date = formFactory.createTimePeriodElement(formElement, "Date",
                                entity.getGatheringPeriod(), style);
                selection_collector = formFactory
index d73d9ae5c5d1e7dc0b3ff06ce1a89bb45beb5e8b..e68552eb8649dca1603261beef1fe56d181f1b42 100644 (file)
@@ -65,6 +65,7 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
     protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
         toggleableText_titleCache = formFactory.createToggleableTextField(formElement, "Title Cache",
                 entity.getTitleCache(), entity.isProtectedTitleCache(), style);
+
         combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
         combo_specorobstype.setSelection(entity.getType());
         selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
@@ -74,7 +75,7 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
         element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style);
         element_elevation = formFactory.createGatheringEventUnitElement(
                                formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
-               
+
         element_date = formFactory.createTimePeriodElement(formElement, "Date", entity.getGatheringPeriod(), style);
         selection_collector = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement,
                 "Collector", entity.getCollector(), EntitySelectionElement.ALL, style);
index 635dfd4226ed0bead42cbf829bcacc6fb284af7e..e4c1602b27a5eaa2319885d334bf5a6e3fd4eb38 100644 (file)
@@ -43,26 +43,7 @@ public class OriginalLabelDataSection extends AbstractCdmDetailSection<DerivedUn
      */
     @Override
     public String getHeading() {
-        return "Original Label Data: ";
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
-     */
-    @Override
-    public void setText(String title) {
-        String text = getHeading();
-        if(getEntity()!=null){// && getEntity().getOriginalLabelData!=null){
-            String titleCache = getEntity().getTitleCache();
-            text += titleCache.substring(0, Math.min(10, titleCache.length()));
-            text += "...";
-        }
-        if(text!=null){
-            super.setText(text);
-        }
-        else{
-            super.setText(title);
-        }
+        return "Original Label Data";
     }
 
     /* (non-Javadoc)
@@ -70,7 +51,7 @@ public class OriginalLabelDataSection extends AbstractCdmDetailSection<DerivedUn
      */
     @Override
     protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-        return formFactory.createOriginalLabelDataController(parentElement);
+        return formFactory.createOriginalLabelDataElement(parentElement);
     }
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java
new file mode 100644 (file)
index 0000000..beae890
--- /dev/null
@@ -0,0 +1,64 @@
+// $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.ui.section.occurrence.dna;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.Identifier;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+
+/**
+ *
+ * @author pplitzner
+ * @date Oct 16, 2014
+ *
+ */
+public abstract class AbstractSampleDesignationDetailSection extends
+               AbstractEntityCollectionSection<IdentifiableEntity<?>, Identifier> {
+
+       public AbstractSampleDesignationDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       String title, int style) {
+               super(formFactory, conversation, parentElement, title, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
+        */
+       /** {@inheritDoc} */
+       @Override
+       public Identifier createNewElement() {
+           Identifier identifier = getEntity().addIdentifier(null, DerivateLabelProvider.getSampleDesignationTerm());
+               return identifier;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+        */
+       /** {@inheritDoc} */
+       @Override
+       public void removeElement(Identifier sampleDesignation) {
+               getEntity().removeIdentifier(sampleDesignation);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
+        */
+       /** {@inheritDoc} */
+       @Override
+       public String getEmptyString() {
+               return "No sample designations yet.";
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java
new file mode 100644 (file)
index 0000000..322631e
--- /dev/null
@@ -0,0 +1,77 @@
+// $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.ui.section.occurrence.dna;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.Identifier;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+
+/**
+ *
+ * @author pplitzner
+ * @date Oct 16, 2014
+ *
+ */
+public class CurrentSampleDesignationDetailSection extends AbstractSampleDesignationDetailSection {
+
+       public CurrentSampleDesignationDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       int style) {
+               super(formFactory, conversation, parentElement, "Current Sample Designation", style);
+       }
+
+       @Override
+       public void refresh() {
+               internalUpdateSection(false);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
+       @Override
+       public Collection<Identifier> getCollection(IdentifiableEntity<?> entity) {
+           Identifier currentSampleDesignation = DerivateLabelProvider.getCurrentSampleDesignation(entity);
+           if(currentSampleDesignation!=null){
+               return Collections.singleton(currentSampleDesignation);
+           }
+           else{
+               return Collections.emptyList();
+           }
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
+        */
+       /** {@inheritDoc} */
+       @Override
+       protected String getTooltipString() {
+               return "Create new current sample designation";
+       }
+
+          /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void addElement(Identifier sampleDesignation) {
+        //The current sample designation is always the first one found.
+        //The following are recent sample designations with the most recent being
+        //the second one found and so on
+        getEntity().addIdentifier(0, sampleDesignation);
+    }
+
+}
index ea6507c524925b1735f7eaf7c3e70984220a3d9e..039f2f745c00364d16aab23fcaad5a05bf2634a6 100644 (file)
@@ -9,9 +9,17 @@
 */
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
+import org.joda.time.DateTime;
+
+import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.molecular.DnaQuality;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 
 /**
@@ -21,6 +29,16 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
+    //TODO: add vocabulary
+//    private final TermType qualityTermVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.DnaQualityTerm.getUuid());
+
+    private TextWithLabelElement textPurificationMethod;
+    private NumberWithLabelElement numberRatioOfAbsorbance260_280;
+    private NumberWithLabelElement numberRatioOfAbsorbance260_230;
+    private NumberWithLabelElement numberConcentration;
+    private TermComboElement<DefinedTerm> comboQualityTerm;
+    private DateElement dateQualityCheck;
+
     /**
      * @param formFactory
      * @param formElement
@@ -38,14 +56,22 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
      */
     @Override
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
-        //TODO DNA purification details
-        //TODO Ratio of absorbance 260-280
-        //TODO Ratio of absorbance 260-230
-        //TODO concentration unit
-        //TODO concentration
-        //TODO DNA quality
-        //TODO Quality check date
-        //TODO Descritpion
+        DnaQuality dnaQuality = entity.getDnaQuality();
+        if(dnaQuality==null){
+            dnaQuality = DnaQuality.NewInstance();
+            entity.setDnaQuality(dnaQuality);
+        }
+        Double ratioOfAbsorbance260_230 = dnaQuality.getRatioOfAbsorbance260_230();
+        Double ratioOfAbsorbance260_280 = dnaQuality.getRatioOfAbsorbance260_280();
+        Double concentration = dnaQuality.getConcentration();
+        DefinedTerm qualityTerm = dnaQuality.getQualityTerm();
+
+//        textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "Purification Method", dnaQuality.getPurificationMethod(), style);
+        numberRatioOfAbsorbance260_280 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-280", ratioOfAbsorbance260_280, style);
+        numberRatioOfAbsorbance260_230 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-230", ratioOfAbsorbance260_230, style);
+        numberConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Concentration", concentration, style);
+//        comboQualityTerm = formFactory.createDefinedTermComboElement(qualityTermVocabulary, formElement, "Quality Term", qualityTerm, style);
+        dateQualityCheck = formFactory.createDateElement(formElement, "Quality Check", dnaQuality.getQualityCheckDate(), style);
     }
 
     /*
@@ -57,5 +83,26 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
      */
     @Override
     public void handleEvent(Object eventSource) {
+        DnaQuality dnaQuality = getEntity().getDnaQuality();
+        if(eventSource==textPurificationMethod){
+            //TODO
+//            dnaQuality.setPurificationMethod(textPurificationMethod.getText());
+        }
+        else if(eventSource==numberRatioOfAbsorbance260_230){
+            dnaQuality.setRatioOfAbsorbance260_230(numberRatioOfAbsorbance260_230.getDouble());
+        }
+        else if(eventSource==numberRatioOfAbsorbance260_280){
+            dnaQuality.setRatioOfAbsorbance260_280(numberRatioOfAbsorbance260_280.getDouble());
+        }
+        else if(eventSource==numberConcentration){
+            dnaQuality.setConcentration(numberConcentration.getDouble());
+        }
+        else if(eventSource==comboQualityTerm){
+            dnaQuality.setQualityTerm(comboQualityTerm.getSelection());
+        }
+        else if(eventSource==dateQualityCheck.getController()){
+            DateTime dateTime = dateQualityCheck.getController().getDateTime();
+            dnaQuality.setQualityCheckDate(dateTime);
+        }
     }
 }
index d0dd9c4dd32735fba4dbee5880b3c4bb6ba48dfb..3b5dc4d88b17fb69ed89ac15cfa7e0f4b5e96eed 100644 (file)
@@ -31,7 +31,6 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
-
     private TimePeriodElement datePreservationDate;
     private EntitySelectionElement<AgentBase> selectionPreparedBy;
     private NumberWithLabelElement numberPreservationTemperature;
@@ -56,7 +55,7 @@ public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaS
     @Override
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
         TimePeriod timePeriod = null;
-        AgentBase actor = null;
+        AgentBase<?> actor = null;
         Double temperature = null;
         DefinedTerm definedMaterialOrMethod = null;
         if(entity.getPreservation()!=null){
@@ -66,13 +65,13 @@ public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaS
             definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
         }
         datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preservation date", timePeriod, style);
-        // TODO sample designation
         selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared by", actor, EntitySelectionElement.ALL, style);
         numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
         comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
         //TODO preparation date
         //TODO sample type
         textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
+
     }
 
     /*
index 214dc06cbdeeed407a3461043adea97eee3473d4..3ec0627e43e062282c7d4089ee45a31441690c44 100644 (file)
@@ -10,7 +10,7 @@
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import eu.etaxonomy.cdm.model.molecular.Primer;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SequenceString;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -53,7 +53,7 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
         textPrimerName = formFactory.createTextWithLabelElement(formElement, "Primer Name", entity.getLabel(), style);
         String sequenceString = "";
         if(entity.getSequence()!=null){
-            sequenceString = entity.getSequence().getSequenceString();
+            sequenceString = entity.getSequence().getString();
         }
         textPrimerSequence = formFactory.createTextWithLabelElement(formElement, "Primer seq. 5'->3'", sequenceString, style);
 
@@ -77,12 +77,12 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
             getEntity().setLabel(textPrimerName.getText());
         }
         else if(eventSource==textPrimerSequence){
-            Sequence sequence = getEntity().getSequence();
-            if(sequence==null){
-                sequence = Sequence.NewInstance("");
-                getEntity().setSequence(sequence);
+            SequenceString sequenceString = getEntity().getSequence();
+            if(sequenceString==null){
+                sequenceString = SequenceString.NewInstance("");
+                getEntity().setSequence(sequenceString);
             }
-            sequence.setSequenceString(textPrimerSequence.getText());
+            sequenceString.setString(textPrimerSequence.getText());
         }
         else if(eventSource==selectionReference){
             getEntity().setPublishedIn(selectionReference.getSelection());
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailElement.java
new file mode 100644 (file)
index 0000000..3a12bfd
--- /dev/null
@@ -0,0 +1,69 @@
+// $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.ui.section.occurrence.dna;
+
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ *
+ * @author pplitzner
+ * @date Oct 20, 2014
+ *
+ */
+public class SampleDesignationDetailElement extends AbstractCdmDetailElement<IdentifiableEntity<?>> {
+
+       private CurrentSampleDesignationDetailSection sectionCurrentSampleDesignation;
+
+       private SampleDesignationHistoryDetailSection sectionSampleDesignationHistory;
+
+       /**
+        * @param formFactory
+        * @param formElement
+        */
+       public SampleDesignationDetailElement(CdmFormFactory formFactory,
+                       ICdmFormElement formElement) {
+               super(formFactory, formElement);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
+        */
+       @Override
+       protected void createControls(ICdmFormElement formElement,
+               IdentifiableEntity<?> entity, int style) {
+
+        sectionCurrentSampleDesignation = formFactory.createCurrentSampleDesignationDetailSection(getConversationHolder(), formElement, ExpandableComposite.EXPANDED);
+        sectionCurrentSampleDesignation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        sectionCurrentSampleDesignation.setEntity(entity);
+
+        sectionSampleDesignationHistory = formFactory.createSampleDesignationHistoryDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+        sectionSampleDesignationHistory.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        sectionSampleDesignationHistory.setEntity(entity);
+
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+        */
+       @Override
+       public void handleEvent(Object eventSource) {
+               if(eventSource == sectionCurrentSampleDesignation){
+                       sectionSampleDesignationHistory.refresh();
+               }
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationDetailSection.java
new file mode 100644 (file)
index 0000000..45f5731
--- /dev/null
@@ -0,0 +1,64 @@
+// $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.ui.section.occurrence.dna;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author n.hoffmann
+ * @created May 11, 2011
+ * @version 1.0
+ */
+public class SampleDesignationDetailSection extends AbstractCdmDetailSection<IdentifiableEntity<?>> {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param selectionProvider
+        * @param style
+        */
+       public SampleDesignationDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ISelectionProvider selectionProvider, int style) {
+               super(formFactory, conversation, parentElement, selectionProvider, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
+        */
+       @Override
+       public String getHeading() {
+               return "Sample Designations";
+       }
+
+       @Override
+    protected void setSectionTitle() {
+           this.setText(getHeading());
+           setTextClient(createToolbar());
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+        */
+       @Override
+       protected AbstractCdmDetailElement<IdentifiableEntity<?>> createCdmDetailElement(AbstractCdmDetailSection<IdentifiableEntity<?>> parentElement, int style) {
+           return formFactory.createSampleDesignationDetailElement(parentElement);
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java
new file mode 100644 (file)
index 0000000..77e44fa
--- /dev/null
@@ -0,0 +1,88 @@
+// $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.ui.section.occurrence.dna;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.Identifier;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+
+/**
+ * @author n.hoffmann
+ * @created May 11, 2011
+ * @version 1.0
+ */
+public class SampleDesignationHistoryDetailSection extends AbstractSampleDesignationDetailSection {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param style
+        */
+       public SampleDesignationHistoryDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       int style) {
+               super(formFactory, conversation, parentElement, "Sample Designation History", style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
+       @Override
+       public Collection<Identifier> getCollection(IdentifiableEntity<?> entity) {
+           LinkedList<Identifier> sampleDesignations = new LinkedList<Identifier>();
+           for (Identifier identifier : entity.getIdentifiers()) {
+               if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
+                   sampleDesignations.add(identifier);
+               }
+           }
+           if(sampleDesignations.size()>0){
+               sampleDesignations.removeFirst();//first is the current sample designation
+           }
+           return sampleDesignations;
+       }
+
+       @Override
+       public void refresh() {
+               internalUpdateSection(false);
+       }
+
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
+        */
+       /** {@inheritDoc} */
+       @Override
+       protected String getTooltipString() {
+               return "Add a sample designation to the history";
+       }
+
+       /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void addElement(Identifier sampleDesignation) {
+        //The current sample designation is always the first one found.
+        //The following are recent sample designations with the most recent being
+        //the second one found and so on
+        Identifier currentSampleDesignation = DerivateLabelProvider.getCurrentSampleDesignation(getEntity());
+        int indexOfCurrentSampleDesignation = getEntity().getIdentifiers().indexOf(currentSampleDesignation);
+        getEntity().addIdentifier(indexOfCurrentSampleDesignation+1, sampleDesignation);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationTextDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationTextDetailElement.java
new file mode 100644 (file)
index 0000000..ef54fb2
--- /dev/null
@@ -0,0 +1,81 @@
+// $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.ui.section.occurrence.dna;
+
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+
+import eu.etaxonomy.cdm.model.common.Identifier;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+
+/**
+ *
+ * @author pplitzner
+ * @date Oct 16, 2014
+ *
+ * @param <T>
+ */
+public class SampleDesignationTextDetailElement extends
+               AbstractEntityCollectionElement<Identifier> {
+
+    protected TextWithLabelElement text_description;
+
+       /**
+     * @param formFactory
+     * @param section
+     * @param entity
+     * @param removeListener
+     * @param backgroundColor
+     * @param style
+     */
+    public SampleDesignationTextDetailElement(CdmFormFactory formFactory, AbstractFormSection<?> section,
+            Identifier entity, SelectionListener removeListener, Color backgroundColor, int style) {
+        super(formFactory, section, entity, removeListener, backgroundColor, style);
+    }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see
+        * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
+        * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
+        */
+       /** {@inheritDoc} */
+       @Override
+       public void createControls(ICdmFormElement element, int style) {
+               text_description = formFactory.createTextWithLabelElement(element,
+                               "Sample Designation", null, style);
+       }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+     */
+    @Override
+    public void handleEvent(Object eventSource) {
+        if(eventSource==text_description){
+            this.entity.setIdentifier(text_description.getText());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+     */
+    @Override
+    public void setEntity(Identifier entity) {
+        this.entity = entity;
+        text_description.setText(entity.getIdentifier());
+    }
+
+}
index f03ea461d12c6aaedcf52fd31a41dfb45c268c87..10fb8e3c5259781dc118b01a65c00ec48964dd17 100644 (file)
@@ -9,10 +9,16 @@
 */
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.swt.widgets.Text;
+
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
 import eu.etaxonomy.cdm.model.molecular.SequenceString;
+import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -33,6 +39,9 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
     private NumberWithLabelElement textConsensusSequenceLength;
     private TextWithLabelElement textBarcodeSequence;
     private TextWithLabelElement textGeneticAccessNo;
+    private UriWithLabelElement textNCBIUri;
+    private UriWithLabelElement textENAUri;
+    private UriWithLabelElement textDDBJUri;
     private TextWithLabelElement textBoldProcessID;
     private UriWithLabelElement textBoldUri;
 
@@ -54,16 +63,35 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
     @Override
     protected void createControls(ICdmFormElement formElement, Sequence entity, int style) {
         comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
-        textConsensusSequence = formFactory.createTextWithLabelElement(formElement, "Consensus Sequence 5'->3'", entity.getConsensusSequence().getString(), style);
-        textConsensusSequenceLength = formFactory.createNumberTextWithLabelElement(formElement, "Consensus Seq. Length", entity.getConsensusSequence().getLength(), style);
-        textConsensusSequenceLength.setEnabled(false);
+//        textConsensusSequence = formFactory.createTextWithLabelElement(formElement, "Consensus Sequence 5'->3'", entity.getConsensusSequence().getString(), style);
+//        textConsensusSequenceLength = formFactory.createNumberTextWithLabelElement(formElement, "Consensus Seq. Length", entity.getConsensusSequence().getLength(), style);
+//        ((Text) textConsensusSequenceLength.getMainControl()).setEditable(false);
         textBarcodeSequence = formFactory.createTextWithLabelElement(formElement, "Barcode Sequence 5'->3'", entity.getBarcodeSequencePart()==null?"":entity.getBarcodeSequencePart().getString(), style);
 
+        URI genBankUri = null;
+        URI emblUri = null;
+        URI ddbjUri = null;
+        URI boldUri = null;
+        try{
+            genBankUri = entity.getGenBankUri();
+            emblUri = entity.getEmblUri();
+            ddbjUri = entity.getDdbjUri();
+            boldUri = entity.getBoldUri();
+        }
+        catch(URISyntaxException e){
+
+        }
         textGeneticAccessNo = formFactory.createTextWithLabelElement(formElement, "Genetic Acc. No.", entity.getGeneticAccessionNumber(), style);
+        textNCBIUri = formFactory.createUriWithLabelElement(formElement, "NCBI URI", genBankUri, style);
+        ((Text) textNCBIUri.getMainControl()).setEditable(false);
+        textENAUri = formFactory.createUriWithLabelElement(formElement, "ENA URI", emblUri, style);
+        ((Text) textENAUri.getMainControl()).setEditable(false);
+        textDDBJUri = formFactory.createUriWithLabelElement(formElement, "DDBJ URI", ddbjUri, style);
+        ((Text) textDDBJUri.getMainControl()).setEditable(false);
         textBoldProcessID = formFactory.createTextWithLabelElement(formElement, "BOLD Process ID", entity.getBoldProcessId(), style);
-        textBoldUri = formFactory.createUriWithLabelElement(formElement, "BOLD URI", entity.getBoldUri(), style);
-        textBoldUri.setEnabled(false);
-
+        textBoldUri = formFactory.createUriWithLabelElement(formElement, "BOLD URI", boldUri, style);
+        ((Text) textBoldUri.getMainControl()).setEditable(false);
+        ((Text) textBoldUri.getMainControl()).setToolTipText("Query BOLD");
     }
 
     /*
@@ -87,9 +115,6 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
             getEntity().setConsensusSequence(consensusSequence);
             textConsensusSequenceLength.setNumber(consensusSequence.getLength());
         }
-        else if(eventSource==textConsensusSequenceLength){
-            // this is a derived value and should not be edited
-        }
         else if(eventSource==textBarcodeSequence){
             SequenceString barcodeSequencePart = getEntity().getBarcodeSequencePart();
             if(barcodeSequencePart==null){
@@ -99,20 +124,37 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
             getEntity().setBarcodeSequencePart(barcodeSequencePart);
         }
         else if(eventSource==textGeneticAccessNo){
+            textGeneticAccessNo.setBackground(getPersistentBackground());
             getEntity().setGeneticAccessionNumber(textGeneticAccessNo.getText());
+            if(textGeneticAccessNo.getText()!=null && !textGeneticAccessNo.getText().isEmpty()){
+                try {
+                    textNCBIUri.setUri(getEntity().getGenBankUri());
+                    textENAUri.setUri(getEntity().getEmblUri());
+                    textDDBJUri.setUri(getEntity().getDdbjUri());
+                } catch (URISyntaxException e) {
+                    textGeneticAccessNo.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+                }
+            }
+            else{
+                textNCBIUri.setText("");
+                textENAUri.setText("");
+                textDDBJUri.setText("");
+            }
         }
         else if(eventSource==textBoldProcessID){
+            textBoldProcessID.setBackground(getPersistentBackground());
             getEntity().setBoldProcessId(textBoldProcessID.getText());
             if(textBoldProcessID.getText()!=null && !textBoldProcessID.getText().isEmpty()){
-                textBoldUri.setUri(getEntity().getBoldUri());
+                try {
+                    textBoldUri.setUri(getEntity().getBoldUri());
+                } catch (URISyntaxException e) {
+                    textBoldProcessID.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+                }
             }
             else{
                 textBoldUri.setText("");
             }
         }
-        else if(eventSource==textBoldUri){
-            //cannot be set because it is generated from the genetic access number and a base URI
-        }
     }
 
 }
index b4545e78fa2c73e7cf07acb00a7e40626d9ec2a1..f3e5de673c20b711b09a0793408e6d67d9c1e876 100644 (file)
@@ -11,15 +11,13 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import org.apache.log4j.Logger;
 
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.MethodNotSupportedByDerivedUnitTypeException;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -33,17 +31,15 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  * @date 16.12.2013
  *
  */
-public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
+public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
     static private final Logger logger = Logger.getLogger(TissueSampleGeneralDetailElement.class);
 
-    //title cache
-    //sample designation
+    private TermComboElement<DefinedTerm> comboKindOfTissue;
     private TimePeriodElement datePreparation;
     private EntitySelectionElement<AgentBase> selectionPreparedBy;
     private TermComboElement<DefinedTerm> comboPreservationMedium;
     private TimePeriodElement datePreservation;
-    private EntitySelectionElement<AgentBase> selectionStoredAt;
     private EntitySelectionElement<Collection> selectionCollection;
     private TextWithLabelElement textAccessionNumber;
     private TextWithLabelElement textBarcode;
@@ -65,24 +61,22 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
      * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
      */
     @Override
-    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-        //FIXME handle all parameters here and in handleEvent()
-        datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", null, style);
-        selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared By", null, EntitySelectionElement.ALL, style);
+    protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
+        //TODO handle all parameters here and in handleEvent()
+        comboKindOfTissue = formFactory.createDefinedTermComboElement(TermType.KindOfUnit, formElement, "Kind Of Tissue", entity.getKindOfUnit(), style);
+
         TimePeriod preservationDate = null;
         DefinedTerm preservationMedium = null;
-        try {
-            if(entity.getPreservationMethod()!=null){
-                preservationDate = entity.getPreservationMethod().getTimeperiod();
-                preservationMedium = entity.getPreservationMethod().getMedium();
-            }
-        } catch (MethodNotSupportedByDerivedUnitTypeException e) {
-            // we ignore this
-            MessagingUtils.info(e.getMessage());
+//        TimePeriod preparationDate = null;
+//        AgentBase preparedBy = null;
+        if(entity.getPreservation()!=null){
+            preservationDate = entity.getPreservation().getTimeperiod();
+            preservationMedium = entity.getPreservation().getMedium();
         }
+//        datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
+//        selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared By", preparedBy, EntitySelectionElement.ALL, style);
         comboPreservationMedium = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Preservation medium", preservationMedium, style);
         datePreservation = formFactory.createTimePeriodElement(formElement, "Preservation date", preservationDate, style);
-        selectionStoredAt = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Stored at", null, EntitySelectionElement.ALL, style);
         selectionCollection = formFactory.createSelectionElement(Collection.class, getConversationHolder(), formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
         textAccessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
         textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
@@ -98,34 +92,35 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
      */
     @Override
     public void handleEvent(Object eventSource) {
-//        if (eventSource==comboPreservationMedium) {
-//            addPreservationMethod().setMedium(comboPreservationMedium.getSelection());
-//        }
-//        else if (eventSource==datePreservation) {
-//            addPreservationMethod().setTimeperiod(datePreservation.getTimePeriod());
-//        }
-//        else if(eventSource==selectionCollection){
-//            getEntity().setCollection(selectionCollection.getSelection());
-//        }
-//        else if(eventSource==textAccessionNumber){
-//            getEntity().setAccessionNumber(textAccessionNumber.getText());
-//        }
-//        else if(eventSource==textBarcode){
-//            getEntity().setBarcode(textBarcode.getText());
-//        }
+        if(eventSource==comboKindOfTissue) {
+            getEntity().setKindOfUnit(comboKindOfTissue.getSelection());
+        }
+        else if(eventSource==selectionPreparedBy) {
+            addPreservationMethod().setActor(selectionPreparedBy.getSelection());
+        }
+        else if(eventSource==comboPreservationMedium) {
+            addPreservationMethod().setMedium(comboPreservationMedium.getSelection());
+        }
+        else if (eventSource==datePreservation) {
+            addPreservationMethod().setTimeperiod(datePreservation.getTimePeriod());
+        }
+        else if(eventSource==selectionCollection){
+            getEntity().setCollection(selectionCollection.getSelection());
+        }
+        else if(eventSource==textAccessionNumber){
+            getEntity().setAccessionNumber(textAccessionNumber.getText());
+        }
+        else if(eventSource==textBarcode){
+            getEntity().setBarcode(textBarcode.getText());
+        }
     }
 
     private PreservationMethod addPreservationMethod(){
         PreservationMethod preservationMethod = null;
-        try {
-            preservationMethod = getEntity().getPreservationMethod();
-            if(getEntity().getPreservationMethod()==null){
-                preservationMethod = PreservationMethod.NewInstance();
-                getEntity().setPreservationMethod(preservationMethod);
-            }
-        } catch (MethodNotSupportedByDerivedUnitTypeException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+        preservationMethod = getEntity().getPreservation();
+        if(getEntity().getPreservation()==null){
+            preservationMethod = PreservationMethod.NewInstance();
+            getEntity().setPreservation(preservationMethod);
         }
         return preservationMethod;
     }
index 5ae74b7566b1e55aa17ca61731b3308755107105..df89f176b17e246dd01b5649b1baf38a52618af7 100644 (file)
@@ -12,7 +12,7 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 import org.eclipse.jface.viewers.ISelectionProvider;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
@@ -23,7 +23,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
  * @date 12.12.2013
  *
  */
-public class TissueSampleGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> {
+public class TissueSampleGeneralDetailSection extends AbstractCdmDetailSection<DnaSample> {
 
     /**
      * @param formFactory
@@ -51,7 +51,7 @@ public class TissueSampleGeneralDetailSection extends AbstractCdmDetailSection<D
      * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
      */
     @Override
-    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+    protected AbstractCdmDetailElement<DnaSample> createCdmDetailElement(AbstractCdmDetailSection<DnaSample> parentElement, int style) {
         return formFactory.createTissueSampleGeneralDetailElement(parentElement);
     }
 
index fa748ef736fd5c4da507336fef72eeabc380131a..a1daa3a347e8a5d4d1bd01d023f5055c9537b0cc 100644 (file)
@@ -9,7 +9,6 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
 
-import org.eclipse.swt.widgets.Label;
 import org.joda.time.DateTime;
 
 import eu.etaxonomy.cdm.api.service.IVocabularyService;
@@ -79,13 +78,7 @@ public class MediaSpecimenGeneralDetailElement extends AbstractCdmDetailElement<
             comboKindOfUnit = formFactory.createDefinedTermComboElement(mediaSpecimenVocabulary, formElement, "Kind of Media", entity.getKindOfUnit(), style);
             textTitleLanguageString = formFactory.createLanguageStringWithLabelElement(formElement, "Motif", media.getTitle(), style);
             selectionArtist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared by", media.getArtist(), EntitySelectionElement.ALL, style);
-
-            Label label = new Label(getLayoutComposite(), style);
-            label.setText("Preparation Date (yyyy-mm-dd)");
-            date = new DateElement(formElement.getLayoutComposite(), entity.getMediaSpecimen().getMediaCreated(), style);
-            date.initController(formFactory, formElement);
-
-
+            date = formFactory.createDateElement(formElement, "Preparation Date", entity.getMediaSpecimen().getMediaCreated(), style);
             textMethodLanguageString = formFactory.createLanguageStringWithLabelElement(formElement, "Method", media.getDescription(Language.getDefaultLanguage()), style);
             selection_collection = formFactory.createSelectionElement(Collection.class, getConversationHolder(), formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
             text_accessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
index f497d941619b9b811ed108f61b26a8deafb70e47..31bd726b4aea5249f8ce22cc658bf36301a3497b 100644 (file)
@@ -129,7 +129,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                selection_authorTeam = formFactory
                                .createSelectionElement(AgentBase.class,
                                                getConversationHolder(), formElement, "Author",
-                                               AuthorHelper.getAuthor(entity.getAuthorTeam()),
+                                               AuthorHelper.getAuthor(entity.getAuthorship()),
                                                EntitySelectionElement.ALL, style);
 
                ReferenceType referenceType = entity.getType();
@@ -398,7 +398,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                }
                // selections
                else if (eventSource == selection_authorTeam) {
-                       getEntity().setAuthorTeam(
+                       getEntity().setAuthorship(
                                        (TeamOrPersonBase) selection_authorTeam.getSelection());
                } else if (eventSource == selection_inReference) {
                        getEntity().setInReference(selection_inReference.getSelection());
index cf694e94fe7b1af71a6a191bc58a317dec50d90c..9521b5345640461fd994727301b913de944b44ea 100644 (file)
@@ -72,6 +72,7 @@ public class UpdateDataSourceHandler extends AbstractDataSourceHandler {
 
                                                                CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
                                                                if(view != null){
+                                                                   container.getMetaDataFromDataSource();
                                                                        view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
                                                                }
 
index 29d858118abee0684e953b74abfc1c67a627c269..2d06fd31650d5461ff1bfef90095c9eef95f6da9 100644 (file)
@@ -20,11 +20,12 @@ import org.hibernate.LazyInitializationException;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
 import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
@@ -45,6 +46,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class DerivateLabelProvider extends ColumnLabelProvider {
 
+    private static final String NO_SAMPLE_DESIGNATION = "[no sample designation]";
+
     private Set<SingleRead> multiLinkSingleReads;
 
     private ConversationHolder conversation;
@@ -53,6 +56,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
     private static DefinedTerm drawingTerm = null;
     private static DefinedTerm specimenScanTerm = null;
     private static DefinedTerm detailImageTerm = null;
+    private static DefinedTerm sampleDesignationTerm = null;
 
     private static void initializeTerms() {
         List<DefinedTerm> preferredTerms = CdmStore.getTermManager().getPreferredTerms(DefinedTerm.class);
@@ -69,6 +73,9 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
             else if(definedTerm.getUuid().equals(UUID.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34"))){
                 detailImageTerm = definedTerm;
             }
+            else if(definedTerm.getUuid().equals(UUID.fromString("fadeba12-1be3-4bc7-9ff5-361b088d86fc"))){
+                sampleDesignationTerm = definedTerm;
+            }
         }
     }
 
@@ -100,6 +107,13 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         return detailImageTerm;
     }
 
+    public static DefinedTerm getSampleDesignationTerm(){
+        if(sampleDesignationTerm==null){
+            initializeTerms();
+        }
+        return sampleDesignationTerm;
+    }
+
 
     /** {@inheritDoc} */
     @Override
@@ -122,98 +136,152 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
 
     /**
      *
-     * @param element
+     * @param derivate
      * @return
      */
     public String getDerivateText(Object element){
+        //TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
+        TreeNode parentNode = null;
+        TreeNode node = null;
+        Object derivate = element;
         if(element instanceof TreeNode){
+            node = (TreeNode) element;
+            parentNode = node.getParent();
             //unwrap specimen from TreeNode
-            element = ((TreeNode) element).getValue();
+            derivate = node.getValue();
         }
 
         conversation.bind();
 
-        String label = "";
-        if(element instanceof FieldUnit){
-            FieldUnit fieldUnit = (FieldUnit)element;
+        final String emptyString = "";
+        final String separator = ", ";
+
+        String label = emptyString;
+
+        //Field Unit
+        if(derivate instanceof FieldUnit){
+            FieldUnit fieldUnit = (FieldUnit)derivate;
             if(fieldUnit.getGatheringEvent()!=null){
                 GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
-                if(!conversation.getSession().contains(gatheringEvent)){
+                if(CdmStore.getService(IOccurrenceService.class).exists(fieldUnit.getUuid()) && !conversation.getSession().contains(gatheringEvent)){
                     fieldUnit = (FieldUnit) CdmStore.getService(IOccurrenceService.class).load(fieldUnit.getUuid());
                     gatheringEvent = fieldUnit.getGatheringEvent();
                 }
-                label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+", ":"";
-                label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+", ":"";
-                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+", ":"";
-                label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+", ":"";
+                label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+separator:emptyString;
+                label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+separator:emptyString;
+                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+separator:emptyString;
+                label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
             }
-            label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():"";
+            label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():emptyString;
         }
-        else if(element instanceof MediaSpecimen){
-            MediaSpecimen mediaSpecimen = (MediaSpecimen)element;
+        //MediaSpecimen
+        else if(derivate instanceof MediaSpecimen){
+            MediaSpecimen mediaSpecimen = (MediaSpecimen)derivate;
             if(mediaSpecimen.getMediaSpecimen()!=null){
-                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+", ":"[no motif]";
-                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+", ":"";
+                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+separator:"[no motif]";
+                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+separator:emptyString;
             }
-            label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+", ":"";
-            Collection collection = mediaSpecimen.getCollection();
+            eu.etaxonomy.cdm.model.occurrence.Collection collection = mediaSpecimen.getCollection();
             if(collection!=null){
-                label += collection.getName()!=null?collection.getName()+" ":"";
+                label += collection.getName()!=null?collection.getName()+" ":emptyString;
+                label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
             }
+            label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+separator:emptyString;
         }
-        else if(element instanceof DnaSample
-                || (element instanceof DerivedUnit
-                        && ((SpecimenOrObservationBase<?>) element).getRecordBasis()==SpecimenOrObservationType.DnaSample)){
-            //TODO implement
-            label += element.toString();
+        //TissueSample + DnaSample
+        else if(derivate instanceof DnaSample){
+            DnaSample dnaSample = (DnaSample)derivate;
+            if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
+                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                    label += currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+            }
+            else if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                label += dnaSample.getKindOfUnit()+separator;
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
+                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                    label += currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+            }
 
         }
-        else if(element instanceof DerivedUnit){
-            DerivedUnit derivedUnit = (DerivedUnit)element;
+        //DerivedUnit + TissueSample
+        else if(derivate instanceof DerivedUnit){
+            DerivedUnit derivedUnit = (DerivedUnit)derivate;
             if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
                 java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
                 if(fieldUnits!=null && !fieldUnits.isEmpty()){
                     FieldUnit fieldUnit = fieldUnits.iterator().next();
                     GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
+//                  gatheringEvent = HibernateProxyHelper.deproxy(gatheringEvent, GatheringEvent.class);
                     if(gatheringEvent!=null){
-                        label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+", ":"";
+                        label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
                     }
-                    label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+", ":"";
+                    label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+separator:emptyString;
                 }
-                Collection collection = derivedUnit.getCollection();
+                eu.etaxonomy.cdm.model.occurrence.Collection collection = derivedUnit.getCollection();
                 if(collection!=null){
-                    label += collection.getName()!=null?collection.getName()+" ":"";
-                    label += collection.getCode()!=null?"("+collection.getCode()+"), ":"";
+                    label += collection.getName()!=null?collection.getName()+" ":emptyString;
+                    label += collection.getCode()!=null?"("+collection.getCode()+"), ":emptyString;
                 }
-                label += derivedUnit.getAccessionNumber()!=null?derivedUnit.getAccessionNumber()+", ":"";
-                label += derivedUnit.getBarcode()!=null?derivedUnit.getBarcode():"";
+                label += derivedUnit.getAccessionNumber()!=null?derivedUnit.getAccessionNumber()+separator:emptyString;
+                label += derivedUnit.getBarcode()!=null?derivedUnit.getBarcode():emptyString;
             }
             else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
-                //TODO: implement
-//                kindofTissue + SampleDesignation
+                //TissueSample should only be created by using it's own class
+                //in future using only one class with different SpecimenOrObservationTypes is desired
+//                label += derivedUnit.getKindOfUnit() + NO_SAMPLE_DESIGNATION;
             }
         }
-        else if(element instanceof Sequence){
-            Sequence sequence = (Sequence)element;
-            label += "SampleDesignation?"+", ";
-            label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():"";
+        //Sequence
+        else if(derivate instanceof Sequence){
+            Sequence sequence = (Sequence)derivate;
+            Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
+            if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                label += currentSampleDesignation.getIdentifier()+separator;
+            }
+            else{
+                label += NO_SAMPLE_DESIGNATION+separator;
+            }
+            label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
         }
-        else if(element instanceof SingleRead){
-            SingleRead singleRead = (SingleRead)element;
-            label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+", ":"";
-            label += "Marker?";
+        //SingleRead
+        else if(derivate instanceof SingleRead){
+            SingleRead singleRead = (SingleRead)derivate;
+            if(parentNode!=null && parentNode.getValue() instanceof Sequence){
+                Sequence sequence = (Sequence) parentNode.getValue();
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
+                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                    label = currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+                label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+separator:emptyString;
+                if(sequence!=null){
+                    label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
+                }
+            }
         }
-        else if(element instanceof SpecimenOrObservationBase){
-            SpecimenOrObservationBase<?> derivate = (SpecimenOrObservationBase<?>) element;
-            SpecimenOrObservationType type = derivate.getRecordBasis();
-            return derivate.getTitleCache() + (type!=null?" ["+type.toString()+"]":"");
+        //SOOB
+        else if(derivate instanceof SpecimenOrObservationBase){
+            SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>) derivate;
+            SpecimenOrObservationType type = specimen.getRecordBasis();
+            return specimen.getTitleCache() + (type!=null?" ["+type.toString()+"]":emptyString);
         }
         if(label.isEmpty()){
-            label = element.toString();
+            label = derivate.toString();
         }
         //remove last comma
-        else if(label.endsWith(", ")){
-            label = label.substring(0, label.length()-2);
+        else if(label.endsWith(separator)){
+            label = label.substring(0, label.length()-separator.length());
         }
         return label;
     }
@@ -275,6 +343,25 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         return super.getImage(element);
     }
 
+    public static Identifier<DnaSample> getCurrentSampleDesignation(CdmBase entity) {
+        if(entity instanceof DnaSample){
+            DnaSample dnaSample = (DnaSample)entity;
+            for (Identifier<DnaSample> identifier : dnaSample.getIdentifiers()) {
+                if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
+                    //first sample designation is the current
+                    return identifier;
+                }
+            }
+        }
+        else if(entity instanceof Sequence){
+            Sequence sequence = (Sequence)entity;
+            if(sequence.getDnaSample()!=null){
+                return getCurrentSampleDesignation(sequence.getDnaSample());
+            }
+        }
+        return null;
+    }
+
     /**
      * @param multiLinkSingleReads2
      */
index 536c3b2b78694396052c43ecc3fca9217bf3d5df..ea5a9ccf9a9f664a6b38a62d4ef9fb3cea53ef0b 100644 (file)
@@ -52,13 +52,15 @@ public class DerivateSearchCompositeController implements Listener{
     private final DerivateSearchComposite derivateSearchComposite;
     private IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy>> configurator;
     private EnumTermComboController<SpecimenOrObservationType> enumTermComboController;
-    private DerivateLabelProvider labelProvider;
-
+    private final DerivateSearchView derivateSearchView;
+       private DerivateLabelProvider labelProvider;
     /**
      * @param parent
+     * @param derivateSearchView
      */
-    public DerivateSearchCompositeController(Composite parent) {
+    public DerivateSearchCompositeController(Composite parent, DerivateSearchView derivateSearchView) {
         this.derivateSearchComposite = new DerivateSearchComposite(parent, SWT.NONE);
+        this.derivateSearchView = derivateSearchView;
         init();
     }
 
@@ -106,6 +108,10 @@ public class DerivateSearchCompositeController implements Listener{
     }
 
     private void searchDerivates(){
+        if(!derivateSearchView.getConversationHolder().isBound()){
+            derivateSearchView.setFocus(); //rebind the conversation
+        }
+
         configurator.setTitleSearchString(derivateSearchComposite.getSearchField().getText());
         SpecimenOrObservationType type = enumTermComboController.getSelection();
         //filter by specimen type
@@ -151,6 +157,7 @@ public class DerivateSearchCompositeController implements Listener{
     public void reset(){
         derivateSearchComposite.getResultViewer().setInput(null);
         derivateSearchComposite.getSearchField().setText("");
+        enumTermComboController.setSelection(SpecimenOrObservationType.Unknown);
         derivateSearchComposite.getComboDerivateType().deselectAll();
     }
 
index 781bf6f0319a9a581d728fece4d76d6624df6c1c..399eb80d3cff51048799f51e31a76403a763d456 100644 (file)
@@ -41,7 +41,7 @@ public class DerivateSearchView extends ViewPart implements IContextListener {
      */
     @Override
     public void createPartControl(Composite parent) {
-        derivateSearchCompositeController = new DerivateSearchCompositeController(parent);
+        derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this);
         getSite().setSelectionProvider(derivateSearchCompositeController.getResultViewer());
         derivateSearchCompositeController.setEnabled(CdmStore.isActive());
     }
@@ -53,7 +53,7 @@ public class DerivateSearchView extends ViewPart implements IContextListener {
     public void setFocus() {
         derivateSearchCompositeController.setFocus();
         //make sure to bind again if maybe in another view the conversation was unbound
-        if(getConversationHolder()!=null && !getConversationHolder().isBound()){
+        if(!getConversationHolder().isClosed() && getConversationHolder()!=null && !getConversationHolder().isBound()){
             getConversationHolder().bind();
         }
     }
index 207e1e5edb7636da4a668fd9d9e6f4dcf049f5ab..697991efdbebbcf119dc32e4a928f1340be6d6eb 100644 (file)
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.view.detail;
 
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.forms.SectionPart;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
@@ -120,15 +121,23 @@ public class CdmSectionPart<T> extends SectionPart implements
                if (event != null) {
 
                        Object eventSource = event.getSource();
+                       Control[] children = formSection.getLayoutComposite().getChildren();
+                       boolean containsElement = false;
+                       for (Control control : children) {
+                           if(eventSource.equals(control)){
+                               containsElement = true;
+                               break;
+                           }
+            }
+                       if(containsElement){
+                           markDirty();
+                       }
 
-                       if (formSection.equals(eventSource)){
+                       else if (formSection.equals(eventSource)){
                                markDirty();
                        }
-                       if((
-                                               (eventSource instanceof ICdmFormElement)
-                                               && formSection.containsFormElement((ICdmFormElement) eventSource))
-                                               ) {
-                               markDirty();
+                       else if(((eventSource instanceof ICdmFormElement)&& formSection.containsFormElement((ICdmFormElement) eventSource))) {
+                           markDirty();
                        }
                }
        }
index bedd1ffe717fd0619d1bef34a25d2e59eef552ee..bfe64abd77b1e20b89a5968f0469efb0b1c29a91 100644 (file)
@@ -101,6 +101,7 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDeta
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
@@ -291,7 +292,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                 createDerivedUnitBaseElementSection(rootElement);
             }
             else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
-                createTissueSampleSection(rootElement);
+                //TissueSample should only be created by using it's own class
+                //in future using only one class with different SpecimenOrObservationTypes is desired
+//                createTissueSampleSection(rootElement);
             }
             else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
                 createSpecimenScanSection(rootElement);
@@ -306,7 +309,13 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                 createDerivedUnitBaseElementSection(rootElement);
             }
         } else if (input instanceof DnaSample){
-            createDnaSampleSection(rootElement);
+            DnaSample dnaSample = (DnaSample)input;
+            if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                createTissueSampleSection(rootElement);
+            }
+            else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                createDnaSampleSection(rootElement);
+            }
         } else if (input instanceof MediaSpecimen){
             createMediaSpecimenSection(rootElement);
         }
@@ -758,7 +767,12 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
         TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+        SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
         addPart(section);
+        addPart(sampleDesignationDetailSection);
     }
 
     private void createDnaSampleSection(RootElement parent) {
@@ -770,8 +784,13 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
         DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+        SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
         addPart(section);
         addPart(qualitySection);
+        addPart(sampleDesignationDetailSection);
     }
 
     private void createAmplificationSection(RootElement parent) {
index 1eacc7cf85ac35ea51feb7766357d5bd821f4f07..d52b5b19652facf363dc8d581834fb310a3ac39e 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: eu.etaxonomy.taxeditor.test
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 3.0.10.qualifier
+Bundle-Version: 3.4.0.qualifier
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: EDIT
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
index cbabcdb93c6223f3fb038b6471c6d7bd5b3f5f40..2fdee3be14e73bed09e76914a8c237047b16dcce 100644 (file)
@@ -4,7 +4,7 @@
        <parent>\r
                <groupId>eu.etaxonomy</groupId>\r
                <artifactId>taxeditor-parent</artifactId>\r
-               <version>3.0.12-SNAPSHOT</version>\r
+               <version>3.4.0-SNAPSHOT</version>\r
        </parent>\r
        <modelVersion>4.0.0</modelVersion>\r
        <artifactId>eu.etaxonomy.taxeditor.test</artifactId>\r
index cf45cfff69b70d223a2e9bc504587751ce523394..8d1923a5b0723554cb9d3ab31fd34935df20b31a 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?pde version="3.5"?>
 
-<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="3.3.8.qualifier" useFeatures="true" includeLaunchers="true">
+<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="3.4.0.qualifier" useFeatures="true" includeLaunchers="true">
 
    <aboutInfo>
       <image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
    <vm>
    </vm>
 
-   <!--license>
-        <url>http://www.mozilla.org/MPL/</url>
-        <text>
-   The contents of this file are subject to the Mozilla Public License Version 1.1 (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at
-http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
-         </text>
-   </license -->
-
    <plugins>
    </plugins>
 
index 22a6e9d99780b7e63c50271314b595314bf7eeef..d767dac9d594704c6ad67304616fad55dc311a17 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>3.3.8-SNAPSHOT</version>
+    <version>3.4.0-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
             <configuration>
               <fromDir>${project.build.directory}/repository</fromDir>
               <url>scpexe://wp5.e-taxonomy.eu/var/www/download/taxeditor/update/${update.dir}</url>
-              <includes>binary/*,content.jar,artifacts.jar,**/eu.etaxonomy.*.jar</includes>
+              <includes>
+                binary/*,content.jar,artifacts.jar,**/eu.etaxonomy.*.jar
+              </includes>
               <!-- Comment out the above and uncomment the below to upload 
                 all jars -->
               <!-- <includes>**/*</includes> -->
index 89e83ad7837c1895a1fd7bb6f452afc17101a4a6..c929cd0de4fb7d2936c32700d5795d171d85e50f 100644 (file)
@@ -23,8 +23,8 @@
 <repository location="http://download.eclipse.org/releases/indigo"/>
 </location>
 <location includeAllPlatforms="true" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.nebula.widgets.compositetable.feature.feature.group" version="1.0.0.201304110956"/>
-<repository location="http://download.eclipse.org/technology/nebula/snapshot"/>
+<unit id="org.eclipse.nebula.widgets.compositetable.feature" version="1.0.0.201409040043"/>
+<repository location="http://download.eclipse.org/technology/nebula/archives/Q32014/release/"/>
 </location>
 </locations>
 </target>
diff --git a/pom.xml b/pom.xml
index 6c7798a66459587a4f99b9f848108a4317cd4c41..fa6f9ffa10d1a5030592ca982d5c351ac93a1098 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
   </prerequisites>
   <groupId>eu.etaxonomy</groupId>
   <artifactId>taxeditor-parent</artifactId>
-  <version>3.3.8-SNAPSHOT</version>
+  <version>3.4.0-SNAPSHOT</version>
   <name>EDIT Taxonomic Editor</name>
   <description>The Taxonomic Editor for EDIT's platform for
     cybertaxonomy</description>
   <properties>
     <java.codelevel>1.6</java.codelevel>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <cdmlib.version>3.3.8-SNAPSHOT</cdmlib.version>
+    <cdmlib.version>3.4.0-SNAPSHOT</cdmlib.version>
     <!-- TODO can we use project.version ????? -->
     <tycho.version>0.14.0</tycho.version>
-    <taxeditor.version>3.3.8-SNAPSHOT</taxeditor.version>
+    <taxeditor.version>3.4.0-SNAPSHOT</taxeditor.version>
     <update.dir>snapshot</update.dir>
   </properties>
   <modules>
       <layout>p2</layout>
       <url>http://download.eclipse.org/technology/swtbot/helios/dev-build/update-site/</url>
     </repository>
+    <!-- The nebula repository (retention period 2 years starting Q32014) set here is an archived one  
+         so as to have a stable version of the jar when building the editor . Refer to #4452 for details -->
     <repository>
       <id>eclipse-nebula</id>
       <layout>p2</layout>
-      <url>http://download.eclipse.org/technology/nebula/snapshot/</url>
+      <url>http://download.eclipse.org/technology/nebula/archives/Q32014/release/</url>
     </repository>
     <repository>
       <id>eclipse-swtbot</id>