changeset 3464:0b9b2a0c4e64

Point labels can have a background color now. flys-artifacts/trunk@5132 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 26 Jul 2012 10:02:07 +0000
parents 7198f04e4221
children 7d0ebde8c3e3
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/virtual-themes.xml flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java flys-artifacts/src/main/java/de/intevation/flys/themes/LineStyle.java flys-artifacts/src/main/java/de/intevation/flys/themes/PointStyle.java flys-artifacts/src/main/java/de/intevation/flys/themes/TextStyle.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 13 files changed, 247 insertions(+), 239 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jul 26 10:02:07 2012 +0000
@@ -1,3 +1,21 @@
+2012-07-26	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/virtual-themes.xml,
+	  src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java,
+	  src/main/java/de/intevation/flys/exports/ChartGenerator.java,
+	  src/main/java/de/intevation/flys/themes/ThemeAccess.java,
+	  src/main/java/de/intevation/flys/themes/TextStyle.java,
+	  src/main/java/de/intevation/flys/themes/LineStyle.java,
+	  src/main/java/de/intevation/flys/themes/ThemeFactory.java,
+	  src/main/java/de/intevation/flys/themes/PointStyle.java,
+	  src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java,
+	  src/main/java/de/intevation/flys/jfree/XYStyle.java,
+	  src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java:
+	  Line labels and point labels share same styles and code.
+	  Point labels can have a background color.
+
+
 2012-07-26	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/resources/messages.properties,
--- a/flys-artifacts/doc/conf/virtual-themes.xml	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/doc/conf/virtual-themes.xml	Thu Jul 26 10:02:07 2012 +0000
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <themegroup name="virtual">
-    <!-- Virtual themes are following now! DO NOT USE VIRTUAL THEMES FOR 
+    <!-- Virtual themes are following now! DO NOT USE VIRTUAL THEMES FOR
         FACETS! Please implement concrete themes! -->
     <theme name="Lines" type="virtual">
         <fields>
@@ -12,17 +12,17 @@
                 default="10" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
-            <field name="linelabelfont" type="Font"
+            <field name="labelfontface" type="Font"
                 display="Beschriftung: Schriftart" default="arial" />
-            <field name="linelabelcolor" type="Color"
+            <field name="labelfontcolor" type="Color"
                 display="Beschriftung: Schriftfarbe" default="0, 0, 0" />
-            <field name="linelabelsize" type="int"
+            <field name="labelfontsize" type="int"
                 display="Beschriftung: Schriftgröße" default="10" />
-            <field name="linelabelstyle" type="Style"
+            <field name="labelfontstyle" type="Style"
                 display="Beschriftung: Schriftstil" default="standard" />
-            <field name="linelabelbgcolor" type="Color"
+            <field name="labelbgcolor" type="Color"
                 display="Beschriftung: Hintergrundfarbe" default="0, 0, 0" />
-            <field name="linelabelshowbg" type="boolean"
+            <field name="labelshowbg" type="boolean"
                 display="Beschriftung: Hintergrund füllen" default="false" />
             <!--orientation? -->
         </fields>
@@ -31,7 +31,9 @@
     <theme name="Points" type="virtual">
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Linienbeschriftung anzeigen" default="false" hints="h" />
+                display="Linienbeschriftung anzeigen" default="false" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
             <field name="showlines" type="boolean" default="false" />
             <field name="linesize" type="int" display="Liniendicke"
                 default="1" />
@@ -41,8 +43,16 @@
                 default="true" />
             <field name="textorientation" type="boolean" display="Text horizontal"
                 default="true"/>
-            <field name="showpointlabel" type="boolean"
-                display="Punktbeschriftung anzeigen" default="false"/>
+            <field name="labelfontface" type="Font" default="Arial"
+                display="Beschriftung: Schriftart" />
+            <field name="labelfontcolor" type="Color" default="Color.BLACK"
+                display="Beschriftung: Schriftfarbe" />
+            <field name="labelfontsize" type="int"
+                display="Beschriftung: Schriftgröße" default="10" />
+            <field name="labelshowbg" type="boolean" default="false"
+                display="Beschriftung: Hintergrund anzeigen" />
+            <field name="labelbgcolor" type="Color" default="Color.WHITE"
+                display="Beschriftung: Hintergrundfarbe" />
         </fields>
     </theme>
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Thu Jul 26 10:02:07 2012 +0000
@@ -22,6 +22,8 @@
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
 import de.intevation.flys.jfree.StyledSeries;
 import de.intevation.flys.model.River;
