changeset 1567:7e738bc8ed75

Show hit count in filtered input helper tables. flys-client/trunk@3824 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 30 Jan 2012 13:05:14 +0000
parents c408074c6409
children 2432973ccced
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties 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/SingleLocationPanel.java
diffstat 8 files changed, 94 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/ChangeLog	Mon Jan 30 13:05:14 2012 +0000
@@ -1,3 +1,16 @@
+2012-01-30  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* 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/SingleLocationPanel.java:
+	  Show count of hits in filtered input helper tables.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Added i18n string.
+
 2012-01-30  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/RangeData.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Mon Jan 30 13:05:14 2012 +0000
@@ -310,6 +310,8 @@
 
     String description();
 
+    String resultCount();
+
     // Elevation window
 
     String ele_window_title();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Mon Jan 30 13:05:14 2012 +0000
@@ -76,6 +76,7 @@
 cancelCalculationLabel = Stop the current calculation.
 calculationCanceled = The calculation has been canceled.
 range = Range
+resultCount = Hits
 
 # Header images
 flysLogo = images/flys_logo.gif
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Mon Jan 30 13:05:14 2012 +0000
@@ -76,7 +76,7 @@
 cancelCalculationLabel = Aktuelle Berechnung abbrechen.
 calculationCanceled = Die Berechnung wurde abgebrochen.
 range = Bereich
-
+resultCount = Treffer
 # Header images
 flysLogo = images/flys_logo.gif
 bfgLogo = images/bfg_logo.gif
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Mon Jan 30 13:05:14 2012 +0000
@@ -76,6 +76,7 @@
 cancelCalculationLabel = Stop the current calculation.
 calculationCanceled = The calculation has been canceled.
 range = Range
+resultCount = Hits
 
 # Header images
 flysLogo = images/flys_logo.gif
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java	Mon Jan 30 13:05:14 2012 +0000
@@ -14,10 +14,13 @@
 
 import com.smartgwt.client.data.Record;
 import com.smartgwt.client.util.SC;
+import com.smartgwt.client.types.Alignment;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.form.DynamicForm;
 import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
@@ -73,6 +76,8 @@
     protected double min;
     protected double max;
 
+    protected StaticTextItem filterResultCount;
+    protected ListGrid currentFiltered;
 
     public DistancePanel() {
         this("right");
@@ -489,6 +494,10 @@
         tabs.addTab(locations, 0);
         tabs.addTab(distances, 1);
 
+        filterResultCount = new StaticTextItem(MSG.resultCount());
+        filterResultCount.setTitleAlign(Alignment.LEFT);
+        filterResultCount.setTitleStyle("color: #000");
+
         filterDescription = new TableFilter();
         filterDescription.setHeight("30px");
         filterDescription.addFilterHandler(this);
@@ -526,21 +535,30 @@
         DynamicForm form = new DynamicForm();
         form.setFields(filterCriteria);
 
+        DynamicForm form2 = new DynamicForm();
+        form2.setFields(filterResultCount);
+
         HLayout filterLayout = new HLayout();
         filterLayout.addMember(form);
         filterLayout.addMember(filterDescription);
         filterLayout.addMember(filterRange);
-
-
+        filterLayout.setHeight(30);
         tabs.addTabSelectedHandler(new TabSelectedHandler() {
             public void onTabSelected(TabSelectedEvent evt) {
                 filterDescription.clear();
                 filterRange.clear();
+                filterResultCount.setValue("");
+
+                Canvas c = evt.getTabPane();
+                if(c instanceof ListGrid) {
+                    currentFiltered = (ListGrid)c;
+                }
             }
         });
 
         helperContainer.addMember(tabs);
         helperContainer.addMember(filterLayout);
+        helperContainer.addMember(form2);
     }
 
 
@@ -551,10 +569,12 @@
             Criteria c = new Criteria("description", search);
             locationsTable.filterData(c);
             distancesTable.filterData(c);
+            filterResultCount.setValue(currentFiltered.getRecords().length);
         }
         else {
             locationsTable.clearCriteria();
             distancesTable.clearCriteria();
+            filterResultCount.setValue("");
         }
     }
 
