annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java @ 3227:ed07dd55f487

Fixed various bugs (package declarations, moved classes to correct places). flys-artifacts/trunk@4854 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 03 Jul 2012 08:46:14 +0000
parents bbb488b145ce
children f062b5a90e26
rev   line source
3227
ed07dd55f487 Fixed various bugs (package declarations, moved classes to correct places).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3205
diff changeset
1 package de.intevation.flys.themes;
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
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;
3227
ed07dd55f487 Fixed various bugs (package declarations, moved classes to correct places).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3205
diff changeset
9 import de.intevation.flys.utils.ThemeUtil;
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
10
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
11 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
12
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
13
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
14 /** 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
15 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
16 {
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 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
18
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 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
20
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 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
22 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
23 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
24 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
25 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
26 protected Boolean showTextBackground;
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
27 protected Color pointColor;
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
29
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
30 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
31 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
32 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
34
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
35 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
36 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
37 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
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 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
40 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
42
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
43 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
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 = 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
46 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
47 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
48 }
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 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
51 }
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
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2999
diff changeset
53
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
54 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
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 = 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
57 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
58 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
59 }
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 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
62 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
64
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
65 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
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 = 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
68 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
69 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
70 }
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 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
73 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
75
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
76 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
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 = 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
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 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
81 }
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 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
85 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
86 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
87 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
88 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
89 }
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 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
92 }
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 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
95 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
96 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
97 }
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 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
99 }
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
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
102 public Color parsePointColor() {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
103 if (pointColor == null) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
104 pointColor = ThemeUtil.parsePointColor(theme);
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
105
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
106 if (pointColor == null) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
107 return parseLineColorField();
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
108 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
109 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
110
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
111 return pointColor;
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
112 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
113
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
114
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
115 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
116 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
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 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
120 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
121 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
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 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
124 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
125 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
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
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
128 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
129 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
130 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
131
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
132 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
133 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
134 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
135 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
136
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
137
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
138 public TextStyle parseTextStyle() {
3205
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3090
diff changeset
139 return new TextStyle(
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3090
diff changeset
140 parseTextColor(),
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3090
diff changeset
141 parseTextFont(),
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3090
diff changeset
142 parseTextBackground(),
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3090
diff changeset
143 parseShowTextBackground(),
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
144 !parseTextOrientation().equals("horizontal"));
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
145 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
146
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
147
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
148 public static class TextStyle {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
149 protected Color textColor;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
150 protected Font font;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
151 protected Color bgColor;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
152 protected boolean showBg;
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
153 protected boolean isVertical;
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
154
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
155 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
156 boolean showBg, boolean isVertical
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
157 ) {
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
158 this.textColor = fgColor;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
159 this.font = font;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
160 this.bgColor = bgColor;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
161 this.showBg = showBg;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
162 this.isVertical = isVertical;
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
163 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
164
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
165 public void apply(XYTextAnnotation ta) {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
166 ta.setPaint(textColor);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
167 ta.setFont(font);
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
168 if (this.showBg) {
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
169 ta.setBackgroundPaint(bgColor);
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
170 }
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
171 if (this.isVertical) {
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
172 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
173 }
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
174 else {
3205
bbb488b145ce Set text orientation to horizontal for points in Fixation W/Q curve
Christian Lins <christian.lins@intevation.de>
parents: 3090
diff changeset
175 ta.setRotationAngle(0);
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
176 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
177 }
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
178
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
179 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
180 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
181 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
182 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
183 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
184 }
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
185 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
186 }
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
187 }
8e6615ad60b8 Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
188 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org