Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java @ 686:3dc61e00385e facets-slt
Merged with trunk and introduced hashing of computed values.
flys-artifacts/branches/facets-slt@2126 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 15 Jun 2011 15:28:54 +0000 |
parents | 627be3ca1ab6 |
children | 06689035024c |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java Wed Jun 08 13:03:21 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java Wed Jun 15 15:28:54 2011 +0000 @@ -1,6 +1,8 @@ package de.intevation.flys.artifacts.states; +import java.text.NumberFormat; import java.util.Iterator; +import java.util.Locale; import java.util.Map; import org.apache.log4j.Logger; @@ -84,11 +86,22 @@ Element itemElement = creator.create("item"); creator.addAttr(itemElement, "value", value, true); - creator.addAttr( - itemElement, - "label", - Resources.getMsg(meta, value, value), - true); + + String attrValue = ""; + try { + // XXX A better way to format the output would be to use the + // 'type' value if the data objects. + double doubleVal = Double.valueOf(value); + Locale l = Resources.getLocale(meta); + NumberFormat nf = NumberFormat.getInstance(l); + + attrValue = nf.format(doubleVal); + } + catch (NumberFormatException nfe) { + attrValue = Resources.getMsg(meta, value, value); + } + + creator.addAttr(itemElement, "label", attrValue, true); dataElement.appendChild(itemElement); ui.appendChild(dataElement);