@@ -568,6 +588,8 @@
         if (from.equals(Float.NaN) && to.equals(Float.NaN)) {
             locationsTable.clearCriteria();
             distancesTable.clearCriteria();
+            filterResultCount.setValue("");
+            return;
         }
         else if (from.equals(Float.NaN)) {
             combinedFilter = new Criterion("to", OperatorId.LESS_OR_EQUAL, to);
@@ -575,6 +597,7 @@
                 new Criterion("from", OperatorId.LESS_OR_EQUAL, to);
             locationsTable.filterData(locationFilter);
             distancesTable.filterData(combinedFilter);
+            filterResultCount.setValue(currentFiltered.getRecords().length);
             return;
         }
         else if (to.equals(Float.NaN)) {
@@ -607,6 +630,8 @@
         }
         locationsTable.filterData(combinedFilter);
         distancesTable.filterData(combinedFilter);
+        filterResultCount.setValue(currentFiltered.getRecords().length);
+
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Mon Jan 30 13:05:14 2012 +0000
@@ -25,6 +25,7 @@
 import com.smartgwt.client.widgets.form.fields.FormItem;
 import com.smartgwt.client.widgets.form.fields.SelectItem;
 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 import com.smartgwt.client.widgets.grid.ListGrid;
@@ -37,6 +38,7 @@
 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.types.Alignment;
 
 import com.smartgwt.client.widgets.tab.TabSet;
 import com.smartgwt.client.widgets.tab.Tab;
@@ -151,7 +153,8 @@
 
     /** The Combobox for table filter criteria. */
     protected SelectItem filterCriteria;
-
+    protected StaticTextItem filterResultCount;
+    protected ListGrid currentFiltered;
 
     /**
      * Creates a new LocationDistancePanel instance.
@@ -669,6 +672,7 @@
             enableDistancePanel();
             inputTables.selectTab(1);
         }
+        currentFiltered = (ListGrid)inputTables.getSelectedTab().getPane();
     }
 
 
@@ -694,6 +698,12 @@
             public void onTabSelected(TabSelectedEvent evt) {
                 filterDescription.clear();
                 filterRange.clear();
+                filterResultCount.setValue("");
+
+                Canvas c = evt.getTabPane();
+                if(c instanceof ListGrid) {
+                    currentFiltered = (ListGrid)c;
+                }
             }
         });
 
@@ -709,6 +719,10 @@
         inputTables.addTab(locations);
         inputTables.addTab(distances);
 
+        filterResultCount = new StaticTextItem(MESSAGES.resultCount());
+        filterResultCount.setTitleAlign(Alignment.LEFT);
+        filterResultCount.setTitleStyle("color: #000");
+
         filterDescription = new TableFilter();
         filterDescription.setHeight("30px");
         filterDescription.addFilterHandler(this);
@@ -727,11 +741,13 @@
                     filterRange.setVisible(true);
                     filterDescription.setVisible(false);
                     filterDescription.clear();
+                    filterResultCount.setValue("");
                 }
                 else {
                     filterRange.setVisible(false);
                     filterRange.clear();
                     filterDescription.setVisible(true);
+                    filterResultCount.setValue("");
                 }
             }
         });
@@ -745,8 +761,9 @@
 
         DynamicForm form = new DynamicForm();
         form.setFields(filterCriteria);
-
         inputTables.setHeight("*");
+        DynamicForm form2 = new DynamicForm();
+        form2.setFields(filterResultCount);
 
         VLayout helper = new VLayout();
         HLayout filterLayout = new HLayout();
@@ -754,9 +771,10 @@
         filterLayout.addMember(form);
         filterLayout.addMember(filterDescription);
         filterLayout.addMember(filterRange);
-        filterLayout.setHeight("33px");
+        filterLayout.setHeight("30px");
         helper.addMember(inputTables);
         helper.addMember(filterLayout);
+        helper.addMember(form2);
         helper.setHeight100();
         helper.setWidth100();
 
@@ -776,11 +794,13 @@
             locationsTable.filterData(c);
             distanceTable.filterData(c);
             locationDistanceTable.filterData(c);
+            filterResultCount.setValue(currentFiltered.getRecords().length);
         }
         else {
             locationsTable.clearCriteria();
             distanceTable.clearCriteria();
             locationDistanceTable.clearCriteria();
+            filterResultCount.setValue("");
         }
     }
 
@@ -797,6 +817,8 @@
             locationsTable.clearCriteria();
             distanceTable.clearCriteria();
             locationDistanceTable.clearCriteria();
+            filterResultCount.setValue("");
+            return;
         }
         else if (from.equals(Float.NaN)) {
             combinedFilter = new Criterion("to", OperatorId.LESS_OR_EQUAL, to);
@@ -805,6 +827,7 @@
             locationsTable.filterData(locationFilter);
             distanceTable.filterData(combinedFilter);
             locationDistanceTable.filterData(combinedFilter);
+            filterResultCount.setValue(currentFiltered.getRecords().length);
             return;
         }
         else if (to.equals(Float.NaN)) {
@@ -841,6 +864,7 @@
         locationsTable.filterData(combinedFilter);
         distanceTable.filterData(combinedFilter);
         locationDistanceTable.filterData(combinedFilter);
+        filterResultCount.setValue(currentFiltered.getRecords().length);
     }
 
 
@@ -1134,6 +1158,8 @@
             enableLocationPanel();
             filterDescription.clear();
             filterRange.clear();
+            filterResultCount.setValue("");
+
             // Remove the tab containing the locationDistanceTable.
             // The 'updateTab()' avoids the tab content to be destroyed.
             inputTables.updateTab(0, null);
@@ -1151,6 +1177,8 @@
             enableDistancePanel();
             filterDescription.clear();
             filterRange.clear();
+            filterResultCount.setValue("");
+
             // 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/SingleLocationPanel.java	Mon Jan 30 10:12:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java	Mon Jan 30 13:05:14 2012 +0000
@@ -15,6 +15,7 @@
 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
 import com.smartgwt.client.widgets.form.fields.FormItem;
 import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
 
@@ -32,6 +33,7 @@
 import com.smartgwt.client.data.Criterion;
 import com.smartgwt.client.data.AdvancedCriteria;
 import com.smartgwt.client.types.OperatorId;
+import com.smartgwt.client.types.Alignment;
 
 import com.smartgwt.client.data.Record;
 import com.smartgwt.client.types.ListGridFieldType;
@@ -91,6 +93,8 @@
     /** The table data. */
     protected DistanceInfoObject[] tableData;
 
