annotate flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java @ 3130:0dd569e9b9f1

Added new methods to add domain and value axis markers to time series plots. flys-artifacts/trunk@4731 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 20 Jun 2012 15:33:32 +0000
parents 22def36d37b7
children bbb488b145ce
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;
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
26 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
27
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
28
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
29 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
30 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
31 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
33
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
34 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
35 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
36 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
37 }
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 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
39 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
41
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
42 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
43 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
44 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
45 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
46 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
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 }
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 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
50 }
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
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2999
diff changeset
52
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
53 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
54 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
55 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
56 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
57 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
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 }
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 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
61 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
63
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
64 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
65 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
66 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
67 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
68 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
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 }
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 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
72 }
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
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
74
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
75 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
76 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
77 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
78 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
79 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
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 }
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 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
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
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 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
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 = 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
89 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
90 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
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 }
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 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
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
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 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
97 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
98 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
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 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
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
3090
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
104 public Color parsePointColor() {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
105 if (pointColor == null) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
106 pointColor = ThemeUtil.parsePointColor(theme);
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
107
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
108 if (pointColor == null) {
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
109 return parseLineColorField();
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 }
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 return pointColor;
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
114 }
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
115
22def36d37b7 Apply point color in XYStyle.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3076
diff changeset
116
2161
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
117 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
118 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
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
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
121 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
122 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
123 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
124
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
125 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
126 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
127 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
128 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
129
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
130 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
131 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
132 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
133
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
134 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
135 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
136 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
137 }
c68f4f227c09 Somewhat unified Annotation handling, use jfreechart-house-toolkit instead of custom StickyAxisAnnotation.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2152
diff changeset
138
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
139
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
140 public TextStyle parseTextStyle() {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
141 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
142 parseTextBackground(), parseShowTextBackground(),
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
143 !parseTextOrientation().equals("horizontal"));
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
144 }
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
145
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
146
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
147 public static class TextStyle {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
148 protected Color textColor;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
149 protected Font font;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
150 protected Color bgColor;
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
151 protected boolean showBg;
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
152 protected boolean isVertical;
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
153
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
154 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
155 boolean showBg, boolean isVertical
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
156 ) {
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
157 this.textColor = fgColor;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
158 this.font = font;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
159 this.bgColor = bgColor;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
160 this.showBg = showBg;
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
161 this.isVertical = isVertical;
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
162 }
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 public void apply(XYTextAnnotation ta) {
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
165 ta.setPaint(textColor);
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
166 ta.setFont(font);
2412
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
167 if (this.showBg) {
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
168 ta.setBackgroundPaint(bgColor);
451b25878105 Partial fix flys/issue500 (text bg of some annotations).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2161
diff changeset
169 }
2416
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
170 if (this.isVertical) {
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
171 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
172 }
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
173 else {
5144369d5961 Partial Fix flys/issue500: text-orientation for texts.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2412
diff changeset
174 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
175 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
176 }
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
177
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
178 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
179 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
180 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
181 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
182 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
183 }
2666
6da7e064ae90 Allow basic and styled area labels, yet on static position within plot.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2416
diff changeset
184 }
2152
2336927cb096 Add basic (text) styling for HYKS.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1754
diff changeset
185 }
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
186 }
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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org