diff flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java @ 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
parents 2161d3acc83f
children dd702348b878
line wrap: on
line diff
--- 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);

http://dive4elements.wald.intevation.org