changeset 350:4e6aa2a8c4c0

Changed date representation in timeseries charts. Date format is sourced out to language ressource files. gnv-artifacts/trunk@421 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 Dec 2009 15:56:20 +0000
parents 555483213f78
children 4ac3c1c1c060
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java gnv-artifacts/src/main/resources/lang/artifactMessages.properties gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties
diffstat 6 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Mon Dec 14 14:36:43 2009 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Dec 14 15:56:20 2009 +0000
@@ -1,3 +1,19 @@
+2009-12-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue101
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Changed date
+	  representation in timeseries charts. Date format is sourced out to
+	  ressource files. German date representation is now 'dd-MMM-yyyy' (eg
+	  31-12-2009) and the english date representation is 'yyyy-MMM-dd' (eg
+	  2009-12-31). 
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added date format
+	  strings for timeseries charts.
+
 2009-12-14	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/gnv/utils/IndexBuffer.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Mon Dec 14 14:36:43 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Mon Dec 14 15:56:20 2009 +0000
@@ -21,6 +21,7 @@
 import org.jfree.data.time.Minute;
 import org.jfree.data.time.TimeSeriesCollection;
 
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
 import de.intevation.gnv.geobackend.base.Result;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
 import de.intevation.gnv.timeseries.gap.TimeGap;
@@ -33,7 +34,9 @@
 extends      AbstractXYLineChart
 {
 
-    private static final String DATE_FORMAT = "dd-MMM";
+    private static final String DATE_FORMAT = "chart.timeseries.date.format";
+
+    public static final String DEFAULT_DATE_FORMAT = "dd-MMM-yyyy";
 
     private static final long   NO_TIME_GAP = Long.MAX_VALUE - 1000;
 
@@ -216,11 +219,17 @@
             "to " + locale.toString()
         );
 
-        DateFormat format = new SimpleDateFormat(DATE_FORMAT, locale);
+        String dateFormat = getMessage(locale, DATE_FORMAT,DEFAULT_DATE_FORMAT);
+        DateFormat format = new SimpleDateFormat(dateFormat, locale);
         ((DateAxis) axis).setDateFormatOverride(format);
     }
 
 
+    protected String getMessage(Locale locale, String key, String def) {
+        return RessourceFactory.getInstance().getRessource(locale, key, def);
+    }
+
+
     protected String createSeriesName(
         String breakPoint1,
         String breakPoint2,
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages.properties	Mon Dec 14 14:36:43 2009 +0000
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages.properties	Mon Dec 14 15:56:20 2009 +0000
@@ -49,6 +49,7 @@
 depth=depth
 coordinate=coordinate
 
+chart.timeseries.date.format=yyyy-MMM-dd
 chart.timeseries.title.xaxis=Time [UTC]
 chart.verticalprofile.title.xaxis=Depth [m]
 chart.verticalcrosssection.title.xaxis=Depth [m]
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties	Mon Dec 14 14:36:43 2009 +0000
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties	Mon Dec 14 15:56:20 2009 +0000
@@ -49,6 +49,7 @@
 depth=Tiefe
 coordinate=Koordinate
 
+chart.timeseries.date.format=dd-MMM-yyyy
 chart.timeseries.title.xaxis=Zeit [UTC]
 chart.verticalprofile.title.xaxis=Tiefe [m]
 chart.verticalcrosssection.title.xaxis=Tiefe [m]
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties	Mon Dec 14 14:36:43 2009 +0000
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties	Mon Dec 14 15:56:20 2009 +0000
@@ -49,6 +49,7 @@
 depth=Tiefe
 coordinate=Koordinate
 
+chart.timeseries.date.format=dd-MMM-yyyy
 chart.timeseries.title.xaxis=Zeit [UTC]
 chart.verticalprofile.title.xaxis=Tiefe [m]
 chart.verticalcrosssection.title.xaxis=Tiefe [m]
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties	Mon Dec 14 14:36:43 2009 +0000
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties	Mon Dec 14 15:56:20 2009 +0000
@@ -49,6 +49,8 @@
 depth=depth
 coordinate=coordinate
 
+
+chart.timeseries.date.format=yyyy-MMM-dd
 chart.timeseries.title.xaxis=Time [UTC]
 chart.verticalprofile.title.xaxis=Depth [m]
 chart.verticalcrosssection.title.xaxis=Depth [m]

http://dive4elements.wald.intevation.org