Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java @ 3017:296b067e17e6
i18n and format for line labels.
flys-artifacts/trunk@4582 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 05 Jun 2012 12:35:49 +0000 |
parents | e63969c173e9 |
children | 5642a83420f2 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java Tue Jun 05 12:08:47 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java Tue Jun 05 12:35:49 2012 +0000 @@ -76,6 +76,14 @@ public static final int FIX_DELTA_W_DELTA_W_MIN_DIGITS = 3; public static final int FIX_DELTA_W_DELTA_W_MAX_DIGITS = 3; + /** + * Creates a localised NumberFormatter with given range of decimal digits. + * @param m CallMeta to find the locale. + * @param min minimum number of decimal ("fraction") digits. + * @param max maximum number of decimal ("fraction") digits. + * @return A NumberFormat. Use #format(NUMBER) to get String representation + * of NUMBER. + */ public static NumberFormat getFormatter(CallMeta m, int min, int max){ Locale locale = Resources.getLocale(m); NumberFormat nf = NumberFormat.getInstance(locale); @@ -347,5 +355,13 @@ FIX_DELTA_W_DELTA_W_MIN_DIGITS, FIX_DELTA_W_DELTA_W_MAX_DIGITS); } + + public static NumberFormat getMeterFormat(CallContext context) { + return getFormatter( + context, + 0, + 2); + + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :