changeset 875:a77958780e1c

Updated the search field style including i18n and changed the handler implementation of TableFilter. flys-client/trunk@2702 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 12 Sep 2011 11:47:42 +0000
parents d900ab031dfe
children dbaef661d0e5
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/TableFilter.java
diffstat 6 files changed, 36 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Sep 12 09:39:15 2011 +0000
+++ b/flys-client/ChangeLog	Mon Sep 12 11:47:42 2011 +0000
@@ -1,3 +1,17 @@
+2011-09-12  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/TableFilter.java:
+	  The TableFilter implements KeyUpHandler now to receive the last pressed
+	  key.
+	  Removed the 'clear' button and ClickHandler implementation and set the label
+	  text to i18n strings.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  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_de.properties:
+	  Added i18n string for filter label.
+
 2011-09-12  Ingo Weinzierl <ingo@intevation.de>
 
 	flys/issue282 (Karte: Abstand interpolierte Profile - Default wert)
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Mon Sep 12 09:39:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Mon Sep 12 11:47:42 2011 +0000
@@ -210,6 +210,8 @@
 
     String imageSave();
 
+    String search();
+
     // OUTPUT TYPES
 
     String discharge_curve();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Mon Sep 12 09:39:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Mon Sep 12 11:47:42 2011 +0000
@@ -43,6 +43,7 @@
 unitFrom = km
 unitTo = km a
 unitWidth = m
+search = Search Term
 
 dpLabelFrom = From
 dpUnitFrom = km
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Mon Sep 12 09:39:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Mon Sep 12 11:47:42 2011 +0000
@@ -43,6 +43,7 @@
 unitFrom = km&nbsp;-
 unitTo = km a
 unitWidth = m
+search = Suchbegriff
 
 dpLabelFrom = Von
 dpUnitFrom = km
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Mon Sep 12 09:39:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Mon Sep 12 11:47:42 2011 +0000
@@ -43,6 +43,7 @@
 unitFrom = km
 unitTo = km a
 unitWidth = m
+search = Search Term
 
 dpLabelFrom = From
 dpUnitFrom = km
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/TableFilter.java	Mon Sep 12 09:39:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/TableFilter.java	Mon Sep 12 11:47:42 2011 +0000
@@ -3,6 +3,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import com.google.gwt.core.client.GWT;
+
 import com.smartgwt.client.widgets.IButton;
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
@@ -10,12 +12,13 @@
 import com.smartgwt.client.widgets.form.fields.TextItem;
 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
+import com.smartgwt.client.widgets.form.fields.events.KeyUpEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyUpHandler;
 import com.smartgwt.client.widgets.layout.HLayout;
 
 import de.intevation.flys.client.client.event.FilterHandler;
 import de.intevation.flys.client.client.event.StringFilterEvent;
+import de.intevation.flys.client.client.FLYSConstants;
 
 
 /**
@@ -23,10 +26,10 @@
  */
 public class TableFilter
 extends      HLayout
-implements   ChangedHandler, ClickHandler, KeyPressHandler
+implements   ChangedHandler, KeyUpHandler
 {
-    public static final String SEARCH_FIELD = "searchfield";
-
+    /** The message class that provides i18n strings. */
+    protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
 
     protected List<FilterHandler> handlers;
 
@@ -35,20 +38,16 @@
 
     public TableFilter() {
         super();
-        searchfield = new TextItem(SEARCH_FIELD);
+        searchfield = new TextItem(MESSAGES.search());
         handlers    = new ArrayList<FilterHandler>();
 
         searchfield.addChangedHandler(this);
-        searchfield.addKeyPressHandler(this);
+        searchfield.addKeyUpHandler(this);
 
         DynamicForm form = new DynamicForm();
         form.setFields(searchfield);
 
-        IButton clear = new IButton("Clear");
-        clear.addClickHandler(this);
-
         addMember(form);
-        addMember(clear);
     }
 
 
@@ -58,7 +57,7 @@
     }
 
 
-    public void onKeyPress(KeyPressEvent event) {
+    public void onKeyUp(KeyUpEvent event) {
         //To deactivate "As you type" filter add
         // ' && event.getKeyName().equals("Enter")'
         // to the if-clause.
@@ -68,19 +67,13 @@
     }
 
 
-    public void onClick(ClickEvent event) {
-        searchfield.setValue("");
-        fireFilterCriteriaChanged("");
-    }
-
-
-    public void clearSearch() {
-        searchfield.setValue("");
-    }
-
-
     public String getSearchString() {
-        return searchfield.getValueAsString();
+        if (searchfield.getValueAsString() == null) {
+            return "";
+        }
+        else {
+            return searchfield.getValueAsString();
+        }
     }
 
 

http://dive4elements.wald.intevation.org