changeset 8731:bccc476e78eb

(issue1754) Remove default subtitle hack It is a feature to edit the subtitle Radius part so we can't use this hack to dynamically add them. Now they are added in the do out and after the first round become part of the chart settings.
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 30 Apr 2015 17:11:59 +0200
parents cb33de3434a8
children c0c162d7cb0e
files artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java
diffstat 1 files changed, 8 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java	Thu Apr 30 13:06:51 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java	Thu Apr 30 17:11:59 2015 +0200
@@ -60,43 +60,6 @@
         "chart.subtitle.radius";
 
     @Override
-    protected String getChartSubtitlePure() {
-        ChartSettings chartSettings = getChartSettings();
-
-        String titleBeforeParts = null;
-
-        if (subTitleParts != null && !subTitleParts.isEmpty()) {
-            // This is needed here to determine the initial
-            // subtitle before the processing happens to distinguis
-            // between that subtitle and a subtitle set by the user.
-            //
-            // The underlying problem is that getChartSubtitle is called
-            // to build the chart settings way before the facets are processed.
-            // So we have to figure out somehow if the user modified the title
-            // in the chartsettings or if it was just put there because it
-            // was the default.
-
-            HashSet<String> buf = subTitleParts;
-            subTitleParts = null;
-            titleBeforeParts = getDefaultChartSubtitle();
-            subTitleParts = buf;
-        }
-
-
-        if (chartSettings != null) {
-            String userTitle = getChartSubtitle(chartSettings);
-            if (userTitle != null && !userTitle.equals(titleBeforeParts)) {
-                // set by the user. use this.
-                log.debug("Using user subtitle: " + userTitle);
-                return userTitle;
-            }
-        }
-        log.debug("Using default subtitle: " + getDefaultChartSubtitle());
-        return getDefaultChartSubtitle();
-    }
-
-
-    @Override
     public String getDefaultChartSubtitle() {
         double[] dist = getRange();
 
@@ -192,20 +155,8 @@
 
         calculateRadius(); // This calculates the real start and end km's
 
-        boolean haveVisibleFiltered = false;
         for (SuperBundle superbundle: postOutAF) {
             super.doOut(superbundle.bundle, superbundle.theme, superbundle.visible);
-            if (!haveVisibleFiltered) {
-                haveVisibleFiltered = superbundle.visible;
-            }
-        }
-        if (haveVisibleFiltered) {
-            log.debug("Adding radius subtitle.");
-
-            addSubtitle(Resources.getMsg(
-                        getCallContext().getMeta(),
-                        I18N_SUBTITLE_RADIUS,
-                        new Object[] { "$RADIUS" }));
         }
     }
 
@@ -232,6 +183,14 @@
                 postOutAF = new ArrayList<SuperBundle>();
             }
             postOutAF.add(superbundle);
+            if (visible) {
+                log.debug("Adding radius subtitle.");
+
+                addSubtitle(Resources.getMsg(
+                            getCallContext().getMeta(),
+                            I18N_SUBTITLE_RADIUS,
+                            new Object[] { "$RADIUS" }));
+            }
             return;
         }
         super.doOut(bundle, theme, visible);

http://dive4elements.wald.intevation.org