Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.java Thu Sep 15 12:55:36 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.java Thu Sep 15 14:48:31 2011 +0000 @@ -1,11 +1,15 @@ package de.intevation.flys.client.client.ui.range; import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.NumberFormat; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.types.SelectionStyle; 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.CellFormatter; import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.FLYSImages; @@ -55,6 +59,25 @@ ListGridField loc = new ListGridField("from", MSG.locations()); loc.setType(ListGridFieldType.FLOAT); + 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.setWidth("12%"); ListGridField bottom = new ListGridField("bottom", MSG.bottom_edge());