[PATCH] (issue1754) Remove default subtitle hack

Wald Commits scm-commit at wald.intevation.org
Thu Apr 30 17:12:03 CEST 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1430406719 -7200
# Node ID bccc476e78ebd50d125e6d61ffe4156ce8af3ef3
# Parent  cb33de3434a8865f4bb624caab511dc61c99d813
(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.

diff -r cb33de3434a8 -r bccc476e78eb artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java
--- 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);


More information about the Dive4Elements-commits mailing list