Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java Thu Sep 15 12:55:36 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SingleLocationPanel.java Thu Sep 15 14:48:31 2011 +0000 @@ -16,8 +16,11 @@ import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; +import com.smartgwt.client.widgets.grid.ListGridRecord; + import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import com.smartgwt.client.widgets.grid.events.RecordClickEvent; +import com.smartgwt.client.widgets.grid.CellFormatter; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.Record; @@ -163,7 +166,26 @@ lside.setWidth("10%"); ListGridField loc = new ListGridField("from", MESSAGES.location()); + loc.setCellFormatter(new CellFormatter() { + public String format( + Object value, + ListGridRecord record, + int rowNum, int colNum) { + if (value == null) return null; + try { + NumberFormat nf; + double v = Double.parseDouble((String)value); + nf = NumberFormat.getFormat("###0.00##"); + return nf.format(v); + } + catch (Exception e) { + return value.toString(); + } + } + } + ); loc.setType(ListGridFieldType.FLOAT); + loc.setWidth("10%"); ListGridField bottom =