comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 2072:4cdd9c4896f6

#393 Added a new Renderer and Options in Themes that allow displaying minimum and maximum of a chart series. flys-artifacts/trunk@3581 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 04 Jan 2012 12:24:35 +0000
parents 5746c74c69cf
children 41037d51c8b6
comparison
equal deleted inserted replaced
2071:fd95bfbb2ec2 2072:4cdd9c4896f6
68 public final static String XPATH_SHOW_BACKGROUND = 68 public final static String XPATH_SHOW_BACKGROUND =
69 "/theme/field[@name='showbackground']/@default"; 69 "/theme/field[@name='showbackground']/@default";
70 70
71 public final static String XPATH_SYMBOL = 71 public final static String XPATH_SYMBOL =
72 "/theme/field[@name='symbol']/@default"; 72 "/theme/field[@name='symbol']/@default";
73
74 public final static String XPATH_SHOW_MINIMUM =
75 "/theme/field[@name='showminimum']/@default";
76
77 public final static String XPATH_SHOW_MAXIMUM =
78 "/theme/field[@name='showmaximum']/@default";
73 79
74 80
75 /** Parse string to be boolean with default if empty or unrecognized. */ 81 /** Parse string to be boolean with default if empty or unrecognized. */
76 public static boolean parseBoolean(String value, boolean defaultsTo) { 82 public static boolean parseBoolean(String value, boolean defaultsTo) {
77 if (value == null || value.length() == 0) { 83 if (value == null || value.length() == 0) {
324 public static String getTransparencyString(Document theme) { 330 public static String getTransparencyString(Document theme) {
325 return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null); 331 return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
326 } 332 }
327 333
328 334
335 public static String getShowMinimum(Document theme) {
336 return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null);
337 }
338
339
340 public static String getShowMaximum(Document theme) {
341 return XMLUtils.xpathString(theme, XPATH_SHOW_MAXIMUM, null);
342 }
343
344
329 /** 345 /**
330 * Gets color from color field. 346 * Gets color from color field.
331 * @param theme the theme document. 347 * @param theme the theme document.
332 * @return color. 348 * @return color.
333 */ 349 */
348 * @param theme the theme document. 364 * @param theme the theme document.
349 * @return color. 365 * @return color.
350 */ 366 */
351 public static Color parseLineColorField(Document theme) { 367 public static Color parseLineColorField(Document theme) {
352 return parseRGB(getLineColorString(theme)); 368 return parseRGB(getLineColorString(theme));
369 }
370
371
372 public static boolean parseShowMinimum(Document theme) {
373 return parseBoolean(getShowMinimum(theme), false);
374 }
375
376 public static boolean parseShowMaximum(Document theme) {
377 return parseBoolean(getShowMaximum(theme), false);
353 } 378 }
354 379
355 380
356 public static String createMapserverStyle(Document theme) { 381 public static String createMapserverStyle(Document theme) {
357 String symbol = getSymbol(theme); 382 String symbol = getSymbol(theme);

http://dive4elements.wald.intevation.org