Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 851:4bcf7bf4bfb7
Presentation of values in the statistic is now language specific (issue228).
gnv-artifacts/trunk@967 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 21 Apr 2010 13:38:26 +0000 |
parents | 47280aff0eb7 |
children | 70653c29fc1d |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java Wed Apr 21 12:34:44 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java Wed Apr 21 13:38:26 2010 +0000 @@ -5,6 +5,7 @@ import java.io.UnsupportedEncodingException; import java.text.DateFormat; +import java.text.NumberFormat; import java.text.ParseException; import java.util.ArrayList; @@ -482,7 +483,7 @@ statistics = new ArrayList<StatisticSet>(); } - Document doc = writeStatistics2XML(statistics); + Document doc = writeStatistics2XML(statistics, locale); XMLUtils.toStream(doc, outputStream); @@ -683,9 +684,14 @@ * @param statistic Statistic to be written to xml document. * @return the xml document containing the statistic. */ - protected Document writeStatistics2XML( Collection<StatisticSet> statistic) { + protected Document writeStatistics2XML( + Collection<StatisticSet> statistic, Locale locale) + { ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); Document doc = XMLUtils.newDocument(); + + NumberFormat format = NumberFormat.getInstance(locale); + if (statistic != null) { Node statisticResults = ArtifactXMLUtilities.createArtifactElement(doc, "statistics"); @@ -703,7 +709,7 @@ Element result = ArtifactXMLUtilities.createArtifactElement(doc, "statistic-value"); result.setAttribute("name", s.getKey()); - result.setAttribute("value", s.getStringValue()); + result.setAttribute("value", format.format(s.getValue())); setElement.appendChild(result); } statisticResults.appendChild(setElement);