diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 2048:3157a78e6494

Improved chart title and subtitle creation in ChartGenerators - all ChartGenerators make now use of title and subtitle provided by ChartSettings. flys-artifacts/trunk@3538 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 23 Dec 2011 14:24:57 +0000
parents 0318fa6f0844
children 2d5f2bc68cc6
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Dec 23 08:57:25 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Dec 23 14:24:57 2011 +0000
@@ -125,35 +125,23 @@
 
 
     /**
-     * Returns a title for the chart from ChartSettings object
-     * if this object is not null or creates a default title.
+     * Returns the default title for this chart.
      *
-     * @return a title.
+     * @return the default title for this chart.
      */
     @Override
-    public String getChartTitle() {
-        ChartSettings chartSettings = getChartSettings();
-        if (chartSettings != null) {
-            return getChartTitle(chartSettings);
-        }
-
+    public String getDefaultChartTitle() {
         return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
     }
 
 
     /**
-     * Returns a subtitle for the chart from ChartSettings object
-     * if this object is not null or creates a default title.
+     * Returns the default subtitle for this chart.
      *
-     * @return a title.
+     * @return the default subtitle for this chart.
      */
     @Override
-    protected String getChartSubtitle() {
-        ChartSettings chartSettings = getChartSettings();
-        if (chartSettings != null) {
-            return getChartSubtitle(chartSettings);
-        }
-
+    protected String getDefaultChartSubtitle() {
         double[] dist = getRange();
 
         Object[] args = new Object[] {
@@ -184,7 +172,10 @@
     @Override
     protected void addSubtitles(JFreeChart chart) {
         String subtitle = getChartSubtitle();
-        chart.addSubtitle(new TextTitle(subtitle));
+
+        if (subtitle != null && subtitle.length() > 0) {
+            chart.addSubtitle(new TextTitle(subtitle));
+        }
     }
 
 

http://dive4elements.wald.intevation.org