annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java @ 2998:4b6fb6d91192

issue417: duration curve main values as line(s) to curve. flys-artifacts/trunk@4553 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 29 May 2012 14:59:04 +0000
parents b75681c09ef8
children 703be13ffa74
rev   line source
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.utils;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.awt.Color;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import java.awt.Font;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import org.w3c.dom.Document;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
8 import de.intevation.flys.jfree.StableXYDifferenceRenderer;
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
9
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
10 import org.jfree.chart.annotations.XYTextAnnotation;
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
12
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
13 /** Undocumented. */
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 public class ThemeAccess
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 protected Document theme;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18 protected Integer lineWidth;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 protected Color lineColor;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 protected Color textColor;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 protected Font font;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 protected String textOrientation;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 protected Color textBackground;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 protected Boolean showTextBackground;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
27
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 public ThemeAccess(Document theme) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29 this.theme = theme;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
32
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33 public int parseLineWidth() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 if (lineWidth == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 lineWidth = ThemeUtil.parseLineWidth(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 return lineWidth;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
40
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 public Color parseLineColorField() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 if (lineColor == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 lineColor = ThemeUtil.parseLineColorField(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 if (lineColor == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 lineColor = Color.BLACK;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 return lineColor;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
51
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 public Color parseTextColor() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 if (textColor == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54 textColor = ThemeUtil.parseTextColor(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 if (textColor == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 textColor = Color.BLACK;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 return textColor;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
62
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 public Font parseTextFont() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 if (font == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 font = ThemeUtil.parseTextFont(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 if (font == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 font = new Font("Arial", Font.BOLD, 10);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 return font;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
73
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 public String parseTextOrientation() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 if (textOrientation == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 textOrientation = ThemeUtil.parseTextOrientation(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 if (textOrientation == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 textOrientation = "horizontal";
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 return textOrientation;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 public Color parseTextBackground() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 if (textBackground == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 textBackground = ThemeUtil.parseTextBackground(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 if (textBackground == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 textBackground = Color.WHITE;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 return textBackground;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 public boolean parseShowTextBackground() {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 if (showTextBackground == null) {
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 showTextBackground = ThemeUtil.parseShowTextBackground(theme);
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 return showTextBackground;
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 /**
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103 more of this
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 */
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
106 public LineStyle parseLineStyle() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
107 return new LineStyle(parseLineColorField(), Integer.valueOf(parseLineWidth()));
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
108 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
109
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
110 public static class LineStyle {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
111 protected Color lineColor;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
112 protected int lineWidth;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
113
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
114 public LineStyle(Color color, int width) {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
115 this.lineColor = color;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
116 this.lineWidth = width;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
117 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
118
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
119 public int getWidth() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
120 return lineWidth;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
121 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
122
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
123 public Color getColor() {
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
124 return lineColor;
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
125 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
126 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
127
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
128
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
129 public TextStyle parseTextStyle() {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
130 return new TextStyle(parseTextColor(), parseTextFont(),
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
131 parseTextBackground(), parseShowTextBackground(),
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
132 !parseTextOrientation().equals("horizontal"));
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
133 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
134
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
135
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
136 public static class TextStyle {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
137 protected Color textColor;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
138 protected Font font;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
139 protected Color bgColor;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
140 protected boolean showBg;
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
141 protected boolean isVertical;
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
142
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
143 public TextStyle(Color fgColor, Font font, Color bgColor,
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
144 boolean showBg, boolean isVertical
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
145 ) {
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
146 this.textColor = fgColor;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
147 this.font = font;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
148 this.bgColor = bgColor;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
149 this.showBg = showBg;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
150 this.isVertical = isVertical;
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
151 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
153 public void apply(XYTextAnnotation ta) {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
154 ta.setPaint(textColor);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
155 ta.setFont(font);
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
156 if (this.showBg) {
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
157 ta.setBackgroundPaint(bgColor);
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
158 }
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
159 if (this.isVertical) {
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
160 ta.setRotationAngle(270f*Math.PI/180f);
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
161 }
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
162 else {
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
163 ta.setRotationAngle(0f*Math.PI/180f);
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
164 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
165 }
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
166
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
167 public void apply(StableXYDifferenceRenderer renderer) {
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
168 renderer.setLabelColor(textColor);
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
169 renderer.setLabelFont(font);
2667
b75681c09ef8 Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
170 if (this.showBg) {
b75681c09ef8 Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
171 renderer.setLabelBGColor(bgColor);
b75681c09ef8 Respect area label bg text style, draw label roughly at centroid of polygons (sofar, better but not yet good).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2666
diff changeset
172 }
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
173 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
174 }
1754
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
175 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
176 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org