+    protected StaticTextItem filterResultCount;
+
     /**
      * Creates a new LocationDistancePanel instance.
      */
@@ -315,6 +319,10 @@
 
         container.setMembersMargin(30);
 
+        filterResultCount = new StaticTextItem(MESSAGES.resultCount());
+        filterResultCount.setTitleAlign(Alignment.LEFT);
+        filterResultCount.setTitleStyle("color: #000");
+
         final TableFilter filter = new TableFilter();
         filter.setHeight("30px");
         filter.addFilterHandler(this);
@@ -333,11 +341,13 @@
                     filterRange.setVisible(true);
                     filter.setVisible(false);
                     filter.clear();
+                    filterResultCount.setValue("");
                 }
                 else {
                     filterRange.setVisible(false);
                     filterRange.clear();
                     filter.setVisible(true);
+                    filterResultCount.setValue("");
                 }
             }
         });
@@ -352,6 +362,9 @@
         DynamicForm form = new DynamicForm();
         form.setFields(filterCriteria);
 
+        DynamicForm form2 = new DynamicForm();
+        form2.setFields(filterResultCount);
+
         HLayout filterLayout = new HLayout();
         filterLayout.addMember(form);
         filterLayout.addMember(filter);
@@ -359,6 +372,7 @@
 
         helperContainer.addMember(locationTable);
         helperContainer.addMember(filterLayout);
+        helperContainer.addMember(form2);
         createInputPanel();
         return layout;
     }
@@ -369,6 +383,7 @@
         if (search != null && search.length() > 0) {
             Criteria c = new Criteria("description", search);
             locationTable.filterData(c);
+            filterResultCount.setValue(locationTable.getRecords().length);
         }
         else {
             // TODO Remove filter
@@ -383,6 +398,8 @@
         Criterion combinedFilter = null;
         if (from.equals(Float.NaN) && to.equals(Float.NaN)) {
             locationTable.clearCriteria();
+            filterResultCount.setValue("");
+            return;
         }
         else if (from.equals(Float.NaN)) {
             combinedFilter =
@@ -400,6 +417,7 @@
                 });
         }
         locationTable.filterData(combinedFilter);
+        filterResultCount.setValue(locationTable.getRecords().length);
     }
 
 

http://dive4elements.wald.intevation.org