Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java @ 2290:6f4a1f513e89
Calculation error report: i18n the km of the error report.
flys-artifacts/trunk@3954 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 08 Feb 2012 09:33:06 +0000 |
parents | ea173e4c07c7 |
children | ff558d0332e2 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java Tue Feb 07 18:12:08 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java Wed Feb 08 09:33:06 2012 +0000 @@ -5,12 +5,17 @@ import java.util.Locale; import de.intevation.artifacts.CallContext; +import de.intevation.artifacts.CallMeta; import de.intevation.flys.artifacts.resources.Resources; public final class Formatter { + // KMS IN ERROR REPORTS. + public static final int CALCULATION_REPORT_KM_MIN_DIGITS = 0; + public static final int CALCULATION_REPORT_KM_MAX_DIGITS = 3; + // WATERLEVEL FORMATTER CONSTANTS public static final int WATERLEVEL_KM_MIN_DIGITS = 3; public static final int WATERLEVEL_KM_MAX_DIGITS = 3; @@ -43,8 +48,8 @@ public static final int DURATION_D_MAX_DIGITS = 0; - public static NumberFormat getFormatter(CallContext c, int min, int max){ - Locale locale = Resources.getLocale(c.getMeta()); + public static NumberFormat getFormatter(CallMeta m, int min, int max){ + Locale locale = Resources.getLocale(m); NumberFormat nf = NumberFormat.getInstance(locale); nf.setMaximumFractionDigits(max); @@ -53,6 +58,10 @@ return nf; } + public static NumberFormat getFormatter(CallContext c, int min, int max){ + return getFormatter(c.getMeta(), min, max); + } + /** * Returns a number formatter with no max or min digits set. @@ -208,5 +217,12 @@ DURATION_D_MIN_DIGITS, DURATION_D_MAX_DIGITS); } + + public static NumberFormat getCalculationKm(CallMeta meta) { + return getFormatter( + meta, + CALCULATION_REPORT_KM_MIN_DIGITS, + CALCULATION_REPORT_KM_MAX_DIGITS); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :