Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java @ 519:77234b1d009c
ISSUE-90 & ISSUE-40 (part II/II) Former selected values are preselected after back jumps.
flys-client/trunk@1998 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 24 May 2011 16:22:34 +0000 |
parents | be842e36ce1c |
children | 2e02db03e576 |
comparison
equal
deleted
inserted
replaced
518:bac8e6ea277d | 519:77234b1d009c |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | 2 |
3 import java.util.List; | 3 import java.util.List; |
4 | 4 |
5 import com.google.gwt.core.client.GWT; | 5 import com.google.gwt.core.client.GWT; |
6 import com.google.gwt.i18n.client.NumberFormat; | |
6 import com.google.gwt.user.client.rpc.AsyncCallback; | 7 import com.google.gwt.user.client.rpc.AsyncCallback; |
7 | 8 |
8 import com.smartgwt.client.widgets.Canvas; | 9 import com.smartgwt.client.widgets.Canvas; |
9 import com.smartgwt.client.widgets.Label; | 10 import com.smartgwt.client.widgets.Label; |
10 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; | 11 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
89 */ | 90 */ |
90 public Canvas create(DataList data) { | 91 public Canvas create(DataList data) { |
91 VLayout layout = new VLayout(); | 92 VLayout layout = new VLayout(); |
92 layout.setMembersMargin(10); | 93 layout.setMembersMargin(10); |
93 | 94 |
94 initDefaults(data); | |
95 | |
96 Label label = new Label(MESSAGES.location ()); | 95 Label label = new Label(MESSAGES.location ()); |
97 Canvas widget = createWidget(data); | 96 Canvas widget = createWidget(data); |
98 Canvas submit = getNextButton(); | 97 Canvas submit = getNextButton(); |
98 | |
99 initDefaults(data); | |
99 | 100 |
100 createLocationTable(); | 101 createLocationTable(); |
101 | 102 |
102 widget.setHeight(50); | 103 widget.setHeight(50); |
103 label.setHeight(25); | 104 label.setHeight(25); |
177 * objects in <i>list</i>. | 178 * objects in <i>list</i>. |
178 * | 179 * |
179 * @param list The DataList container that stores the Data objects. | 180 * @param list The DataList container that stores the Data objects. |
180 */ | 181 */ |
181 protected void initDefaults(DataList list) { | 182 protected void initDefaults(DataList list) { |
183 Data data = list.get(0); | |
184 | |
185 if (data == null) { | |
186 return; | |
187 } | |
188 | |
189 DataItem def = data.getDefault(); | |
190 String value = def.getStringValue(); | |
191 | |
192 try { | |
193 double d = Double.parseDouble(value); | |
194 setLocationValues(new double[] { d } ); | |
195 } | |
196 catch (NumberFormatException nfe) { | |
197 // could not parse, dont know what to do else | |
198 } | |
182 } | 199 } |
183 | 200 |
184 | 201 |
185 /** | 202 /** |
186 * This method greps the Data with name <i>name</i> from the list and | 203 * This method greps the Data with name <i>name</i> from the list and |