comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java @ 2918:d92770527b0f

Changed handler for km navigation in fix analysis charts. flys-client/trunk@4743 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 21 Jun 2012 13:22:11 +0000
parents 37dce0f2f63b
children 6cf983dd4f8a
comparison
equal deleted inserted replaced
2917:be99bf1aa59b 2918:d92770527b0f
12 12
13 import com.smartgwt.client.widgets.form.DynamicForm; 13 import com.smartgwt.client.widgets.form.DynamicForm;
14 14
15 import com.smartgwt.client.widgets.form.fields.TextItem; 15 import com.smartgwt.client.widgets.form.fields.TextItem;
16 16
17 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; 17 import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
18 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; 18 import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
19 19
20 import com.smartgwt.client.widgets.form.validator.IsFloatValidator; 20 import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
21 21
22 import com.smartgwt.client.widgets.layout.HLayout; 22 import com.smartgwt.client.widgets.layout.HLayout;
23 import com.smartgwt.client.widgets.layout.VLayout; 23 import com.smartgwt.client.widgets.layout.VLayout;
114 updateChartUp(); 114 updateChartUp();
115 currentkm.setValue(collectionView.getCurrentKm()); 115 currentkm.setValue(collectionView.getCurrentKm());
116 } 116 }
117 }); 117 });
118 118
119 currentkm.addChangedHandler(new ChangedHandler() { 119 currentkm.addKeyPressHandler(new KeyPressHandler() {
120 public void onChanged(ChangedEvent ce) { 120 public void onKeyPress(KeyPressEvent kpe) {
121 if(ce.getForm().validate() && ce.getItem().getValue() != null) { 121 if (!kpe.getKeyName().equals("Enter")) {
122 return;
123 }
124 if(kpe.getForm().validate() && kpe.getItem().getValue() != null) {
122 try { 125 try {
123 String s = ce.getItem().getValue().toString(); 126 String s = kpe.getItem().getValue().toString();
124 Double d = new Double(s); 127 Double d = new Double(s);
125 if (d < collectionView.getMaxKm() && 128 if (d <= collectionView.getMaxKm() &&
126 d > collectionView.getMinKm()) { 129 d >= collectionView.getMinKm()) {
127 collectionView.setCurrentKm(d); 130 collectionView.setCurrentKm(d);
128 if (right != null) { 131 if (right != null) {
129 updateChartPanel(); 132 updateChartPanel();
130 updateChartInfo(); 133 updateChartInfo();
131 } 134 }

http://dive4elements.wald.intevation.org