From 1edd29aaea61e844e28414214df97734b072e73a Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Mon, 4 Apr 2011 10:54:01 +0000
Subject: [PATCH] [LMS-2177] minor: added clear button to history widget

SVN: 20636
---
 .../client/web/client/application/Dict.java   |  6 +++--
 .../application/ui/widget/HistoryWidget.java  | 25 +++++++++++--------
 .../cisd/openbis/public/common-dictionary.js  |  1 +
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
index 00a3a7a76ee..4051e608a26 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
@@ -146,7 +146,7 @@ public abstract class Dict
     public static final String BUTTON_EXPORT_TABLE = "button_exportTable";
 
     public static final String BUTTON_LOGIN_LABEL = "login_buttonLabel";
-    
+
     public static final String BUTTON_LOGOUT_LABEL = "logout_buttonLabel";
 
     public static final String BUTTON_HOME_LABEL = "home_buttonLabel";
@@ -172,7 +172,7 @@ public abstract class Dict
     public static final String LOGIN_BUTTON_LABEL = "login_buttonLabel";
 
     public static final String LOGIN_FAILED = "login_failed";
-    
+
     //
     // AbstractAsyncCallback
     //
@@ -1092,5 +1092,7 @@ public abstract class Dict
 
     public static final String LAST_VISITS = "last_visits";
 
+    public static final String CLEAR = "clear";
+
     // ----- end generic ------------------
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/HistoryWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/HistoryWidget.java
index 345c17a12f9..d0a1002c4cf 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/HistoryWidget.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/widget/HistoryWidget.java
@@ -84,19 +84,22 @@ public class HistoryWidget extends ContentPanel
         setLayout(new FitLayout());
         setHeaderVisible(true);
         setHeading(viewContext.getMessage(Dict.LAST_VISITS));
-        final Button clearButton = new Button("Clear", new SelectionListener<ButtonEvent>()
-            {
-                @Override
-                public void componentSelected(ButtonEvent ce)
-                {
-                    List<EntityVisit> visits = viewContext.getDisplaySettingsManager().getVisits();
-                    visits.clear();
-                    // TODO 2011-31-03, Piotr Buczek: refresh the widget
-                }
-            });
+
+        final TreeStore<ModelData> store = createStore(viewContext);
+        final Button clearButton =
+                new Button(viewContext.getMessage(Dict.CLEAR), new SelectionListener<ButtonEvent>()
+                    {
+                        @Override
+                        public void componentSelected(ButtonEvent ce)
+                        {
+                            List<EntityVisit> visits =
+                                    viewContext.getDisplaySettingsManager().getVisits();
+                            visits.clear();
+                            store.removeAll();
+                        }
+                    });
         getHeader().addTool(clearButton);
 
-        TreeStore<ModelData> store = createStore(viewContext);
         ColumnModel columnModel = createColumnModel(viewContext);
 
         final TreeGrid<ModelData> treeGrid = new TreeGrid<ModelData>(store, columnModel);
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
index 6359c429dc6..56cd4cdf62e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
@@ -753,6 +753,7 @@ warning_no_script_message: "No script provided",
 // History Widget
 //
 last_visits: "Last Visited Places",
+clear: "Clear",
  
  // LAST LINE: KEEP IT AT THE END
   lastline: "" // we need a line without a comma
-- 
GitLab