diff flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 1754:8e6615ad60b8

Added some simple caching for themes. Only used in sticky annotations by now. flys-artifacts/trunk@3057 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 21 Oct 2011 15:19:49 +0000
parents 6cdc7a77d3d4
children 41ba2276d785
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Oct 21 14:02:07 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Oct 21 15:19:49 2011 +0000
@@ -36,9 +36,9 @@
 
 import de.intevation.flys.exports.ChartExportHelper;
 import de.intevation.flys.jfree.FLYSAnnotation;
-import de.intevation.flys.utils.ThemeUtil;
 import de.intevation.flys.jfree.StickyAxisAnnotation;
 
+import de.intevation.flys.utils.ThemeAccess;
 
 /**
  * An abstract base class for creating XY charts.
@@ -446,24 +446,17 @@
         for (FLYSAnnotation fa: annotations) {
             Document theme = fa.getTheme();
 
-            Color color = theme != null
-                ? ThemeUtil.parseLineColorField(theme)
-                : null;
+            ThemeAccess themeAccess = new ThemeAccess(theme);
 
-            if (color == null) {
-                color = Color.black;
-            }
-
-            int lineWidth = theme != null
-                ? ThemeUtil.parseLineWidth(theme)
-                : 1;
+            Color color   = themeAccess.parseLineColorField();
+            int lineWidth = themeAccess.parseLineWidth();
 
             lic.add(new LegendItem(fa.getLabel(), color));
 
             for (XYTextAnnotation ta: fa.getAnnotations()) {
                 if(ta instanceof StickyAxisAnnotation) {
                     StickyAxisAnnotation sta = (StickyAxisAnnotation)ta;
-                    sta.applyTheme(theme);
+                    sta.applyTheme(themeAccess);
                     renderer.addAnnotation(sta);
                 }
                 else {

http://dive4elements.wald.intevation.org