changeset 893:89c01218172b

Clear the table filter on tab selection change and input method change. (Issue305) flys-client/trunk@2738 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 14 Sep 2011 10:11:50 +0000 (2011-09-14)
parents 63b258bf365c
children 5341be7dec7a
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/TableFilter.java
diffstat 4 files changed, 46 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Sep 14 10:00:55 2011 +0000
+++ b/flys-client/ChangeLog	Wed Sep 14 10:11:50 2011 +0000
@@ -1,3 +1,13 @@
+2011-09-14  Raimund Renkert <raimund.renkert@intevation.de>
+
+	Issue305
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/TableFilter.java:
+	  Clear the table filter on tab selection change and input method
+	  change.
+
 2011-09-14  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/meta/Converter.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java	Wed Sep 14 10:00:55 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java	Wed Sep 14 10:11:50 2011 +0000
@@ -19,6 +19,8 @@
 import com.smartgwt.client.widgets.layout.VLayout;
 import com.smartgwt.client.widgets.tab.TabSet;
 import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
 
 import de.intevation.flys.client.shared.model.ArtifactDescription;
 import de.intevation.flys.client.shared.model.Data;
@@ -53,6 +55,8 @@
 
     protected DoubleRangePanel distancePanel;
 
+    protected TableFilter filter;
+
     protected TabSet tabs;
 
     protected double min;
@@ -465,10 +469,16 @@
         tabs.addTab(locations, 0);
         tabs.addTab(distances, 1);
 
-        TableFilter filter = new TableFilter();
+        filter = new TableFilter();
         filter.setHeight("30px");
         filter.addFilterHandler(this);
 
+        tabs.addTabSelectedHandler(new TabSelectedHandler() {
+            public void onTabSelected(TabSelectedEvent evt) {
+                filter.clear();
+            }
+        });
+
         helperContainer.addMember(tabs);
         helperContainer.addMember(filter);
     }
@@ -483,7 +493,8 @@
             distancesTable.filterData(c);
         }
         else {
-            // TODO Remove filter
+            locationsTable.clearCriteria();
+            distancesTable.clearCriteria();
         }
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Wed Sep 14 10:00:55 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Wed Sep 14 10:11:50 2011 +0000
@@ -25,6 +25,8 @@
 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
 import com.smartgwt.client.widgets.grid.events.CellClickHandler;
 import com.smartgwt.client.widgets.grid.events.CellClickEvent;
+import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
 
 import com.smartgwt.client.widgets.tab.TabSet;
 import com.smartgwt.client.widgets.tab.Tab;
@@ -135,6 +137,9 @@
     /** The table data. */
     protected DistanceInfoObject[] tableData;
 
+    /** The table filter.*/
+    protected TableFilter filter;
+
     /**
      * Creates a new LocationDistancePanel instance.
      */
@@ -594,6 +599,12 @@
         container.setMembersMargin(30);
 
         inputTables   = new TabSet();
+        inputTables.addTabSelectedHandler(new TabSelectedHandler() {
+            public void onTabSelected(TabSelectedEvent evt) {
+                filter.clear();
+            }
+        });
+
         Tab locations = new Tab(MESSAGES.locations());
         Tab distances = new Tab(MESSAGES.distance());
 
@@ -606,7 +617,7 @@
         inputTables.addTab(locations);
         inputTables.addTab(distances);
 
-        TableFilter filter = new TableFilter();
+        filter = new TableFilter();
         filter.setHeight("30px");
         filter.addFilterHandler(this);
 
@@ -635,7 +646,9 @@
             locationDistanceTable.filterData(c);
         }
         else {
-            // TODO Remove filter
+            locationsTable.clearCriteria();
+            distanceTable.clearCriteria();
+            locationDistanceTable.clearCriteria();
         }
     }
 
@@ -927,6 +940,7 @@
         }
         if (value.equals(FIELD_VALUE_LOCATION)) {
             enableLocationPanel();
+            filter.clear();
             // Remove the tab containing the locationDistanceTable.
             // The 'updateTab()' avoids the tab content to be destroyed.
             inputTables.updateTab(0, null);
@@ -942,6 +956,7 @@
         }
         else {
             enableDistancePanel();
+            filter.clear();
             // Remove the tab containing the locationTable.
             // The 'updateTab()' avoids the tab content to be destroyed.
             inputTables.updateTab(0, null);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/TableFilter.java	Wed Sep 14 10:00:55 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/TableFilter.java	Wed Sep 14 10:11:50 2011 +0000
@@ -91,5 +91,11 @@
             handler.onFilterCriteriaChanged(filter);
         }
     }
+
+
+    public void clear() {
+        searchfield.clearValue();
+        fireFilterCriteriaChanged("");
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org