commit 8d14e2c1ebe0af6f928365926d3e2295aa65c023
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Thu Jan 25 14:37:00 2018 +0100

    executing list filter while typing

diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/event/UpdateResultsEvent.java b/src/main/java/eu/etaxonomy/cdm/vaadin/event/UpdateResultsEvent.java
index f974d10e..4b9095cb 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/event/UpdateResultsEvent.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/event/UpdateResultsEvent.java
@@ -8,6 +8,8 @@
 */
 package eu.etaxonomy.cdm.vaadin.event;
 
+import com.vaadin.ui.TextField;
+
 import eu.etaxonomy.vaadin.mvp.AbstractView;
 
 /**
@@ -18,14 +20,18 @@ import eu.etaxonomy.vaadin.mvp.AbstractView;
 public class UpdateResultsEvent {
 
     private AbstractView sourceView = null;
+    TextField field;
+    String newText;
 
 
     /**
      * @param sourceView
      */
-    public UpdateResultsEvent(AbstractView sourceView) {
+    public UpdateResultsEvent(TextField field, String newText, AbstractView sourceView) {
         super();
         this.sourceView = sourceView;
+        this.field = field;
+        this.newText = newText;
     }
 
     /**
@@ -42,6 +48,20 @@ public class UpdateResultsEvent {
         this.sourceView = sourceView;
     }
 
+    /**
+     * @return the field
+     */
+    public TextField getField() {
+        return field;
+    }
+
+    /**
+     * @return the newText
+     */
+    public String getNewText() {
+        return newText;
+    }
+
 
 
 }
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
index 91fb5b3d..d99bb88a 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
@@ -13,9 +13,11 @@ import java.util.EnumSet;
 
 import org.springframework.security.core.GrantedAuthority;
 
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
 import com.vaadin.ui.ListSelect;
 import com.vaadin.ui.TextField;
 
@@ -232,11 +234,9 @@ public class TaxonNamePopupEditor extends AbstractCdmPopupEditor<TaxonName, Taxo
         combinationAuthorshipField = new TeamOrPersonField("combination author(s)");
         combinationAuthorshipField.setWidth(100,  Unit.PERCENTAGE);
         addField(combinationAuthorshipField, "combinationAuthorship", 0, row, GRID_COLS-1, row);
-        row++;
-        exCombinationAuthorshipField = new TeamOrPersonField("Ex-combination author(s)");
-        exCombinationAuthorshipField.setWidth(100,  Unit.PERCENTAGE);
-        addField(exCombinationAuthorshipField, "exCombinationAuthorship", 0, row, GRID_COLS-1, row);
 
+        row++;
+        grid.addComponent(new Label("Hint: <i>Nomenclatural authors can be edited in the nomenclatural reference.</i>", ContentMode.HTML), 0, row, 3, row);
         // nomenclaturalReference
         row++;
         nomReferenceCombobox = new ToOneRelatedEntityCombobox<Reference>("Nomenclatural reference", Reference.class);
@@ -260,6 +260,10 @@ public class TaxonNamePopupEditor extends AbstractCdmPopupEditor<TaxonName, Taxo
         nomenclaturalReferenceDetail = addTextField("Reference detail", "nomenclaturalMicroReference", 3, row, 3, row);
         nomenclaturalReferenceDetail.setWidth(100, Unit.PIXELS);
 
+        row++;
+        exCombinationAuthorshipField = new TeamOrPersonField("Ex-combination author(s)");
+        exCombinationAuthorshipField.setWidth(100,  Unit.PERCENTAGE);
+        addField(exCombinationAuthorshipField, "exCombinationAuthorship", 0, row, GRID_COLS-1, row);
 
         // Basionym
         row++;
@@ -313,12 +317,18 @@ public class TaxonNamePopupEditor extends AbstractCdmPopupEditor<TaxonName, Taxo
      * @return
      */
     private void enableBasionymFields(boolean enable) {
+
+
         basionymAuthorshipField.setVisible(enable);
         exBasionymAuthorshipField.setVisible(enable);
         basionymsComboboxSelect.setVisible(enable);
-        if(modesActive.contains(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData)){
-            TaxonName taxonName = getBean();
-            basionymAuthorshipField.setVisible(taxonName.getBasionymAuthorship() != null);
+        TaxonName taxonName = getBean();
+
+        if(taxonName != null){
+            if(modesActive.contains(TaxonNamePopupEditorMode.suppressReplacementAuthorshipData)){
+                basionymAuthorshipField.setVisible(taxonName.getBasionymAuthorship() != null);
+            }
+            updateFieldVisibility(taxonName.getRank());
         }
     }
 
@@ -333,6 +343,7 @@ public class TaxonNamePopupEditor extends AbstractCdmPopupEditor<TaxonName, Taxo
         specificEpithetField.setVisible(isSpeciesOrBelow);
         infraGenericEpithetField.setVisible(rank.isInfraGenericButNotSpeciesGroup());
         genusOrUninomialField.setCaption(isSpeciesOrBelow ? "Genus" : "Uninomial");
+        exCombinationAuthorshipField.setVisible(isSpeciesOrBelow);
     }
 
     @Override
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java
index 094e4036..4b075b3f 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListPresenter.java
@@ -17,6 +17,7 @@ import org.springframework.security.core.Authentication;
 
 import com.vaadin.spring.annotation.SpringComponent;
 import com.vaadin.spring.annotation.ViewScope;
