ref #9838: change order of ui element creation and setting entity in collection elements
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / StatisticalMeasurementValueElement.java
index c762cfad82d1f331d5b76e858017888b6362435c..aa5a13019965b3e686e5487b0148104b343a2d71 100644 (file)
@@ -59,11 +59,13 @@ public class StatisticalMeasurementValueElement extends
        @Override
        public void setEntity(StatisticalMeasurementValue entity) {
                this.entity = entity;
-               Set<StatisticalMeasure> statisiticalMeasures = getEntity().getQuantitativeData().getFeature().getRecommendedStatisticalMeasures();
-        combo_type.setTerms(new ArrayList<StatisticalMeasure>(statisiticalMeasures));
-               combo_type.setSelection(entity.getType());
-               number_value.setNumber(entity.getValue());
-               section_modifiers.setEntity(entity);
+               if (combo_type != null){
+                       Set<StatisticalMeasure> statisiticalMeasures = getEntity().getQuantitativeData().getFeature().getRecommendedStatisticalMeasures();
+               combo_type.setTerms(new ArrayList<StatisticalMeasure>(statisiticalMeasures));
+                       combo_type.setSelection(entity.getType());
+                       number_value.setNumber(entity.getValue());
+                       section_modifiers.setEntity(entity);
+               }
        }
 
        @Override
@@ -72,6 +74,9 @@ public class StatisticalMeasurementValueElement extends
                combo_type = formFactory.createDefinedTermComboElement(TermType.StatisticalMeasure, element, "Statistical Measure", null, style);
                section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, StoreUtil.getSectionStyle(ModifierSection.class, StatisticalMeasurementValue.class.getCanonicalName()));
                section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+               if (entity != null){
+                       setEntity(entity);
+               }
        }
 
        @Override