ref #9482 fixing init strategy for description source reference
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Fri, 26 Feb 2021 15:36:16 +0000 (16:36 +0100)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Fri, 26 Feb 2021 15:36:16 +0000 (16:36 +0100)
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java

index aa2de3b144ccf760df4011c4bbf8c63071545f51..e34085d13ee14d2e1931106dd042a2940d601730 100644 (file)
@@ -166,7 +166,11 @@ public class NameTypeDesignationPresenter
                 @Override
                 public Reference createNewBean() {
                     Reference newRef = ReferenceFactory.newSection();
-                    newRef.setInReference(getPublishedUnit().getCitation());
+                    Reference reference = getRepo().getReferenceService().load(
+                            getPublishedUnit().getCitation().getUuid(),
+                            ReferenceEllypsisFormatter.INIT_STRATEGY
+                            );
+                    newRef.setInReference(reference);
                     return newRef;
                 }
             };
@@ -364,7 +368,10 @@ public class NameTypeDesignationPresenter
 
         referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
         referenceEditorPopup.withDeleteButton(true);
-        configureReferencePopupEditor(referenceEditorPopup, null);
+        RegistrationUiReferenceEditorFormConfigurator
+            .create(newReferenceInstantiator != null)
+            .configure(referenceEditorPopup, newReferenceInstantiator);
+        referenceEditorPopup.loadInEditor(null);
     }
 
     @EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
@@ -376,7 +383,14 @@ public class NameTypeDesignationPresenter
         ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
 
         referenceEditorPopup.withDeleteButton(true);
-        configureReferencePopupEditor(referenceEditorPopup, event.getEntityUuid());
+        // TODO this should be configurable per UI -
+        // RegistrationUiReferenceEditorFormConfigurator as spring bean,
+        // different spring profiles
+        // see also similar methods in TaxonName and SpecimenTypeDesigationEditors
+        RegistrationUiReferenceEditorFormConfigurator
+            .create(newReferenceInstantiator != null)
+            .configure(referenceEditorPopup, newReferenceInstantiator);
+        referenceEditorPopup.loadInEditor(event.getEntityUuid());
     }
 
     @EventBusListenerMethod
@@ -428,21 +442,4 @@ public class NameTypeDesignationPresenter
         this.publishedUnit = publishedUnit;
     }
 
-    /**
-     * @param referenceEditorPopup
-     */
-    private void configureReferencePopupEditor(ReferencePopupEditor referenceEditorPopup, UUID referenceUUID) {
-
-        // TODO this should be configurable per UI -
-        // RegistrationUiReferenceEditorFormConfigurator as spring bean,
-        // different spring profiles
-        // see also similar methods in TaxonName and SpecimenTypeDesigationEditors
-        RegistrationUiReferenceEditorFormConfigurator
-            .create(newReferenceInstantiator != null)
-            .configure(referenceEditorPopup, newReferenceInstantiator);
-
-        referenceEditorPopup.loadInEditor(referenceUUID);
-        // TODO limit ??? referenceEditorPopup.getTypeSelect().setValue(ReferenceType.Article);
-    }
-
 }
index d65862f2512ed3d68feae6413b1e2703b68157c2..f0d1953971f5677278c9e816f62a8e21bffc041c 100644 (file)
@@ -163,9 +163,11 @@ public class ReferenceEditorPresenter extends AbstractCdmEditorPresenter<Referen
         EntityInitStrategy initStrategy = new EntityInitStrategy(Arrays.asList(new String []{
                 "$",
                 "annotations.*", // needed as log as we are using a table in FilterableAnnotationsField
+                "inReference"
                 }
         ));
         initStrategy.extend("", ReferenceEllypsisFormatter.INIT_STRATEGY, false);
+        initStrategy.extend("inReference", ReferenceEllypsisFormatter.INIT_STRATEGY, false);
 
         Reference reference;
         if(identifier != null){