+import com.vaadin.ui.TextField;
 
 import eu.etaxonomy.cdm.api.service.pager.Pager;
 import eu.etaxonomy.cdm.model.common.User;
@@ -74,7 +75,7 @@ public class ListPresenter extends AbstractPresenter<ListView> {
             getView().getSubmitterFilter().setItemCaptionPropertyId("username");
         }
 
-        getView().populate(pageRegistrations());
+        getView().populate(pageRegistrations(null, null));
     }
 
     /**
@@ -82,14 +83,24 @@ public class ListPresenter extends AbstractPresenter<ListView> {
      *
      * @return
      */
-    private Pager<RegistrationDTO> pageRegistrations() {
+    private Pager<RegistrationDTO> pageRegistrations(TextField textFieldOverride, String alternativeText) {
 
         // list all if the authenticated user is having the role CURATION of if it is an admin
         Authentication authentication = currentSecurityContext().getAuthentication();
 
         // prepare the filters
-        String identifierFilter = getView().getIdentifierFilter().getValue();
-        String nameFilter = getView().getTaxonNameFilter().getValue();
+        String identifierFilter;
+        if(textFieldOverride != null && textFieldOverride == getView().getIdentifierFilter()){
+            identifierFilter = alternativeText;
+        } else {
+            identifierFilter = getView().getIdentifierFilter().getValue();
+        }
+        String nameFilter;
+        if(textFieldOverride != null && textFieldOverride == getView().getTaxonNameFilter()){
+            nameFilter = alternativeText;
+        } else {
+            nameFilter = getView().getTaxonNameFilter().getValue();
+        }
         User submitter = null;
         if(getView().getSubmitterFilter() != null){
             Object o = getView().getSubmitterFilter().getValue();
@@ -137,7 +148,7 @@ public class ListPresenter extends AbstractPresenter<ListView> {
 
     @EventListener
     public void onUpdateResultsEvent(UpdateResultsEvent event){
-        getView().populate(pageRegistrations());
+        getView().populate(pageRegistrations(event.getField(), event.getNewText()));
     }
 
 }
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
index d30c3e23..8dcc44ee 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/ListViewBean.java
@@ -86,7 +86,7 @@ public class ListViewBean extends AbstractPageView<ListPresenter> implements Lis
 
             submitterFilter = new ListSelect("Submitter");
             submitterFilter.setRows(1);
-            submitterFilter.addValueChangeListener(e -> updateResults());
+            submitterFilter.addValueChangeListener(e -> updateResults(null, null));
             toolBar.addComponent(submitterFilter);
         }
 
@@ -94,13 +94,16 @@ public class ListViewBean extends AbstractPageView<ListPresenter> implements Lis
             statusFilter = new ListSelect("Status", Arrays.asList(RegistrationStatus.values()));
             statusFilter.setNullSelectionAllowed(true);
             statusFilter.setRows(1);
-            statusFilter.addValueChangeListener(e -> updateResults());
+            statusFilter.addValueChangeListener(e -> updateResults(null, null));
             toolBar.addComponent(statusFilter);
         }
 
         toolBar.addComponents(identifierFilter, taxonNameFilter);
-        identifierFilter.addValueChangeListener(e -> updateResults());
-        taxonNameFilter.addValueChangeListener(e -> updateResults());
+        int textChangeTimeOut = 200;
+        identifierFilter.addTextChangeListener(e -> updateResults(identifierFilter, e.getText()));
+        identifierFilter.setTextChangeTimeout(textChangeTimeOut);
+        taxonNameFilter.addTextChangeListener(e -> updateResults(taxonNameFilter, e.getText()));
+        identifierFilter.setTextChangeTimeout(textChangeTimeOut);
 
         toolBar.setSpacing(true);
         addContentComponent(toolBar, null);
@@ -115,8 +118,8 @@ public class ListViewBean extends AbstractPageView<ListPresenter> implements Lis
     /**
      * @return
      */
-    private void updateResults() {
-        eventBus.publishEvent(new UpdateResultsEvent(this));
+    private void updateResults(TextField field, String newText) {
+        eventBus.publishEvent(new UpdateResultsEvent(field, newText, this));
     }
 
     @Override
