Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | 6b880df95a3a |
children | 666ac28a0256 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
25 import org.w3c.dom.Element; | 25 import org.w3c.dom.Element; |
26 import org.w3c.dom.NodeList; | 26 import org.w3c.dom.NodeList; |
27 | 27 |
28 public class ThemeDocument | 28 public class ThemeDocument |
29 { | 29 { |
30 private static Logger logger = Logger.getLogger(ThemeDocument.class); | 30 private static Logger log = Logger.getLogger(ThemeDocument.class); |
31 | 31 |
32 private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class"; | 32 private static final String MSG_ISOBATH_CLASS = "floodmap.isobath.class"; |
33 | 33 |
34 private static final String MSG_ISOBATH_LASTCLASS = "floodmap.isobath.lastclass"; | 34 private static final String MSG_ISOBATH_LASTCLASS = "floodmap.isobath.lastclass"; |
35 | 35 |
142 } | 142 } |
143 | 143 |
144 private static Map<String, String> extractValues(Document document) { | 144 private static Map<String, String> extractValues(Document document) { |
145 Map<String, String> values = new HashMap<String, String>(); | 145 Map<String, String> values = new HashMap<String, String>(); |
146 if (document == null) { | 146 if (document == null) { |
147 logger.error("Invalid null document given."); | 147 log.error("Invalid null document given."); |
148 return values; | 148 return values; |
149 } | 149 } |
150 | 150 |
151 NodeList fields = document.getElementsByTagName("field"); | 151 NodeList fields = document.getElementsByTagName("field"); |
152 for (int i = 0, N = fields.getLength(); i < N; ++i) { | 152 for (int i = 0, N = fields.getLength(); i < N; ++i) { |
155 String value = field.getAttribute("default"); | 155 String value = field.getAttribute("default"); |
156 if (!name.isEmpty() && !value.isEmpty()) { | 156 if (!name.isEmpty() && !value.isEmpty()) { |
157 values.put(name, value); | 157 values.put(name, value); |
158 } | 158 } |
159 } | 159 } |
160 if (logger.isDebugEnabled()) { | 160 if (log.isDebugEnabled()) { |
161 logger.debug("Theme values: " + values); | 161 log.debug("Theme values: " + values); |
162 } | 162 } |
163 return values; | 163 return values; |
164 } | 164 } |
165 | 165 |
166 /** Parse string to be boolean with default if empty or unrecognized. */ | 166 /** Parse string to be boolean with default if empty or unrecognized. */ |
256 return parseBoolean(show, false); | 256 return parseBoolean(show, false); |
257 } | 257 } |
258 | 258 |
259 public Font parseFont() { | 259 public Font parseFont() { |
260 String font = getValue(FONT); | 260 String font = getValue(FONT); |
261 logger.debug(" font is " + font); | 261 log.debug(" font is " + font); |
262 if (font == null) { | 262 if (font == null) { |
263 return null; | 263 return null; |
264 } | 264 } |
265 | 265 |
266 int size = parseFontSize(); | 266 int size = parseFontSize(); |
308 | 308 |
309 try { | 309 try { |
310 return Integer.parseInt(size); | 310 return Integer.parseInt(size); |
311 } | 311 } |
312 catch (NumberFormatException nfe) { | 312 catch (NumberFormatException nfe) { |
313 logger.warn("Unable to set line size from string: '" + size + "'"); | 313 log.warn("Unable to set line size from string: '" + size + "'"); |
314 } | 314 } |
315 return 0; | 315 return 0; |
316 } | 316 } |
317 | 317 |
318 public float [] parseLineStyle() { | 318 public float [] parseLineStyle() { |
334 dashes[i] = Float.parseFloat(pattern[i]); | 334 dashes[i] = Float.parseFloat(pattern[i]); |
335 } | 335 } |
336 return dashes; | 336 return dashes; |
337 } | 337 } |
338 catch (NumberFormatException nfe) { | 338 catch (NumberFormatException nfe) { |
339 logger.warn("Unable to set dash from string: '" + dash + "'"); | 339 log.warn("Unable to set dash from string: '" + dash + "'"); |
340 return def; | 340 return def; |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 public int parsePointWidth() { | 344 public int parsePointWidth() { |
596 * Gets color from color field. | 596 * Gets color from color field. |
597 * @return color. | 597 * @return color. |
598 */ | 598 */ |
599 public Color parseLineColorField() { | 599 public Color parseLineColorField() { |
600 String lineColorStr = getLineColorString(); | 600 String lineColorStr = getLineColorString(); |
601 if (logger.isDebugEnabled()) { | 601 if (log.isDebugEnabled()) { |
602 logger.debug("parseLineColorField: lineColorStr = " + | 602 log.debug("parseLineColorField: lineColorStr = " + |
603 (lineColorStr == null | 603 (lineColorStr == null |
604 ? "null" | 604 ? "null" |
605 : lineColorStr)); | 605 : lineColorStr)); |
606 } | 606 } |
607 return parseColor(lineColorStr); | 607 return parseColor(lineColorStr); |
608 } | 608 } |
609 | 609 |
610 | 610 |
611 public Color parseAreaLineColorField() { | 611 public Color parseAreaLineColorField() { |
612 String lineColorStr = getAreaLineColorString(); | 612 String lineColorStr = getAreaLineColorString(); |
613 if (logger.isDebugEnabled()) { | 613 if (log.isDebugEnabled()) { |
614 logger.debug("parseLineColorField: lineColorStr = " + | 614 log.debug("parseLineColorField: lineColorStr = " + |
615 (lineColorStr == null | 615 (lineColorStr == null |
616 ? "null" | 616 ? "null" |
617 : lineColorStr)); | 617 : lineColorStr)); |
618 } | 618 } |
619 return parseColor(lineColorStr); | 619 return parseColor(lineColorStr); |
740 public String createMapserverStyle() { | 740 public String createMapserverStyle() { |
741 String symbol = getSymbol(); | 741 String symbol = getSymbol(); |
742 String backcolor = getLabelBackgroundColorString(); | 742 String backcolor = getLabelBackgroundColorString(); |
743 String linecolor = getLineColorString(); | 743 String linecolor = getLineColorString(); |
744 if (linecolor == null) { | 744 if (linecolor == null) { |
745 logger.warn("createMapserverStyle: linecolor String is empty"); | 745 log.warn("createMapserverStyle: linecolor String is empty"); |
746 linecolor = "0,128,255"; | 746 linecolor = "0,128,255"; |
747 } | 747 } |
748 | 748 |
749 int linewidth = parseLineWidth(); | 749 int linewidth = parseLineWidth(); |
750 | 750 |