- removed empty element from combo dropdown #4448
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / StateVocabularyCollectionElement.java
index a8094ed724620e542d623ad166cc130b794321bf..de856abb9353933f8e6c6e325a21c7463f608ec8 100644 (file)
@@ -49,7 +49,7 @@ public class StateVocabularyCollectionElement extends AbstractEntityCollectionEl
 
     @Override
     public void createControls(ICdmFormElement element, int style) {
-        comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.State, "State vocabularies", null, element, style);
+        comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.State, "State vocabulary", null, element, style);
     }
 
     @Override
@@ -57,6 +57,7 @@ public class StateVocabularyCollectionElement extends AbstractEntityCollectionEl
         this.entity = entity;
         if(entity.getId()!=0){
             comboStateVocabulary.setSelection(entity);
+            comboStateVocabulary.removeEmptyElement();
         }
     }
 
@@ -64,11 +65,14 @@ public class StateVocabularyCollectionElement extends AbstractEntityCollectionEl
     public void handleEvent(Object eventSource) {
         if(eventSource==comboStateVocabulary && comboStateVocabulary.getSelection()!=null){
             if(getParentElement() instanceof StateVocabularyCollectionSection){
-                Feature feature = ((StateVocabularyCollectionSection) getParentElement()).getEntity();
+                StateVocabularyCollectionSection parentElement = (StateVocabularyCollectionSection) getParentElement();
+                Feature feature = parentElement.getEntity();
                 feature.removeSupportedCategoricalEnumeration(entity);
                 TermVocabulary<State> vocabulary = comboStateVocabulary.getSelection();
                 feature.addSupportedCategoricalEnumeration(vocabulary);
                 entity = vocabulary;
+                //update the parent section to re-set the listeners to the persisted measurement unit
+                parentElement.removeElementAndUpdate(null);
             }
         }
     }