diff flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java @ 2648:8aaa7f4ce06a

Let theme define whether or not to display a (yet static) label for line). flys-artifacts/trunk@4306 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 26 Apr 2012 09:51:13 +0000
parents 4b7a28e81643
children 6f5fc3de0d48
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Thu Apr 26 08:11:48 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Thu Apr 26 09:51:13 2012 +0000
@@ -33,7 +33,7 @@
 
     protected BooleanList isMinimumShapeVisible;
     protected BooleanList isMaximumShapeVisible;
-    protected BooleanList showSeriesMinimumX;;
+    protected BooleanList showLineLabel;
 
     protected Map<Integer, Double> seriesMinimum;
     protected Map<Integer, Double> seriesMinimumX;
@@ -44,6 +44,7 @@
         super(lines, shapes);
         this.isMinimumShapeVisible = new BooleanList();
         this.isMaximumShapeVisible = new BooleanList();
+        this.showLineLabel         = new BooleanList();
         this.seriesMinimum         = new HashMap<Integer, Double>();
         this.seriesMaximum         = new HashMap<Integer, Double>();
         this.seriesMinimumX        = new HashMap<Integer, Double>();
@@ -236,7 +237,7 @@
         }
 
         boolean doWaterlevelLabel = false;
-        if (isMinimumX (dataset, series, item)) {
+        if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) {
             // TODO find name of dataset/series
             String waterlevelLabel = "label";
             // TODO Force water of some German rivers to flow direction mountains.
@@ -283,6 +284,21 @@
         return isMaximumShapeVisible.getBoolean(series);
     }
 
+    /** Whether or not a label should be shown for series. */
+    public boolean isShowLineLabel(int series) {
+        if (this.showLineLabel.size() <= series) {
+            return false;
+        }
+
+        return showLineLabel.getBoolean(series);
+    }
+
+
+    /** Sets whether or not a label should be shown for series. */
+    public void setShowLineLabel(boolean showLineLabel, int series) {
+        this.showLineLabel.setBoolean(series, showLineLabel);
+    }
+
 
     /**
      * True if the given item of given dataset has the smallest

http://dive4elements.wald.intevation.org