diff flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java @ 2152:2336927cb096

Add basic (text) styling for HYKS. flys-artifacts/trunk@3734 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 20 Jan 2012 08:38:50 +0000
parents 8e6615ad60b8
children c68f4f227c09
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java	Fri Jan 20 08:35:03 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java	Fri Jan 20 08:38:50 2012 +0000
@@ -5,7 +5,10 @@
 
 import org.w3c.dom.Document;
 
+import org.jfree.chart.annotations.XYTextAnnotation;
 
+
+/** Undocumented. */
 public class ThemeAccess
 {
     protected Document theme;
@@ -19,10 +22,12 @@
     protected Color   textBackground;
     protected Boolean showTextBackground;
 
+
     public ThemeAccess(Document theme) {
         this.theme = theme;
     }
 
+
     public int parseLineWidth() {
         if (lineWidth == null) {
             lineWidth = ThemeUtil.parseLineWidth(theme);
@@ -30,6 +35,7 @@
         return lineWidth;
     }
 
+
     public Color parseLineColorField() {
         if (lineColor == null) {
             lineColor = ThemeUtil.parseLineColorField(theme);
@@ -40,6 +46,7 @@
         return lineColor;
     }
 
+    
     public Color parseTextColor() {
         if (textColor == null) {
             textColor = ThemeUtil.parseTextColor(theme);
@@ -50,6 +57,7 @@
         return textColor;
     }
 
+
     public Font parseTextFont() {
         if (font == null) {
             font = ThemeUtil.parseTextFont(theme);
@@ -60,6 +68,7 @@
         return font;
     }
 
+
     public String parseTextOrientation() {
         if (textOrientation == null) {
             textOrientation = ThemeUtil.parseTextOrientation(theme);
@@ -92,5 +101,30 @@
     more of this
     */
 
+    public TextStyle parseTextStyle() {
+        return new TextStyle(parseTextColor(), parseTextFont(),
+            parseTextBackground(), false);
+    }
+
+    public static class TextStyle {
+        protected Color   textColor;
+        protected Font    font;
+        protected Color   bgColor;
+        protected boolean showBg;
+
+        public TextStyle(Color fgColor, Font font, Color bgColor,
+            boolean showBg
+        ) {
+            this.textColor = fgColor;
+            this.font = font;
+            this.bgColor = bgColor;
+            this.showBg = showBg;
+        }
+
+        public void apply(XYTextAnnotation ta) {
+            ta.setPaint(textColor);
+            ta.setFont(font);
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org