# HG changeset patch # User Raimund Renkert # Date 1315828062 0 # Node ID a77958780e1c64c5bd4264fef5d8be4325a657ab # Parent d900ab031dfeba0d3ea5fed81f6366e68cf3b656 Updated the search field style including i18n and changed the handler implementation of TableFilter. flys-client/trunk@2702 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d900ab031dfe -r a77958780e1c flys-client/ChangeLog --- 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 + + * 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 flys/issue282 (Karte: Abstand interpolierte Profile - Default wert) diff -r d900ab031dfe -r a77958780e1c flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java --- 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(); diff -r d900ab031dfe -r a77958780e1c flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties --- 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 diff -r d900ab031dfe -r a77958780e1c flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties --- 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 - unitTo = km a unitWidth = m +search = Suchbegriff dpLabelFrom = Von dpUnitFrom = km diff -r d900ab031dfe -r a77958780e1c flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties --- 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 diff -r d900ab031dfe -r a77958780e1c flys-client/src/main/java/de/intevation/flys/client/client/ui/TableFilter.java --- 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 handlers; @@ -35,20 +38,16 @@ public TableFilter() { super(); - searchfield = new TextItem(SEARCH_FIELD); + searchfield = new TextItem(MESSAGES.search()); handlers = new ArrayList(); 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(); + } }