Mercurial > dive4elements > river
changeset 2490:4d93f9255caa
Improve km-Spinner behaviour, allow text input (alpha).
flys-client/trunk@4283 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 20 Apr 2012 09:29:03 +0000 |
parents | 2a504b6d9a1b |
children | 18e59b0b4a71 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java |
diffstat | 2 files changed, 43 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Thu Apr 19 17:48:21 2012 +0000 +++ b/flys-client/ChangeLog Fri Apr 20 09:29:03 2012 +0000 @@ -16,6 +16,13 @@ src/main/webapp/WEB-INF/web.xml: Registered the new proxy servlet. +2012-04-18 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Improve km-Spinner behaviour, allow text input (alpha). + + * src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java + (KmSpinner): Replaced Label by somewhat working TextItem. + 2012-04-18 Raimund Renkert <raimund.renkert@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfoWindow.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java Thu Apr 19 17:48:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java Fri Apr 20 09:29:03 2012 +0000 @@ -13,7 +13,6 @@ import com.smartgwt.client.util.SC; -//import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.widgets.Button; @@ -28,14 +27,11 @@ import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.SelectItem; -//import com.smartgwt.client.widgets.form.fields.events.BlurEvent; -//import com.smartgwt.client.widgets.form.fields.events.BlurHandler; +import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; 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.ChangeHandler; -//import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent; -//import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler; import com.smartgwt.client.widgets.menu.Menu; import com.smartgwt.client.widgets.menu.MenuItem; @@ -536,8 +532,8 @@ currentValue = Double.valueOf(facetRecord.getTheme() .getCollectionItem().getData().get(CS_KM)); // Buttons and labels. - int height = 10; - // MinusButton shall ask service for previous available cs. + int height = 18; + // minusButton shall ask service for previous available cs. Button minusButton = new Button("-"); minusButton.setWidth(10); minusButton.setHeight(height); @@ -547,9 +543,37 @@ } }); // TODO i18n - label = new Label(Double.toString(currentValue)); - label.setWidth(10); - label.setHeight(height); + DynamicForm form = new DynamicForm(); + final TextItem kmField = new TextItem(); + kmField.setValue(currentValue); + kmField.setWidth(35); + kmField.setTitle(""); + kmField.setHeight(height); + // Update on focus lost and enter-pressed. + kmField.addBlurHandler(new BlurHandler() { + @Override + public void onBlur(BlurEvent be) { + spinnerValueEntered(null, + Double.parseDouble(kmField.getValue().toString()), + _facetRecord); + } + }); + kmField.addKeyPressHandler(new KeyPressHandler(){ + @Override + public void onKeyPress(KeyPressEvent kpe) { + if (kpe.getKeyName().equals("Enter")) { + kmField.blurItem(); + } + } + }); + // TODO: i18n Now add all the validators, formatters, editors/parsers etc. + form.setFields(kmField); + form.setTitle(""); + form.setTitlePrefix(""); + form.setTitleSuffix(""); + form.setTitleWidth(0); + form.setWidth(40); + form.setHeight(height); // PlusButton shall ask service for next available cs. Button plusButton = new Button("+"); plusButton.setWidth(10); @@ -560,12 +584,11 @@ } }); this.addMember(minusButton); - this.addMember(label); + this.addMember(form); this.addMember(plusButton); this.setHeight(height*2); } - } @@ -593,31 +616,7 @@ if (fieldName.equals(GRID_FIELD_ACTIONS)) { /* - HLayout recordCanvas = new HLayout(3); - recordCanvas.setHeight(22); - recordCanvas.setAlign(Alignment.CENTER); - - // When losing focus, update values. - final SpinnerItem spinnerItem = createSpinnerItem(facetRecord); - spinnerItem.addBlurHandler(new BlurHandler() { - @Override - public void onBlur(BlurEvent be) { - spinnerValueEntered(spinnerItem, - Double.parseDouble(spinnerItem.getValue().toString()), - facetRecord); - } - }); - - // Add KeyPressHandler to lose focus when Enter key is pressed. - spinnerItem.addKeyPressHandler(new KeyPressHandler(){ - @Override - public void onKeyPress(KeyPressEvent kpe) { - if (kpe.getKeyName().equals("Enter")) { - spinnerItem.blurItem(); - } - } - }); - + TODO: if (facetRecord.getTheme().getActive() != 1) { spinnerItem.disable(); } @@ -632,12 +631,6 @@ } */ - /* - DynamicForm formWrap = new DynamicForm(); - formWrap.setFields(spinnerItem); - formWrap.setTitlePrefix(""); - formWrap.setTitleSuffix(""); - */ return new KmSpinner(facetRecord); } else {