Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.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 | 748e7c828d03 |
comparison
equal
deleted
inserted
replaced
905:478a571f1f94 | 906:39acba4b5f0b |
---|---|
1 package de.intevation.flys.client.client.ui.range; | 1 package de.intevation.flys.client.client.ui.range; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 import com.google.gwt.i18n.client.NumberFormat; | |
4 | 5 |
5 import com.smartgwt.client.types.ListGridFieldType; | 6 import com.smartgwt.client.types.ListGridFieldType; |
6 import com.smartgwt.client.types.SelectionStyle; | 7 import com.smartgwt.client.types.SelectionStyle; |
7 import com.smartgwt.client.widgets.grid.ListGrid; | 8 import com.smartgwt.client.widgets.grid.ListGrid; |
8 import com.smartgwt.client.widgets.grid.ListGridField; | 9 import com.smartgwt.client.widgets.grid.ListGridField; |
10 import com.smartgwt.client.widgets.grid.ListGridRecord; | |
11 | |
12 import com.smartgwt.client.widgets.grid.CellFormatter; | |
9 | 13 |
10 import de.intevation.flys.client.client.FLYSConstants; | 14 import de.intevation.flys.client.client.FLYSConstants; |
11 import de.intevation.flys.client.client.FLYSImages; | 15 import de.intevation.flys.client.client.FLYSImages; |
12 | 16 |
13 | 17 |
53 lside.setType(ListGridFieldType.TEXT); | 57 lside.setType(ListGridFieldType.TEXT); |
54 lside.setWidth("12%"); | 58 lside.setWidth("12%"); |
55 | 59 |
56 ListGridField loc = new ListGridField("from", MSG.locations()); | 60 ListGridField loc = new ListGridField("from", MSG.locations()); |
57 loc.setType(ListGridFieldType.FLOAT); | 61 loc.setType(ListGridFieldType.FLOAT); |
62 loc.setCellFormatter(new CellFormatter() { | |
63 public String format( | |
64 Object value, | |
65 ListGridRecord record, | |
66 int rowNum, int colNum) { | |
67 if (value == null) return null; | |
68 try { | |
69 NumberFormat nf; | |
70 double v = Double.parseDouble((String)value); | |
71 nf = NumberFormat.getFormat("###0.00##"); | |
72 return nf.format(v); | |
73 } | |
74 catch (Exception e) { | |
75 return value.toString(); | |
76 } | |
77 } | |
78 } | |
79 ); | |
80 | |
58 loc.setWidth("12%"); | 81 loc.setWidth("12%"); |
59 | 82 |
60 ListGridField bottom = new ListGridField("bottom", MSG.bottom_edge()); | 83 ListGridField bottom = new ListGridField("bottom", MSG.bottom_edge()); |
61 bottom.setType(ListGridFieldType.TEXT); | 84 bottom.setType(ListGridFieldType.TEXT); |
62 bottom.setWidth("10%"); | 85 bottom.setWidth("10%"); |