Update taxon name in taxon selection element
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 26 Oct 2015 17:53:27 +0000 (18:53 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 26 Oct 2015 17:53:27 +0000 (18:53 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java

index 7414396f153c6b2fb0dcc0530d863507f476d67f..87072579f9f623930fe7aebcda30e32fe9937506 100644 (file)
@@ -47,6 +47,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.Messages;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
 import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController;
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
@@ -469,6 +470,10 @@ public class DerivateView extends AbstractCdmViewPart implements IPartContentHas
                 updateRootEntities(uuids);
             }
         }
+        if(part instanceof MultiPageTaxonEditor){
+            Taxon taxon = ((MultiPageTaxonEditor) part).getTaxon();
+            derivateSearchCompositeController.setTaxon(taxon);
+        }
     }
 
     /**
@@ -498,6 +503,7 @@ public class DerivateView extends AbstractCdmViewPart implements IPartContentHas
     public void toggleListenToSelectionChange() {
         listenToSelectionChange = !listenToSelectionChange;
         derivateSearchCompositeController.setEnabled(!listenToSelectionChange);
+        derivateSearchCompositeController.setTaxon(null);
     }
 
     /**
index 08aab151b8a754c1d16d11958fbac8124d45ce77..b70fec2607b2977d94007d7fe4165b7f2fe7c63b 100644 (file)
@@ -172,4 +172,16 @@ public class DerivateSearchCompositeController implements Listener{
         labelProvider.setConversation(conversationHolder);
     }
 
+    /**
+     * @param taxon
+     */
+    public void setTaxon(Taxon taxon) {
+        if(taxon==null){
+            derivateSearchComposite.getTextTaxonName().setText("");
+        }
+        else{
+            derivateSearchComposite.getTextTaxonName().setText(taxon.getTitleCache());
+        }
+    }
+
 }