+import de.intevation.flys.themes.LineStyle;
+import de.intevation.flys.themes.TextStyle;
 import de.intevation.flys.themes.ThemeAccess;
 import de.intevation.flys.utils.FLYSUtils;
 import de.intevation.flys.utils.ThemeUtil;
@@ -179,8 +181,8 @@
         StickyAxisAnnotation annotation,
         XYPlot plot,
         ChartArea area,
-        ThemeAccess.LineStyle lineStyle,
-        ThemeAccess.TextStyle textStyle,
+        LineStyle lineStyle,
+        TextStyle textStyle,
         Document theme
     ) {
         // OPTIMIZE pre-calculate area-related values
@@ -301,7 +303,7 @@
      * @param lineStyle the line style to use for the line.
      */
     protected static XYLineAnnotation createGroundStickAnnotation(
-        ChartArea area, float pos, ThemeAccess.LineStyle lineStyle
+        ChartArea area, float pos, LineStyle lineStyle
     ) {
         // Style the line.
         if (lineStyle != null) {
@@ -325,7 +327,7 @@
      * @param lineStyle the line style to use for the line.
      */
     protected static XYLineAnnotation createRightStickAnnotation(
-        ChartArea area, float pos, ThemeAccess.LineStyle lineStyle
+        ChartArea area, float pos, LineStyle lineStyle
     ) {
         // Style the line.
         if (lineStyle != null) {
@@ -349,7 +351,7 @@
      * @param lineStyle the line style to use for the line.
      */
     protected static XYLineAnnotation createLeftStickAnnotation(
-        ChartArea area, float pos, ThemeAccess.LineStyle lineStyle
+        ChartArea area, float pos, LineStyle lineStyle
     ) {
         // Style the line.
         if (lineStyle != null) {
@@ -376,7 +378,7 @@
      */
     protected static XYLineAnnotation createStickyLineAnnotation(
         StickyAxisAnnotation.SimpleAxis axis, float fromD1, float toD2,
-        ChartArea area, ThemeAccess.LineStyle lineStyle
+        ChartArea area, LineStyle lineStyle
     ) {
         double anchorX1 = 0d, anchorX2 = 0d, anchorY1 = 0d, anchorY2 = 0d;
         switch(axis) {
@@ -436,8 +438,8 @@
 
             // Access text styling, if any.
             Document theme = fa.getTheme();
-            ThemeAccess.TextStyle textStyle = null;
-            ThemeAccess.LineStyle lineStyle = null;
+            TextStyle textStyle = null;
+            LineStyle lineStyle = null;
 
             // Get Themeing information and add legend item.
             if (theme != null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Thu Jul 26 10:02:07 2012 +0000
@@ -9,6 +9,8 @@
 import de.intevation.flys.jfree.FLYSAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
 import de.intevation.flys.model.FastCrossSectionLine;
+import de.intevation.flys.themes.LineStyle;
+import de.intevation.flys.themes.TextStyle;
 import de.intevation.flys.themes.ThemeAccess;
 import de.intevation.flys.utils.Formatter;
 import de.intevation.flys.utils.ThemeUtil;
@@ -171,8 +173,8 @@
 
             // Access text styling, if any.
             Document theme = fa.getTheme();
-            ThemeAccess.TextStyle textStyle = null;
-            ThemeAccess.LineStyle lineStyle = null;
+            TextStyle textStyle = null;
+            LineStyle lineStyle = null;
 
             // Get Themeing information and add legend item.
             if (theme != null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java	Thu Jul 26 10:02:07 2012 +0000
@@ -1,8 +1,8 @@
 package de.intevation.flys.jfree;
 
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Graphics2D;
-import java.awt.Font;
 import java.awt.Paint;
 import java.awt.Shape;
 import java.awt.geom.Rectangle2D;
@@ -10,7 +10,6 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.axis.ValueAxis;
 import org.jfree.chart.entity.EntityCollection;
 import org.jfree.chart.plot.CrosshairState;
@@ -20,11 +19,11 @@
 import org.jfree.data.xy.XYDataset;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
+import org.jfree.text.TextUtilities;
 import org.jfree.ui.RectangleEdge;
 import org.jfree.ui.TextAnchor;
 import org.jfree.util.BooleanList;
 import org.jfree.util.ShapeUtilities;
-import org.jfree.text.TextUtilities;
 
 /**
  * Renderer with additional the additional functionality of renderering minima
@@ -32,6 +31,11 @@
  */
 public class EnhancedLineAndShapeRenderer extends XYLineAndShapeRenderer {
 
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
     /** Own logger. */
     private static final Logger logger =
         Logger.getLogger(EnhancedLineAndShapeRenderer.class);
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Thu Jul 26 10:02:07 2012 +0000
@@ -1,12 +1,12 @@
 package de.intevation.flys.jfree;
 
-import de.intevation.flys.utils.ThemeUtil;
-
 import java.awt.Color;
 
 import org.jfree.chart.plot.IntervalMarker;
 import org.w3c.dom.Document;
 
+import de.intevation.flys.utils.ThemeUtil;
+
 /**
  * Marker that represents a highlighted interval.
  * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a>
@@ -37,10 +37,12 @@
      */
     public void useSecondColor(boolean secondColor) {
         if(secondColor) {
-            setPaint(backgroundColor);
+            if(backgroundColor != null)
+                setPaint(backgroundColor);
         }
         else {
-            setPaint(fillColor);
+            if(fillColor != null)
+                setPaint(fillColor);
         }
     }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java	Thu Jul 26 10:02:07 2012 +0000
@@ -1,17 +1,15 @@
 package de.intevation.flys.jfree;
 
+import de.intevation.flys.utils.ThemeUtil;
+
 import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.geom.Ellipse2D;
 
 import org.apache.log4j.Logger;
-
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
 import org.w3c.dom.Document;
 
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-
-import de.intevation.flys.utils.ThemeUtil;
-
 
 /**
  * Utility to apply theme-settings to a renderer.
@@ -36,6 +34,7 @@
      * Applies line color, size and type attributes to renderer, also
      * whether to draw lines and/or points.
      */
+    @Override
     public XYLineAndShapeRenderer applyTheme(XYLineAndShapeRenderer r, int idx){
         this.renderer = r;
         applyLineColor(r, idx);
@@ -47,12 +46,22 @@
         applyPointColor(r, idx);
         applyShowMinimum(r, idx);
         applyShowMaximum(r, idx);
+
+        // Line label styles
         applyShowLineLabel(r, idx);
+        applyShowLineLabelBG(r, idx);
         applyLineLabelFont(r, idx);
         applyLineLabelColor(r, idx);
-        applyShowLineLabelBG(r, idx);
         applyLineLabelBGColor(r, idx);
 
+        // Point label styles
+        // TODO: Currently point label are annotations and are not drawn this way
+        /*
+        applyShowPointLabelBG(r, idx);
+        applyLinePointFont(r, idx);
+        applyLinePointColor(r, idx);
+        applyLinePointBGColor(r, idx);*/
+
         return r;
     }
 
@@ -88,7 +97,7 @@
         if (!(r instanceof EnhancedLineAndShapeRenderer)) {
             return;
         }
-        boolean showLabelLine = ThemeUtil.parseShowLineLabelBG(theme);
+        boolean showLabelLine = ThemeUtil.parseLabelShowBackground(theme);
         ((EnhancedLineAndShapeRenderer)r).setShowLineLabelBG(idx, showLabelLine);
     }
 
@@ -98,7 +107,8 @@
         if (!(r instanceof EnhancedLineAndShapeRenderer)) {
             return;
         }
-        ((EnhancedLineAndShapeRenderer)r).setLineLabelFont(ThemeUtil.parseLineLabelFont(theme), idx);
+        ((EnhancedLineAndShapeRenderer)r).setLineLabelFont(
+                ThemeUtil.parseTextFont(theme), idx);
     }
 
     /** Tell the renderer which color to use for
@@ -107,7 +117,8 @@
         if (!(r instanceof EnhancedLineAndShapeRenderer)) {
             return;
         }
-        ((EnhancedLineAndShapeRenderer)r).setLineLabelTextColor(idx, ThemeUtil.parseLineLabelTextColor(theme));
+        ((EnhancedLineAndShapeRenderer)r).setLineLabelTextColor(
+                idx, ThemeUtil.parseTextColor(theme));
     }
 
     /** Tell the renderer which color to use for bg of
@@ -117,7 +128,7 @@
             return;
         }
         ((EnhancedLineAndShapeRenderer)r).setLineLabelBGColor(idx,
-            ThemeUtil.parseLineLabelBGColor(theme));
+            ThemeUtil.parseTextBackground(theme));
     }
 
     /** Set stroke of series. */
@@ -210,6 +221,7 @@
     }
 
 
+    @Override
     public XYLineAndShapeRenderer getRenderer() {
         return this.renderer;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/LineStyle.java	Thu Jul 26 10:02:07 2012 +0000
@@ -0,0 +1,21 @@
+package de.intevation.flys.themes;
+
+import java.awt.Color;
+
+public class LineStyle {
+    protected Color lineColor;
+    protected int   lineWidth;
+
+    public LineStyle(Color color, int width) {
+        this.lineColor = color;
+        this.lineWidth = width;
+    }
+
+    public int getWidth() {
+        return lineWidth;
+    }
+
+    public Color getColor() {
+        return lineColor;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/PointStyle.java	Thu Jul 26 10:02:07 2012 +0000
@@ -0,0 +1,5 @@
+package de.intevation.flys.themes;
+
+public class PointStyle {
+    // TODO tbd
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/TextStyle.java	Thu Jul 26 10:02:07 2012 +0000
@@ -0,0 +1,52 @@
+package de.intevation.flys.themes;
+
+import de.intevation.flys.jfree.StableXYDifferenceRenderer;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.annotations.XYTextAnnotation;
+
+public class TextStyle {
+    @SuppressWarnings("unused")
+    private static Logger log = Logger.getLogger(TextStyle.class);
+
+    protected Color   textColor;
+    protected Font    font;
+    protected Color   bgColor;
+    protected boolean showBg;
+    protected boolean isVertical;
+
+    public TextStyle(Color fgColor, Font font, Color bgColor,
+        boolean showBg, boolean isVertical
+    ) {
+        this.textColor  = fgColor;
+        this.font       = font;
+        this.bgColor    = bgColor;
+        this.showBg     = showBg;
+        this.isVertical = isVertical;
+    }
+
+    public void apply(XYTextAnnotation ta) {
+        ta.setPaint(textColor);
+        ta.setFont(font);
+        if (this.showBg) {
+            ta.setBackgroundPaint(bgColor);
+        }
+        if (this.isVertical) {
+            ta.setRotationAngle(270f*Math.PI/180f);
+        }
+        else {
+            ta.setRotationAngle(0);
+        }
+    }
+
+    public void apply(StableXYDifferenceRenderer renderer) {
+        renderer.setLabelColor(textColor);
+        renderer.setLabelFont(font);
+        if (this.showBg) {
+            renderer.setLabelBGColor(bgColor);
+        }
+    }
+}
\ No newline at end of file
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java	Thu Jul 26 10:02:07 2012 +0000
@@ -1,16 +1,13 @@
 package de.intevation.flys.themes;
 
-import de.intevation.flys.jfree.StableXYDifferenceRenderer;
 import de.intevation.flys.utils.ThemeUtil;
 
 import java.awt.Color;
 import java.awt.Font;
 
-import org.jfree.chart.annotations.XYTextAnnotation;
 import org.w3c.dom.Document;
 
 
-/** Undocumented. */
 public class ThemeAccess
 {
     protected Document theme;
@@ -90,9 +87,9 @@
         return textBackground;
     }
 
-    public boolean parseShowTextBackground() {
+    public boolean parseLabelShowBackground() {
         if (showTextBackground == null) {
-            showTextBackground = ThemeUtil.parseShowTextBackground(theme);
+            showTextBackground = ThemeUtil.parseLabelShowBackground(theme);
         }
         return showTextBackground;
     }
@@ -115,77 +112,13 @@
         return new LineStyle(parseLineColorField(), Integer.valueOf(parseLineWidth()));
     }
 
-    public static class PointStyle {
-        // TODO tbd
-    }
-
-    public static class LineStyle {
-        protected Color lineColor;
-        protected int   lineWidth;
-
-        public LineStyle(Color color, int width) {
-            this.lineColor = color;
-            this.lineWidth = width;
-        }
-
-        public int getWidth() {
-            return lineWidth;
-        }
-
-        public Color getColor() {
-            return lineColor;
-        }
-    }
-
-
     public TextStyle parseTextStyle() {
         return new TextStyle(
             parseTextColor(),
             parseTextFont(),
             parseTextBackground(),
-            parseShowTextBackground(),
+            parseLabelShowBackground(),
             !parseTextOrientation().equals("horizontal"));
     }
-
-
-    public static class TextStyle {
-        protected Color   textColor;
-        protected Font    font;
-        protected Color   bgColor;
-        protected boolean showBg;
-        protected boolean isVertical;
-
-        public TextStyle(Color fgColor, Font font, Color bgColor,
-            boolean showBg, boolean isVertical
-        ) {
-            this.textColor  = fgColor;
-            this.font       = font;
-            this.bgColor    = bgColor;
-            this.showBg     = showBg;
-            this.isVertical = isVertical;
-        }
-
-        public void apply(XYTextAnnotation ta) {
-            ta.setPaint(textColor);
-            ta.setFont(font);
-            if (this.showBg) {
-                ta.setBackgroundPaint(bgColor);
-            }
-            if (this.isVertical) {
-                ta.setRotationAngle(270f*Math.PI/180f);
-            }
-            else {
-                ta.setRotationAngle(0);
-            }
-        }
-
-        public void apply(StableXYDifferenceRenderer renderer) {
-            renderer.setLabelColor(textColor);
-            renderer.setLabelFont(font);
-            if (this.showBg) {
-                renderer.setLabelBGColor(bgColor);
-            }
-        }
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java	Thu Jul 26 10:02:07 2012 +0000
@@ -1,24 +1,22 @@
 package de.intevation.flys.themes;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.context.FLYSContext;
+
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
-import java.util.HashMap;
 
 import javax.xml.xpath.XPathConstants;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-
-import de.intevation.artifacts.common.utils.XMLUtils;
-
-import de.intevation.flys.artifacts.context.FLYSContext;
-import de.intevation.flys.artifacts.FLYSArtifact;
 
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
@@ -84,9 +82,11 @@
         }
 
         // Fetch mapping and themes.
+        @SuppressWarnings("unchecked")
         Map<String, List<ThemeMapping>> map = (Map<String, List<ThemeMapping>>)
             c.get(FLYSContext.THEME_MAPPING);
 
+        @SuppressWarnings("unchecked")
         List<ThemeGroup> tgs = (List<ThemeGroup>)
             c.get(FLYSContext.THEMES);
 
@@ -138,6 +138,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public static List<ThemeGroup> getThemeGroups(FLYSContext c) {
         List<ThemeGroup> tgs = (List<ThemeGroup>)
             c.get(FLYSContext.THEMES);
@@ -145,6 +146,7 @@
     }
 
 
+    @SuppressWarnings("unchecked")
     public static List<Theme> getThemes (FLYSContext c, String name) {
         List<ThemeGroup> tgs = (List<ThemeGroup>)
             c.get(FLYSContext.THEMES);
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Jul 26 09:56:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Thu Jul 26 10:02:07 2012 +0000
@@ -24,119 +24,104 @@
 public class ThemeUtil {
 
     private static Logger logger =
-        Logger.getLogger(ThemeUtil.class);
+            Logger.getLogger(ThemeUtil.class);
 
     public final static String XPATH_FILL_COLOR =
-        "/theme/field[@name='fillcolor']/@default";
+            "/theme/field[@name='fillcolor']/@default";
 
     public final static String XPATH_LINE_COLOR =
-        "/theme/field[@name='linecolor']/@default";
+            "/theme/field[@name='linecolor']/@default";
 
     public static final String XPATH_LINE_SIZE =
-        "/theme/field[@name='linesize']/@default";
+            "/theme/field[@name='linesize']/@default";
 
     public static final String XPATH_LINE_STYLE =
-        "/theme/field[@name='linetype']/@default";
+            "/theme/field[@name='linetype']/@default";
 
     public static final String XPATH_POINT_SIZE =
-        "/theme/field[@name='pointsize']/@default";
+            "/theme/field[@name='pointsize']/@default";
 
     public static final String XPATH_POINT_COLOR =
-        "/theme/field[@name='pointcolor']/@default";
+            "/theme/field[@name='pointcolor']/@default";
 
     public final static String XPATH_SHOW_BORDER =
-        "/theme/field[@name='showborder']/@default";
+            "/theme/field[@name='showborder']/@default";
 
     public final static String XPATH_SHOW_POINTS =
-        "/theme/field[@name='showpoints']/@default";
+            "/theme/field[@name='showpoints']/@default";
 
     public final static String XPATH_SHOW_LINE =
-        "/theme/field[@name='showlines']/@default";
+            "/theme/field[@name='showlines']/@default";
 
     public final static String XPATH_SHOW_VERTICAL_LINE =
-        "/theme/field[@name='showverticalline']/@default";
+            "/theme/field[@name='showverticalline']/@default";
 
     public final static String XPATH_SHOW_HORIZONTAL_LINE =
-        "/theme/field[@name='showhorizontalline']/@default";
+            "/theme/field[@name='showhorizontalline']/@default";
 
     public final static String XPATH_SHOW_LINE_LABEL =
-        "/theme/field[@name='showlinelabel']/@default";
+            "/theme/field[@name='showlinelabel']/@default";
 
     public final static String XPATH_SHOW_POINT_LABEL =
             "/theme/field[@name='showpointlabel']/@default";
 
-    public final static String XPATH_LINE_LABEL_FONT =
-        "/theme/field[@name='linelabelfont']/@default";
-
-    public final static String XPATH_LINE_LABEL_COLOR =
-        "/theme/field[@name='linelabelcolor']/@default";
-
-    public final static String XPATH_LINE_LABEL_SIZE =
-        "/theme/field[@name='linelabelsize']/@default";
-
-    public final static String XPATH_LINE_LABEL_STYLE =
-        "/theme/field[@name='linelabelstyle']/@default";
-
-    public final static String XPATH_LINE_LABEL_BGCOLOR =
-        "/theme/field[@name='linelabelbgcolor']/@default";
-
-    public final static String XPATH_LINE_LABEL_SHOWBG =
-        "/theme/field[@name='linelabelshowbg']/@default";
-
     public final static String XPATH_SHOW_WIDTH =
-        "/theme/field[@name='showwidth']/@default";
+            "/theme/field[@name='showwidth']/@default";
 
     public final static String XPATH_SHOW_LEVEL =
-        "/theme/field[@name='showwidth']/@default";
+            "/theme/field[@name='showwidth']/@default";
 
     public final static String XPATH_TRANSPARENCY =
-        "/theme/field[@name='transparent']/@default";
+            "/theme/field[@name='transparent']/@default";
 
     public final static String XPATH_TRANSPARENCY_ALPHA =
-        "/theme/field[@name='alpha']/@default";
+            "/theme/field[@name='alpha']/@default";
 
     public final static String XPATH_SHOW_AREA =
-        "/theme/field[@name='showarea']/@default";
+            "/theme/field[@name='showarea']/@default";
 
     public final static String XPATH_SHOW_MIDDLE_HEIGHT =
-        "/theme/field[@name='showmiddleheight']/@default";
-
-    public final static String XPATH_TEXT_COLOR =
-        "/theme/field[@name='textcolor']/@default";
+            "/theme/field[@name='showmiddleheight']/@default";
 
-    public final static String XPATH_TEXT_SIZE =
-        "/theme/field[@name='textsize']/@default";
+    public final static String XPATH_LABEL_FONT_COLOR =
+            "/theme/field[@name='labelfontcolor']/@default";
 
-    public final static String XPATH_TEXT_FONT =
-        "/theme/field[@name='font']/@default";
+    public final static String XPATH_LABEL_FONT_SIZE =
+            "/theme/field[@name='labelfontsize']/@default";
 
-    public final static String XPATH_TEXT_STYLE =
-        "/theme/field[@name='textstyle']/@default";
+    public final static String XPATH_LABEL_FONT_FACE =
+            "/theme/field[@name='labelfontface']/@default";
+
+    public final static String XPATH_LABEL_FONT_STYLE =
+            "/theme/field[@name='labelfontstyle']/@default";
 
     public final static String XPATH_TEXT_ORIENTATION =
-        "/theme/field[@name='textorientation']/@default";
+            "/theme/field[@name='textorientation']/@default";
 
-    public final static String XPATH_TEXT_BACKGROUND =
-        "/theme/field[@name='backgroundcolor']/@default";
+    public final static String XPATH_LABEL_BGCOLOR =
+            "/theme/field[@name='labelbgcolor']/@default";
 
-    public final static String XPATH_SHOW_BACKGROUND =
-        "/theme/field[@name='showbackground']/@default";
+    public final static String XPATH_LABEL_SHOW_BACKGROUND =
+            "/theme/field[@name='labelshowbg']/@default";
+
+    public final static String XPATH_BACKGROUND_COLOR =
+            "/theme/field[@name='backgroundcolor']/@default";
 
     public final static String XPATH_SYMBOL =
-        "/theme/field[@name='symbol']/@default";
+            "/theme/field[@name='symbol']/@default";
 
     public final static String XPATH_SHOW_MINIMUM =
-        "/theme/field[@name='showminimum']/@default";
+            "/theme/field[@name='showminimum']/@default";
 
     public final static String XPATH_SHOW_MAXIMUM =
-        "/theme/field[@name='showmaximum']/@default";
+            "/theme/field[@name='showmaximum']/@default";
 
     public final static String XPATH_WSPLGEN_FIELDS =
-        "/theme[@name='WSPLGEN']/field";
+            "/theme[@name='WSPLGEN']/field";
 
     /** XPATH to bandwidth field. */
     public final static String XPATH_BANDWIDTH =
-        "/theme/field[@name='bandwidth']/@default";
+            "/theme/field[@name='bandwidth']/@default";
 
 
     /** Parse string to be boolean with default if empty or unrecognized. */
@@ -298,12 +283,7 @@
 
 
     public static int parseTextSize(Document theme) {
-        return parseTextSize(theme, XPATH_TEXT_SIZE);
-    }
-
-
-    public static int parseLineLabelSize(Document theme) {
-        return parseTextSize(theme, XPATH_LINE_LABEL_SIZE);
+        return parseTextSize(theme, XPATH_LABEL_FONT_SIZE);
     }
 
 
@@ -384,25 +364,12 @@
     }
 
 
-    /** Parse color for line label(s text). */
-    public static Color parseLineLabelTextColor(Document theme) {
-        return parseRGB(getLineLabelTextColorString(theme));
-    }
-
-    /** Parse bg color for line label(s text). */
-    public static Color parseLineLabelBGColor(Document theme) {
-        return parseRGB(getLineLabelBGColorString(theme));
-    }
-
-    // TODO showbg and bg color for linelabels
-
-
     /**
      * Parses the font.
      * @param theme The theme.
      */
     public static Font parseTextFont(Document theme) {
-        String font = XMLUtils.xpathString(theme, XPATH_TEXT_FONT, null);
+        String font = XMLUtils.xpathString(theme, XPATH_LABEL_FONT_FACE, null);
         if (font == null || font.length() == 0) {
             return null;
         }
@@ -413,20 +380,6 @@
         return f;
     }
 
-    /** Parse font (name, size and style) for linelabels. */
-    public static Font parseLineLabelFont(Document theme) {
-        String font = XMLUtils.xpathString(theme, XPATH_LINE_LABEL_FONT, null);
-        if (font == null || font.length() == 0) {
-            return null;
-        }
-
-        int size = parseLineLabelSize(theme);
-        int style = parseLineLabelStyle(theme);
-
-        Font f = new Font (font, style, size);
-        return f;
-    }
-
 
     /**
      * Parses the text style, defaults to 'Font.PLAIN'.
@@ -451,12 +404,7 @@
 
 
     public static int parseTextStyle(Document theme) {
-        return parseTextStyle(theme, XPATH_TEXT_STYLE);
-    }
-
-
-    public static int parseLineLabelStyle(Document theme) {
-        return parseTextStyle(theme, XPATH_LINE_LABEL_STYLE);
+        return parseTextStyle(theme, XPATH_LABEL_FONT_STYLE);
     }
 
 
@@ -465,6 +413,7 @@
         return parseBoolean(show, false);
     }
 
+
     public static boolean parseShowLevel(Document theme) {
         String show = XMLUtils.xpathString(theme, XPATH_SHOW_LEVEL, null);
         return parseBoolean(show, false);
@@ -490,7 +439,7 @@
      * @param theme The theme.
      */
     public static Color parseTextBackground(Document theme) {
-        String color = getBackgroundColorString(theme);
+        String color = getLabelBackgroundColorString(theme);
         if (color == null || color.length() == 0) {
             return Color.WHITE;
         }
@@ -503,19 +452,8 @@
      * false.
      * @param theme The theme.
      */
-    public static boolean parseShowTextBackground(Document theme) {
-        String show = XMLUtils.xpathString(theme, XPATH_SHOW_BACKGROUND, null);
-        return parseBoolean(show, false);
-    }
-
-
-    /**
-     * Parses the attribute whether to show line labels background or not,
-     * defaults to false.
-     * @param theme The theme.
-     */
-    public static boolean parseShowLineLabelBG(Document theme) {
-        String show = XMLUtils.xpathString(theme, XPATH_LINE_LABEL_SHOWBG, null);
+    public static boolean parseLabelShowBackground(Document theme) {
+        String show = XMLUtils.xpathString(theme, XPATH_LABEL_SHOW_BACKGROUND, null);
         return parseBoolean(show, false);
     }
 
@@ -578,37 +516,40 @@
         return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null);
     }
 
+
     /** Get show border as string. */
     public static String getShowBorderString(Document theme) {
         return XMLUtils.xpathString(theme, XPATH_SHOW_BORDER, null);
     }
 
+
     /** Get fill color as string. */
     public static String getFillColorString(Document theme) {
         return XMLUtils.xpathString(theme, XPATH_FILL_COLOR, null);
     }
 
+
+    public static String getLabelBackgroundColorString(Document theme) {
+        return XMLUtils.xpathString(theme, XPATH_LABEL_BGCOLOR, null);
+    }
+
+
     public static String getBackgroundColorString(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_TEXT_BACKGROUND, null);
+        return XMLUtils.xpathString(theme, XPATH_BACKGROUND_COLOR, null);
     }
 
 
     public static String getTextColorString(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null);
+        String textColor = XMLUtils.xpathString(theme, XPATH_LABEL_FONT_COLOR, null);
+        return textColor;
     }
 
-    public static String getLineLabelTextColorString(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_LINE_LABEL_COLOR, null);
-    }
-
-    public static String getLineLabelBGColorString(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_LINE_LABEL_BGCOLOR, null);
-    }
 
     public static String getSymbol(Document theme) {
         return XMLUtils.xpathString(theme, XPATH_SYMBOL, null);
     }
 
+
     public static String getTransparencyString(Document theme) {
         return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
     }
@@ -638,14 +579,17 @@
         return parseRGB(getFillColorString(theme));
     }
 
+
     public static boolean parseShowBorder(Document theme) {
         return parseBoolean(getShowBorderString(theme), false);
     }
 
+
     public static boolean parseTransparency(Document theme) {
         return parseBoolean(getTransparencyString(theme), false);
     }
 
+
     /**
      * Gets color from color field.
      * @param theme    the theme document.
@@ -663,6 +607,7 @@
         return parseBoolean(getShowMinimum(theme), false);
     }
 
+
     public static boolean parseShowMaximum(Document theme) {
         return parseBoolean(getShowMaximum(theme), false);
     }
@@ -670,9 +615,9 @@
 
     public static String createWSPLGENStyle(Document theme) {
         NodeList categories = (NodeList) XMLUtils.xpath(
-            theme,
-            XPATH_WSPLGEN_FIELDS,
-            XPathConstants.NODESET);
+                theme,
+                XPATH_WSPLGEN_FIELDS,
+                XPathConstants.NODESET);
 
         return createWSPLGENStyle(categories).toString();
     }
@@ -726,7 +671,7 @@
 
     public static String createMapserverStyle(Document theme) {
         String symbol    = getSymbol(theme);
-        String backcolor = getBackgroundColorString(theme);
+        String backcolor = getLabelBackgroundColorString(theme);
         String linecolor = getLineColorString(theme);
 
         int linewidth = parseLineWidth(theme);

http://dive4elements.wald.intevation.org