Mercurial > dive4elements > river
changeset 3398:7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
flys-artifacts/trunk@5032 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 18 Jul 2012 09:54:46 +0000 |
parents | 6d1740533810 |
children | e08a6352fe24 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/resources/Resources.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties |
diffstat | 7 files changed, 70 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Jul 18 09:54:46 2012 +0000 @@ -1,3 +1,17 @@ +2012-07-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java: + Added column for time range. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties + src/main/resources/messages_en.properties + src/main/resources/messages_de.properties: + Added i18n strings. + + * src/main/java/de/intevation/flys/artifacts/resources/Resources.java: + Fixed stupid formatting bug. + 2012-07-18 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/resources/Resources.java Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/resources/Resources.java Wed Jul 18 09:54:46 2012 +0000 @@ -137,7 +137,7 @@ String template = getMsg(meta, key, (String)null); if (template == null) { - return template = def; + template = def; } return MessageFormat.format(template, args);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java Wed Jul 18 09:54:46 2012 +0000 @@ -22,6 +22,7 @@ import java.io.OutputStream; import java.text.DateFormat; +import java.text.MessageFormat; import java.text.NumberFormat; import java.util.ArrayList; @@ -46,6 +47,9 @@ public static final String CSV_Q_HEADER = "export.fixings.deltawt.csv.header.q"; + public static final String CSV_TRANGE_HEADER = + "export.fixings.deltawt.csv.header.time.range"; + public static final String CSV_T_HEADER = "export.fixings.deltawt.csv.header.t"; @@ -62,6 +66,21 @@ public static final String DEFAULT_CSV_T_DESC_HEADER = "Beschreibung"; + public static final String DEFAULT_CSV_TRANGE_DESC_HEADER = + "Zeitraum"; + + public static final String CSV_REFERENCE = + "export.fixings.deltawt.csv.reference"; + + public static final String CSV_ANALYSIS = + "export.fixings.deltawt.csv.analysis"; + + public static final String DEFAULT_CSV_REFERENCE = + "Bezug"; + + public static final String DEFAULT_CSV_ANALYSIS = + "Analyse {0,number,integer}"; + protected List<KMIndex<AnalysisPeriod []>> analysisPeriods; protected List<KMIndex<QWD[]>> referenceEvents; @@ -106,6 +125,8 @@ Locale locale = Resources.getLocale(meta); DateFormat dF = DateFormat.getDateInstance(DateFormat.SHORT, locale); + String referenceS = getReference(); + for (KMIndex<QWD[]> reference: referenceEvents) { for (KMIndex.Entry<QWD[]> kmEntry: reference) { @@ -119,6 +140,7 @@ writer.writeNext(new String[] { kmS, + referenceS, deltaWS, qS, dateS, @@ -131,8 +153,15 @@ log.debug("AnalysisPeriods: " + analysisPeriods.size()); } + String analysisTemplate = getAnalysisTemplate(); + + int analysisCount = 1; + for (KMIndex<AnalysisPeriod []> periods: analysisPeriods) { + String analyisS = MessageFormat.format( + analysisTemplate, analysisCount); + for (KMIndex.Entry<AnalysisPeriod []> kmEntry: periods) { String kmS = kmF.format(kmEntry.getKm()); @@ -148,6 +177,7 @@ writer.writeNext(new String[] { kmS, + analyisS, deltaWS, qS, dateS, @@ -155,11 +185,23 @@ } } } + ++analysisCount; } } writer.flush(); } + protected String getAnalysisTemplate() { + return Resources.getMsg( + context.getMeta(), + CSV_ANALYSIS, DEFAULT_CSV_ANALYSIS); + } + + protected String getReference() { + return Resources.getMsg( + context.getMeta(), + CSV_REFERENCE, DEFAULT_CSV_REFERENCE); + } protected NumberFormat getKMFormatter() { return Formatter.getFixDeltaWKM(context); @@ -178,6 +220,7 @@ writer.writeNext(new String[] { msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER), + msg(CSV_TRANGE_HEADER, DEFAULT_CSV_TRANGE_DESC_HEADER), msg(CSV_DELTA_W_HEADER, DEFAULT_CSV_DELTA_W_HEADER), msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER), msg(CSV_T_HEADER, DEFAULT_CSV_T_HEADER),
--- a/flys-artifacts/src/main/resources/messages.properties Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Wed Jul 18 09:54:46 2012 +0000 @@ -347,6 +347,9 @@ export.fixings.deltawt.csv.header.q=Discharge [m\u00b3/s] export.fixings.deltawt.csv.header.t=Date export.fixings.deltawt.csv.header.description=Description +export.fixings.deltawt.csv.header.time.range=Time range +export.fixings.deltawt.csv.reference=Reference +export.fixings.deltawt.csv.analysis=Analysis {0,number,integer} fix.missing.river=Missing river fix.missing.from=Missing start km
--- a/flys-artifacts/src/main/resources/messages_de.properties Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Wed Jul 18 09:54:46 2012 +0000 @@ -348,6 +348,9 @@ export.fixings.deltawt.csv.header.q=Abfluss [m\u00b3/s] export.fixings.deltawt.csv.header.t=Datum export.fixings.deltawt.csv.header.description=Beschreibung +export.fixings.deltawt.csv.header.time.range=Zeitraum +export.fixings.deltawt.csv.reference=Bezug +export.fixings.deltawt.csv.analysis=Analyse {0,number,integer} fix.missing.river=Kein Gew\u00e4sser gew\u00e4hlt fix.missing.from=Kein Startkilometer gew\u00e4hlt
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Wed Jul 18 09:54:46 2012 +0000 @@ -347,6 +347,9 @@ export.fixings.deltawt.csv.header.q=Abfluss [m\u00b3/s] export.fixings.deltawt.csv.header.t=Datum export.fixings.deltawt.csv.header.description=Beschreibung +export.fixings.deltawt.csv.header.time.range=Zeitraum +export.fixings.deltawt.csv.reference=Bezug +export.fixings.deltawt.csv.analysis=Analyse {0,number,integer} fix.missing.river=Kein Gew\u00e4sser gew\u00e4hlt fix.missing.from=Kein Startkilometer gew\u00e4hlt
--- a/flys-artifacts/src/main/resources/messages_en.properties Wed Jul 18 09:03:19 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Wed Jul 18 09:54:46 2012 +0000 @@ -347,6 +347,9 @@ export.fixings.deltawt.csv.header.q=Discharge [m\u00b3/s] export.fixings.deltawt.csv.header.t=Date export.fixings.deltawt.csv.header.description=Description +export.fixings.deltawt.csv.header.time.range=Time range +export.fixings.deltawt.csv.reference=Reference +export.fixings.deltawt.csv.analysis=Analysis {0,number,integer} fix.missing.river=Missing river fix.missing.from=Missing start km