Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java @ 906:39acba4b5f0b
Added formatter for numeric columns that converts the decimal separator.
(Issue200)
flys-client/trunk@2758 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 15 Sep 2011 14:48:31 +0000 |
parents | dd702348b878 |
children | 24d15c2e0da3 |
comparison
equal
deleted
inserted
replaced
905:478a571f1f94 | 906:39acba4b5f0b |
---|---|
14 import com.smartgwt.client.widgets.form.fields.FormItem; | 14 import com.smartgwt.client.widgets.form.fields.FormItem; |
15 import com.smartgwt.client.widgets.layout.HLayout; | 15 import com.smartgwt.client.widgets.layout.HLayout; |
16 import com.smartgwt.client.widgets.layout.VLayout; | 16 import com.smartgwt.client.widgets.layout.VLayout; |
17 import com.smartgwt.client.widgets.grid.ListGrid; | 17 import com.smartgwt.client.widgets.grid.ListGrid; |
18 import com.smartgwt.client.widgets.grid.ListGridField; | 18 import com.smartgwt.client.widgets.grid.ListGridField; |
19 import com.smartgwt.client.widgets.grid.ListGridRecord; | |
20 | |
19 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; | 21 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; |
20 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; | 22 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; |
23 import com.smartgwt.client.widgets.grid.CellFormatter; | |
21 | 24 |
22 import com.smartgwt.client.data.Criteria; | 25 import com.smartgwt.client.data.Criteria; |
23 import com.smartgwt.client.data.Record; | 26 import com.smartgwt.client.data.Record; |
24 import com.smartgwt.client.types.ListGridFieldType; | 27 import com.smartgwt.client.types.ListGridFieldType; |
25 | 28 |
161 MESSAGES.riverside()); | 164 MESSAGES.riverside()); |
162 lside.setType(ListGridFieldType.TEXT); | 165 lside.setType(ListGridFieldType.TEXT); |
163 lside.setWidth("10%"); | 166 lside.setWidth("10%"); |
164 | 167 |
165 ListGridField loc = new ListGridField("from", MESSAGES.location()); | 168 ListGridField loc = new ListGridField("from", MESSAGES.location()); |
169 loc.setCellFormatter(new CellFormatter() { | |
170 public String format( | |
171 Object value, | |
172 ListGridRecord record, | |
173 int rowNum, int colNum) { | |
174 if (value == null) return null; | |
175 try { | |
176 NumberFormat nf; | |
177 double v = Double.parseDouble((String)value); | |
178 nf = NumberFormat.getFormat("###0.00##"); | |
179 return nf.format(v); | |
180 } | |
181 catch (Exception e) { | |
182 return value.toString(); | |
183 } | |
184 } | |
185 } | |
186 ); | |
166 loc.setType(ListGridFieldType.FLOAT); | 187 loc.setType(ListGridFieldType.FLOAT); |
188 | |
167 loc.setWidth("10%"); | 189 loc.setWidth("10%"); |
168 | 190 |
169 ListGridField bottom = | 191 ListGridField bottom = |
170 new ListGridField("bottom", MESSAGES.bottom_edge()); | 192 new ListGridField("bottom", MESSAGES.bottom_edge()); |
171 bottom.setType(ListGridFieldType.TEXT); | 193 bottom.setType(ListGridFieldType.TEXT); |