- disabling event handling for DetailsView of TissueSample
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 13 May 2014 13:55:29 +0000 (13:55 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 13 May 2014 13:55:29 +0000 (13:55 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java

index 2cdda7125fdb43384d7bd85d0530da1622c76386..37f0d4feb9a08e2de1eaec7da0b08aa79ebaf831 100644 (file)
@@ -97,35 +97,35 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
      */
     @Override
     public void handleEvent(Object eventSource) {
      */
     @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());
+//        }
+    }
+
+    private PreservationMethod addPreservationMethod(){
+        PreservationMethod preservationMethod = null;
         try {
         try {
-            if (eventSource==comboPreservationMedium) {
-                PreservationMethod preservationMethod = getEntity().getPreservationMethod();
-                if(preservationMethod==null){
-                    preservationMethod = PreservationMethod.NewInstance();
-                    getEntity().setPreservationMethod(preservationMethod);
-                }
-                preservationMethod.setMedium(comboPreservationMedium.getSelection());
+            preservationMethod = getEntity().getPreservationMethod();
+            if(getEntity().getPreservationMethod()==null){
+                preservationMethod = PreservationMethod.NewInstance();
+                getEntity().setPreservationMethod(preservationMethod);
             }
             }
-            else if (eventSource==datePreservation) {
-                PreservationMethod preservationMethod = getEntity().getPreservationMethod();
-                if(preservationMethod==null){
-                    preservationMethod = PreservationMethod.NewInstance();
-                    getEntity().setPreservationMethod(preservationMethod);
-                }
-                preservationMethod.setTimeperiod(datePreservation.getTimePeriod());
-            }
-        }catch (MethodNotSupportedByDerivedUnitTypeException e) {
-            AbstractUtility.errorDialog("Parameter not available", this, "Could not set preservation parameter!", e);
-        }
-        if(eventSource==selectionCollection){
-            getEntity().setCollection(selectionCollection.getSelection());
-        }
-        else if(eventSource==textAccessionNumber){
-            getEntity().setAccessionNumber(textAccessionNumber.getText());
-        }
-        else if(eventSource==textBarcode){
-            getEntity().setBarcode(textBarcode.getText());
+        } catch (MethodNotSupportedByDerivedUnitTypeException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
         }
         }
-
+        return preservationMethod;
     }
 }
     }
 }