changeset 1745:4ae7df2a74ed

Fix NPE in WDiff-diagram because no ranges present in masterartifact. flys-artifacts/trunk@3039 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 19 Oct 2011 16:06:01 +0000
parents 62efd1288e34
children 94faf08d143c
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java
diffstat 2 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Oct 19 16:04:40 2011 +0000
+++ b/flys-artifacts/ChangeLog	Wed Oct 19 16:06:01 2011 +0000
@@ -1,12 +1,17 @@
+2011-10-19  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix WDifference plots where masterartifact has no range set.
+
+	* src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java:
+	  (addSubtitles): Overridden, the master artifact has no
+	  range.
+
 2011-10-19  Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Fix masterartifact in collections in cases where the original
 	masterartifacts facets do not come first in certain list. Query
 	'backend'/db instead.
 
-	* src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java:
-	  (addSubtitles): Overridden, the master artifact has no range.
-
 	* src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java:
 	  Set 'real' master artifact, defined to be oldest belonging to this
 	  collection.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java	Wed Oct 19 16:04:40 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java	Wed Oct 19 16:06:01 2011 +0000
@@ -2,6 +2,8 @@
 
 import org.apache.log4j.Logger;
 
+import org.jfree.chart.title.TextTitle;
+
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.data.xy.XYSeries;
@@ -74,6 +76,7 @@
     }
 
 
+
     /**
      * Gets key to look up internationalized String for the charts subtitle.
      * @return key to look up translated subtitle.
@@ -190,6 +193,24 @@
         }
     }
 
+    /**
+     * Add (internationalized) subtitle to chart.
+     * Overridden to avoid trying to access the range of masterartifact.
+     * @see getChartSubtitleKey
+     */
+    @Override
+    protected void addSubtitles(JFreeChart chart) {
+
+        // TODO i18n
+        /*
+        Object[] args = new Object[] {
+            getRiverName()
+        };
+        */
+        String subtitle = getRiverName();
+        chart.addSubtitle(new TextTitle(subtitle));
+    }
+
 
     /**
      * Add items to dataseries which describes the differences.

http://dive4elements.wald.intevation.org