Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 1745:4ae7df2a74ed
Fix NPE in WDiff-diagram because no ranges present in masterartifact.
flys-artifacts/trunk@3039 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 19 Oct 2011 16:06:01 +0000 |
parents | 6cdc7a77d3d4 |
children | d56b94325bec |
rev | line source |
---|---|
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.utils; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
3 import org.apache.log4j.Logger; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
4 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 import java.awt.Color; |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
6 import java.awt.Font; |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Document; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.common.utils.XMLUtils; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 /** |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 * Utility to deal with themes and their representations. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 */ |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 public class ThemeUtil { |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
17 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
18 private static Logger logger = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
19 Logger.getLogger(ThemeUtil.class); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
20 |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
21 public final static String XPATH_LINE_COLOR = |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
22 "/theme/field[@name='linecolor']/@default"; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
23 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
24 public static final String XPATH_LINE_SIZE = |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
25 "/theme/field[@name='linesize']/@default"; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
26 |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
27 public final static String XPATH_TEXT_COLOR = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
28 "/theme/field[@name='textcolor']/@default"; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
29 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
30 public final static String XPATH_TEXT_SIZE = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
31 "/theme/field[@name='textsize']/@default"; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
32 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
33 public final static String XPATH_TEXT_FONT = |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
34 "/theme/field[@name='font']/@default"; |
1711
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
35 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
36 /** |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
37 * Parses line width, defaulting to 0. |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
38 * @param theme the theme |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
39 */ |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
40 public static int parseLineWidth(Document theme) { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
41 String size = XMLUtils.xpathString(theme, XPATH_LINE_SIZE, null); |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
42 if (size == null || size.length() == 0) { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
43 return 0; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
44 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
45 |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
46 try { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
47 return Integer.valueOf(size); |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
48 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
49 catch (NumberFormatException nfe) { |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
50 //logger.warn("Unable to set line size from string: '" + size + "'"); |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
51 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
52 return 0; |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
53 } |
f708120cb7bc
Fix flys/issue363 (W-INFO/ Abflusskurve, Extremwert-Rendering).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1090
diff
changeset
|
54 |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
56 /** |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
57 * Parses text size, defaulting to 10. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
58 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
59 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
60 public static int parseTextSize(Document theme) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
61 String size = XMLUtils.xpathString(theme, XPATH_TEXT_SIZE, null); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
62 if (size == null || size.length() == 0) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
63 return 10; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
64 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
65 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
66 try { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
67 return Integer.valueOf(size); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
68 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
69 catch (NumberFormatException nfe) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
70 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
71 return 10; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
72 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
73 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
74 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
75 /** |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
76 * Parses text color. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
77 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
78 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
79 public static Color parseTextColor(Document theme) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
80 String color = XMLUtils.xpathString(theme, XPATH_TEXT_COLOR, null); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
81 return parseRGB(color); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
82 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
83 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
84 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
85 /** |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
86 * Parses the font. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
87 * @param theme The theme. |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
88 */ |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
89 public static Font parseTextFont(Document theme) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
90 String font = XMLUtils.xpathString(theme, XPATH_TEXT_FONT, null); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
91 if (font == null || font.length() == 0) { |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
92 return null; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
93 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
94 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
95 int size = parseTextSize(theme); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
96 Font f = new Font (font, 0, size); |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
97 return f; |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
98 } |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
99 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
100 |
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
101 /** |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
102 * Parse a string like "103, 100, 0" and return a corresping color. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
103 * @param rgbtext Color as string representation, e.g. "255,0,20". |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
104 * @return Color, null in case of issues. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
105 */ |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
106 public static Color parseRGB(String rgbtext) { |
1738
6cdc7a77d3d4
Apply theme attributes to axis annotation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1711
diff
changeset
|
107 logger.debug("parseColor: " + rgbtext); |
1090
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
108 if (rgbtext == null) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
109 return null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
110 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
111 String rgb[] = rgbtext.split(","); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
112 Color c = null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
113 try { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
114 c = new Color( |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
115 Integer.valueOf(rgb[0].trim()), |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
116 Integer.valueOf(rgb[1].trim()), |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
117 Integer.valueOf(rgb[2].trim())); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
118 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
119 catch (NumberFormatException nfe) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
120 c = null; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
121 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
122 return c; |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
123 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
124 |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
125 /** |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
126 * Gets color from color field. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
127 * @param theme the theme document. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
128 * @return color. |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
129 */ |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
130 public static Color parseLineColorField(Document theme) { |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
131 String color = XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
132 return parseRGB(color); |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
133 } |
9324839684a4
New theme-related utilities.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
134 } |