comparison artifacts/src/main/java/org/dive4elements/river/themes/ThemeAccess.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/themes/ThemeAccess.java@bd047b71ab37
children 4897a58c8746
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.themes;
2
3 import org.dive4elements.river.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 :

http://dive4elements.wald.intevation.org