- removed empty element from combo dropdown #4448
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / StatisticalMeasureCollectionElement.java
index 237a5d369674bae77d505101dcde833a6d3723f3..57ee1dabda08e0a12538e6052aa2d2f257bfa171 100644 (file)
@@ -56,6 +56,7 @@ public class StatisticalMeasureCollectionElement extends AbstractEntityCollectio
         this.entity = entity;
         if(entity.getId()!=0){
             comboStatisticalMeasure.setSelection(entity);
+            comboStatisticalMeasure.removeEmptyElement();
         }
     }
 
@@ -63,11 +64,14 @@ public class StatisticalMeasureCollectionElement extends AbstractEntityCollectio
     public void handleEvent(Object eventSource) {
         if(eventSource==comboStatisticalMeasure && comboStatisticalMeasure.getSelection()!=null){
             if(getParentElement() instanceof StatisticalMeasureCollectionSection){
-                Feature feature = ((StatisticalMeasureCollectionSection) getParentElement()).getEntity();
+                StatisticalMeasureCollectionSection parentElement = (StatisticalMeasureCollectionSection) getParentElement();
+                Feature feature = parentElement.getEntity();
                 feature.removeRecommendedStatisticalMeasure(entity);
                 StatisticalMeasure statisticalMeasure = comboStatisticalMeasure.getSelection();
                 feature.addRecommendedStatisticalMeasure(statisticalMeasure);
                 entity = statisticalMeasure;
+                //update the parent section to re-set the listeners to the persisted measurement unit
+                parentElement.removeElementAndUpdate(null);
             }
         }
     }