Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/themes/TextStyle.java @ 3468:f37e7e8907cb
merged flys-artifacts/2.8.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:39 +0200 |
parents | 0b9b2a0c4e64 |
children |
comparison
equal
deleted
inserted
replaced
3387:5ffad8bde8ad | 3468:f37e7e8907cb |
---|---|
1 package de.intevation.flys.themes; | |
2 | |
3 import de.intevation.flys.jfree.StableXYDifferenceRenderer; | |
4 | |
5 import java.awt.Color; | |
6 import java.awt.Font; | |
7 | |
8 import org.apache.log4j.Logger; | |
9 import org.jfree.chart.annotations.XYTextAnnotation; | |
10 | |
11 public class TextStyle { | |
12 @SuppressWarnings("unused") | |
13 private static Logger log = Logger.getLogger(TextStyle.class); | |
14 | |
15 protected Color textColor; | |
16 protected Font font; | |
17 protected Color bgColor; | |
18 protected boolean showBg; | |
19 protected boolean isVertical; | |
20 | |
21 public TextStyle(Color fgColor, Font font, Color bgColor, | |
22 boolean showBg, boolean isVertical | |
23 ) { | |
24 this.textColor = fgColor; | |
25 this.font = font; | |
26 this.bgColor = bgColor; | |
27 this.showBg = showBg; | |
28 this.isVertical = isVertical; | |
29 } | |
30 | |
31 public void apply(XYTextAnnotation ta) { | |
32 ta.setPaint(textColor); | |
33 ta.setFont(font); | |
34 if (this.showBg) { | |
35 ta.setBackgroundPaint(bgColor); | |
36 } | |
37 if (this.isVertical) { | |
38 ta.setRotationAngle(270f*Math.PI/180f); | |
39 } | |
40 else { | |
41 ta.setRotationAngle(0); | |
42 } | |
43 } | |
44 | |
45 public void apply(StableXYDifferenceRenderer renderer) { | |
46 renderer.setLabelColor(textColor); | |
47 renderer.setLabelFont(font); | |
48 if (this.showBg) { | |
49 renderer.setLabelBGColor(bgColor); | |
50 } | |
51 } | |
52 } |