merged/implemented cdm3.3 model adaptations
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / campanula / detailViews / fieldObservation / GatheringEventDetailsElementController.java
index 3fa01f509a4012571e558c22f93fb7c008e1a95a..56f1045949ae8510fb73dc99d578bf1a0d0214db 100644 (file)
@@ -12,8 +12,6 @@ package eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NumberFieldController;
 import eu.etaxonomy.taxeditor.ui.campanula.basicFields.TextFieldController;
 import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
@@ -31,9 +29,9 @@ public class GatheringEventDetailsElementController extends AbstractCdmDetailEle
 
     private GatheringEventDetailsElement gatheringEventDetailsElement;
 
-    private NumberFieldController number_absoluteElevationError;
+//    private NumberFieldController number_absoluteElevationError;
 
-    private NumberFieldController number_absoluteElevationMinimum;
+//    private NumberFieldController number_absoluteElevationMinimum;
 
     private NumberFieldController number_absoluteElevationMaximum;
 
@@ -68,8 +66,8 @@ public class GatheringEventDetailsElementController extends AbstractCdmDetailEle
     @Override
     protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
 
-        number_absoluteElevationError = new NumberFieldController(gatheringEventDetailsElement.getTextElevationError(), formFactory, this, entity.getAbsoluteElevation());
-        number_absoluteElevationMinimum = new NumberFieldController(gatheringEventDetailsElement.getText_ElevationMinimum(), formFactory, this, entity.getAbsoluteElevationMinimum());
+//        number_absoluteElevationError = new NumberFieldController(gatheringEventDetailsElement.getTextElevationError(), formFactory, this, entity.getAbsoluteElevation());
+//        number_absoluteElevationMinimum = new NumberFieldController(gatheringEventDetailsElement.getText_ElevationMinimum(), formFactory, this, entity.getAbsoluteElevationMinimum());
         number_absoluteElevationMaximum = new NumberFieldController(gatheringEventDetailsElement.getText_ElevationMaximum(), formFactory, this, entity.getAbsoluteElevationMaximum());
         text_collectingMethod = new TextFieldController(gatheringEventDetailsElement.getText_CollectingMethod(), formFactory, this, entity.getCollectingMethod(), null);
         number_distanceToGround = new NumberFieldController(gatheringEventDetailsElement.getText_DistanceToGround(), formFactory, this, entity.getDistanceToGround());
@@ -83,30 +81,33 @@ public class GatheringEventDetailsElementController extends AbstractCdmDetailEle
     /** {@inheritDoc} */
     @Override
     public void handleEvent(Object eventSource) {
-        if (eventSource == number_absoluteElevationError) {
-            getEntity().setAbsoluteElevationError(number_absoluteElevationError.getInteger());
-        } else if (eventSource == number_absoluteElevationMinimum) {
-            try {
-                getEntity().setAbsoluteElevationRange(number_absoluteElevationMinimum.getInteger(), number_absoluteElevationMaximum.getInteger());
-                number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
-            } catch (IllegalArgumentException e) {
-                number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
-                AbstractUtility.warn(getClass(), e.getLocalizedMessage());
-            }
-        } else if (eventSource == number_absoluteElevationMaximum) {
-            try {
-                getEntity().setAbsoluteElevationRange(number_absoluteElevationMinimum.getInteger(), number_absoluteElevationMaximum.getInteger());
-                number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
-            } catch (IllegalArgumentException e) {
-                number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
-                AbstractUtility.warn(getClass(), e.getLocalizedMessage());
-            }
-        } else if (eventSource == text_collectingMethod) {
+//        if (eventSource == number_absoluteElevationError) {
+//            getEntity().setAbsoluteElevationError(number_absoluteElevationError.getDouble());
+//        }
+//        else if (eventSource == number_absoluteElevationMinimum) {
+//            try {
+//                getEntity().setAbsoluteElevationRange(number_absoluteElevationMinimum.getInteger(), number_absoluteElevationMaximum.getInteger());
+//                number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+//            } catch (IllegalArgumentException e) {
+//                number_absoluteElevationMinimum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+//                AbstractUtility.warn(getClass(), e.getLocalizedMessage());
+//            }
+//        }
+//        else if (eventSource == number_absoluteElevationMaximum) {
+//            try {
+//                getEntity().setAbsoluteElevationRange(number_absoluteElevationError.getInteger(), number_absoluteElevationMaximum.getInteger());
+//                number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+//            } catch (IllegalArgumentException e) {
+//                number_absoluteElevationMaximum.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
+//                AbstractUtility.warn(getClass(), e.getLocalizedMessage());
+//            }
+//        } else
+            if (eventSource == text_collectingMethod) {
             getEntity().setCollectingMethod(text_collectingMethod.getText());
         } else if (eventSource == number_distanceToGround) {
-            getEntity().setDistanceToGround(number_distanceToGround.getInteger());
+            getEntity().setDistanceToGround(number_distanceToGround.getDouble());
         } else if (eventSource == number_distanceToWaterSurface) {
-            getEntity().setDistanceToWaterSurface(number_distanceToWaterSurface.getInteger());
+            getEntity().setDistanceToWaterSurface(number_distanceToWaterSurface.getDouble());
         } else if (eventSource == text_gatheringEventDescription) {
             getEntity().setGatheringEventDescription(text_gatheringEventDescription.getText());
         }