From 318bc9cea06d416b398aa8a2802035318a915094 Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Fri, 16 Apr 2010 14:06:29 +0000
Subject: [PATCH] [LMS-1476] fixed a bug connected with filters

SVN: 15501
---
 .../ui/grid/AbstractBrowserGrid.java          |  2 --
 .../expressions/filter/FilterToolbar.java     | 23 ++++++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java
index 53bf45b53ce..808429c73fe 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/AbstractBrowserGrid.java
@@ -37,7 +37,6 @@ import com.extjs.gxt.ui.client.event.BaseEvent;
 import com.extjs.gxt.ui.client.event.ButtonEvent;
 import com.extjs.gxt.ui.client.event.Events;
 import com.extjs.gxt.ui.client.event.Listener;
-import com.extjs.gxt.ui.client.event.LoadListener;
 import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
 import com.extjs.gxt.ui.client.event.SelectionListener;
 import com.extjs.gxt.ui.client.store.ListStore;
@@ -281,7 +280,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
         add(contentPanel);
 
         addRefreshDisplaySettingsListener();
-        pagingLoader.addLoadListener(new LoadListener()); // TODO why do we need this?
         if (viewContext.isLoggingEnabled())
         {
             ComponentEventLogger logger = new ComponentEventLogger(viewContext, getId());
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterToolbar.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterToolbar.java
index effcaeb956d..40c56397b62 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterToolbar.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/FilterToolbar.java
@@ -112,12 +112,19 @@ public class FilterToolbar<T> extends ToolBar implements IDatabaseModificationOb
                 public void postRefresh(boolean wasSuccessful)
                 {
                     updateFilterFields();
-					// TODO 2009-11-24, Tomasz Pylak: IMPR this apply is usually unnecessary and
-                    // causes screen flickering
-                    if (isCustomFilterSelected())
-                    {
-                        apply();
-                    }
+                    // TODO 2010-04-16, Piotr Buczek: not needed if column filter is selected
+                    // Because of this code there is a reload of data visible on the client
+                    // when user shows filter toolbar. It is quite fast as data are taken from cache
+                    // but the loading mask is visible.
+                    // On the other hand if we don't perform apply here column filters are not
+                    // working properly. Somehow they are not refreshed correctly first load of
+                    // data. To reproduce it show Database Instance and Code columns and filters in
+                    // experiment detail sample browser:
+                    // - Database Instance filter should be a combo box filter
+                    // - Database Instance filter removes all letters on first usage (after refresh)
+                    // - Code filter looses focus on first usage after refresh
+                    // Refreshing the data fixes all problems.
+                    apply();
                 }
             });
         applyTool.addSelectionListener(new SelectionListener<ButtonEvent>()
@@ -287,8 +294,8 @@ public class FilterToolbar<T> extends ToolBar implements IDatabaseModificationOb
         }
         if (changed)
         {
-            // contentPanel of AbstractBrowserGrid is listening on this layout and synchronizes size
-            layout();
+            // contentPanel of AbstractBrowserGrid was listening on this layout and synchronized size
+            layout(); // TODO 2010-04-16, Piotr Buczek: second layout
         }
     }
 
-- 
GitLab