From 3fc18bd532cd0a1c1eb20af321207dd7bdf02ee9 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Wed, 13 Jan 2010 12:57:30 +0000
Subject: [PATCH] LMS-1348 Added a reset of the filter selection to the logic.

SVN: 14278
---
 .../application/ui/grid/AbstractBrowserGrid.java  | 15 ++++++++-------
 .../ui/grid/expressions/filter/FilterToolbar.java | 13 ++++++++++---
 2 files changed, 18 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 267d6230bfb..96e7150aef7 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
@@ -264,7 +264,8 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
 
     }
 
-    protected void showEntityInformationHolderViewer(IEntityInformationHolder entity, boolean editMode)
+    protected void showEntityInformationHolderViewer(IEntityInformationHolder entity,
+            boolean editMode)
     {
         final EntityKind entityKind = entity.getEntityKind();
         final ITabItemFactory tabView;
@@ -910,17 +911,17 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
                     pagingToolbar.disableExportButton();
                     pagingToolbar.updateDefaultConfigButton(false);
 
-                    // Need to reset filter fields *before* refreshing the gridso the list can be
-                    // correctly
-                    // retrieved
+                    // Need to reset filter fields *before* refreshing the grid so the list can be
+                    // correctly retrieved
                     filterToolbar.resetFilterFields();
+                    filterToolbar.resetFilterSelection();
 
                     // export and config buttons are enabled when ListEntitiesCallback is complete
                     refresh();
 
                     // Need to refresh the filter toolbar *after* refreshing the grid, because it
-                    // has
-                    // a dependency on information from the grid that gets updated with the refesh
+                    // has a dependency on information from the grid that gets updated with the
+                    // refesh
                     filterToolbar.refresh();
                 }
             };
@@ -1386,7 +1387,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
         int newIndex = 0;
         // do not fire events because of performance problems when hiding/unhiding all columns. View
         // will be refreshed by refreshColumnsSettings() afterwards.
-        cm.setFiresEvents(false); 
+        cm.setFiresEvents(false);
         for (ColumnDataModel m : columnModels)
         {
             String columnID = m.getColumnID();
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 1f399b24d5b..8efd2870576 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
@@ -147,6 +147,9 @@ public class FilterToolbar<T> extends ToolBar implements IDatabaseModificationOb
     }
 
     // requiredState - true for column filter, false for custom filters
+    /**
+     *
+     */
     private boolean getCustomFilterSelectedState(boolean requiredState)
     {
         GridCustomFilter selected = filterSelectionWidget.tryGetSelected();
@@ -257,18 +260,22 @@ public class FilterToolbar<T> extends ToolBar implements IDatabaseModificationOb
         }
     }
 
-    @SuppressWarnings("unchecked")
     public void resetFilterFields()
     {
         for (Component field : filterContainer.getItems())
         {
-            if (field instanceof Field)
+            if (field instanceof Field<?>)
             {
-                ((Field) field).reset();
+                ((Field<?>) field).reset();
             }
         }
     }
 
+    public void resetFilterSelection()
+    {
+        filterSelectionWidget.reset();
+    }
+
     private void apply()
     {
         // if filter is invalid the action only refreshes the grid without applying any filters
-- 
GitLab