Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java @ 3077:5c87d4ca1bd3
Added chart and export generator stubs for SQ relation.
flys-artifacts/trunk@4672 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 15 Jun 2012 10:17:22 +0000 |
parents | 5642a83420f2 |
children | 22def36d37b7 |
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 |
3076
5642a83420f2
FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2999
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 |
2161
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
103 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
|
104 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
|
105 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
106 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
107 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
|
108 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
|
109 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
|
110 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
115 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
116 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
|
117 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
|
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 |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
120 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
|
121 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
|
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 } |
c68f4f227c09
Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2152
diff
changeset
|
124 |
2412
451b25878105
Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
125 |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
126 public TextStyle parseTextStyle() { |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
127 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
|
128 parseTextBackground(), parseShowTextBackground(), |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
129 !parseTextOrientation().equals("horizontal")); |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
130 } |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
131 |
2412
451b25878105
Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
132 |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
133 public static class TextStyle { |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
134 protected Color textColor; |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
135 protected Font font; |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
136 protected Color bgColor; |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
137 protected boolean showBg; |
2416
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
138 protected boolean isVertical; |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
139 |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
140 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
|
141 boolean showBg, boolean isVertical |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
142 ) { |
2416
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
143 this.textColor = fgColor; |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
144 this.font = font; |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
145 this.bgColor = bgColor; |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
146 this.showBg = showBg; |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
147 this.isVertical = isVertical; |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
148 } |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
149 |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
150 public void apply(XYTextAnnotation ta) { |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
151 ta.setPaint(textColor); |
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
152 ta.setFont(font); |
2412
451b25878105
Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
153 if (this.showBg) { |
451b25878105
Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
154 ta.setBackgroundPaint(bgColor); |
451b25878105
Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2161
diff
changeset
|
155 } |
2416
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
156 if (this.isVertical) { |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
157 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
|
158 } |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
159 else { |
5144369d5961
Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2412
diff
changeset
|
160 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
|
161 } |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
162 } |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2416
diff
changeset
|
163 |
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2416
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 } |
2666
6da7e064ae90
Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2416
diff
changeset
|
170 } |
2152
2336927cb096
Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1754
diff
changeset
|
171 } |
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
|
172 } |
8e6615ad60b8
Added some simple caching for themes. Only used in sticky annotations by now.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |