From c8d86f17f88f1ecd8ffe4a63ed4a25eaba0960df Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Fri, 6 Nov 2009 12:23:07 +0000
Subject: [PATCH] minor: remove unnecessary field

SVN: 13244
---
 .../client/application/ui/grid/AbstractBrowserGrid.java  | 9 +--------
 .../application/ui/grid/BrowserGridPagingToolBar.java    | 6 ++++++
 2 files changed, 7 insertions(+), 8 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 bf8e7b37528..beb6ceedc21 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
@@ -198,9 +198,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
     // result set key of the last refreshed data
     private String resultSetKey;
 
-    /** the number of all objects cached in the browser */
-    private int totalCount;
-
     private IDataRefreshCallback refreshCallback;
 
     protected AbstractBrowserGrid(final IViewContext<ICommonClientServiceAsync> viewContext,
@@ -618,7 +615,6 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
             // save the key of the result, later we can refer to the result in the cache using this
             // key
             saveCacheKey(result.getResultSetKey());
-            totalCount = result.getTotalLength();
             GridRowModels<T> rowModels = result.getList();
             List<GridCustomColumnInfo> customColumnMetadata = rowModels.getCustomColumnsMetadata();
             customColumnsMetadataProvider.setCustomColumnsMetadata(customColumnMetadata);
@@ -1265,10 +1261,7 @@ public abstract class AbstractBrowserGrid<T/* Entity */, M extends BaseEntityMod
     /** @return the number of all objects cached in the browser */
     public int getTotalCount()
     {
-        // NOTE: Maybe there is a better way to get this value without keeping it on field variable.
-        // Bottom toolbar displays it so there has to be access to this, but e.g.
-        // grid.getStore().getCount() returns only number of items displayed on the current page.
-        return totalCount;
+        return pagingToolbar.getTotalCount();
     }
 
     private void refreshColumnsSettings()
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java
index 7d127146e0f..8124a38362e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/BrowserGridPagingToolBar.java
@@ -77,6 +77,12 @@ public final class BrowserGridPagingToolBar extends PagingToolBarAdapter
         add(exportButton);
     }
 
+    /** Total number of items on all pages */
+    public int getTotalCount()
+    {
+        return totalLength;
+    }
+
     private void add(Widget widget)
     {
         add(new AdapterToolItem(widget));
-- 
GitLab