Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeAccess.java @ 3651:06a65baae494
merged flys-artifacts/2.9
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:43 +0200 |
parents | 0b9b2a0c4e64 |
children |
comparison
equal
deleted
inserted
replaced
3549:6a8f83c538e3 | 3651:06a65baae494 |
---|---|
1 package de.intevation.flys.themes; | |
2 | |
3 import de.intevation.flys.utils.ThemeUtil; | |
4 | |
5 import java.awt.Color; | |
6 import java.awt.Font; | |
7 | |
8 import org.w3c.dom.Document; | |
9 | |
10 | |
11 public class ThemeAccess | |
12 { | |
13 protected Document theme; | |
14 | |
15 protected Integer lineWidth; | |
16 | |
17 protected Color lineColor; | |
18 protected Color textColor; | |
19 protected Font font; | |
20 protected String textOrientation; | |
21 protected Color textBackground; | |
22 protected Boolean showTextBackground; | |
23 protected Color pointColor; | |
24 | |
25 | |
26 public ThemeAccess(Document theme) { | |
27 this.theme = theme; | |
28 } | |
29 | |
30 | |
31 public int parseLineWidth() { | |
32 if (lineWidth == null) { | |
33 lineWidth = ThemeUtil.parseLineWidth(theme); | |
34 } | |
35 return lineWidth; | |
36 } | |
37 | |
38 | |
39 public Color parseLineColorField() { | |
40 if (lineColor == null) { | |
41 lineColor = ThemeUtil.parseLineColorField(theme); | |
42 if (lineColor == null) { | |
43 lineColor = Color.BLACK; | |
44 } | |
45 } | |
46 return lineColor; | |
47 } | |
48 | |
49 | |
50 public Color parseTextColor() { | |
51 if (textColor == null) { | |
52 textColor = ThemeUtil.parseTextColor(theme); | |
53 if (textColor == null) { | |
54 textColor = Color.BLACK; | |
55 } | |
56 } | |
57 return textColor; | |
58 } | |
59 | |
60 | |
61 public Font parseTextFont() { | |
62 if (font == null) { | |
63 font = ThemeUtil.parseTextFont(theme); | |
64 if (font == null) { | |
65 font = new Font("Arial", Font.BOLD, 10); | |
66 } | |
67 } | |
68 return font; | |
69 } | |
70 | |
71 | |
72 public String parseTextOrientation() { | |
73 if (textOrientation == null) { | |
74 textOrientation = ThemeUtil.parseTextOrientation(theme); | |
75 } | |
76 return textOrientation; | |
77 } | |
78 | |
79 | |
80 public Color parseTextBackground() { | |
81 if (textBackground == null) { | |
82 textBackground = ThemeUtil.parseTextBackground(theme); | |
83 if (textBackground == null) { | |
84 textBackground = Color.WHITE; | |
85 } | |
86 } | |
87 return textBackground; | |
88 } | |
89 | |
90 public boolean parseLabelShowBackground() { | |
91 if (showTextBackground == null) { | |
92 showTextBackground = ThemeUtil.parseLabelShowBackground(theme); | |
93 } | |
94 return showTextBackground; | |
95 } | |
96 | |
97 | |
98 public Color parsePointColor() { | |
99 if (pointColor == null) { | |
100 pointColor = ThemeUtil.parsePointColor(theme); | |
101 | |
102 if (pointColor == null) { | |
103 return parseLineColorField(); | |
104 } | |
105 } | |
106 | |
107 return pointColor; | |
108 } | |
109 | |
110 | |
111 public LineStyle parseLineStyle() { | |
112 return new LineStyle(parseLineColorField(), Integer.valueOf(parseLineWidth())); | |
113 } | |
114 | |
115 public TextStyle parseTextStyle() { | |
116 return new TextStyle( | |
117 parseTextColor(), | |
118 parseTextFont(), | |
119 parseTextBackground(), | |
120 parseLabelShowBackground(), | |
121 !parseTextOrientation().equals("horizontal")); | |
122 } | |
123 } | |
124 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |