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 / supplemental / IdentifiableSourceElement.java
index 0e0e21756b1f75e043992adcec3d2a22120287fd..9202992a3e126df6b7ed40c1f04b5dc3e58feb13 100644 (file)
@@ -53,26 +53,29 @@ public class IdentifiableSourceElement extends AbstractOriginalSourceElement<Ide
                super.createControls(formElement, style);
                externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, IdentifiableSource.class.getCanonicalName()));
         externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        if (entity != null){
+               setEntity(this.entity);
+        }
        }
 
        /** {@inheritDoc} */
        @Override
        public void setEntity(IdentifiableSource entity) {
                super.setEntity(entity);
-               if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
-                   text_idInSource.setText(entity.getIdInSource());
-               }
-               if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
-                   text_idNamespace.setText(entity.getIdNamespace());
+               if (selection_reference != null){
+                       if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
+                           text_idInSource.setText(entity.getIdInSource());
+                       }
+                       if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
+                           text_idNamespace.setText(entity.getIdNamespace());
+                       }
+       
+                       selection_reference.setEntity(entity.getCitation());
+                       text_referenceDetail.setText(entity.getCitationMicroReference());
+                       combo_origsourcetype.setSelection(entity.getType());
+                       text_originaleNameString.setText(entity.getOriginalNameString());
                }
 
-               selection_reference.setEntity(entity.getCitation());
-               text_referenceDetail.setText(entity.getCitationMicroReference());
-               combo_origsourcetype.setSelection(entity.getType());
-               text_originaleNameString.setText(entity.getOriginalNameString());
-
-
-
        }
 
        /** {@inheritDoc} */