comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 4389:ecd237428af6

ThemeUtil: Method to parse/access showextramark theme prop.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 02 Nov 2012 15:10:39 +0100
parents 7140bb0f92b0
children b87073a05f9d
comparison
equal deleted inserted replaced
4388:7fc4855ecd26 4389:ecd237428af6
119 119
120 /** XPATH to bandwidth field. */ 120 /** XPATH to bandwidth field. */
121 public final static String XPATH_BANDWIDTH = 121 public final static String XPATH_BANDWIDTH =
122 "/theme/field[@name='bandwidth']/@default"; 122 "/theme/field[@name='bandwidth']/@default";
123 123
124 /** XPATH to find showextramark field. */
125 public final static String XPATH_SHOWEXTRAMARK =
126 "/theme/field[@name='showextramark']/@default";
124 127
125 /** Parse string to be boolean with default if empty or unrecognized. */ 128 /** Parse string to be boolean with default if empty or unrecognized. */
126 public static boolean parseBoolean(String value, boolean defaultsTo) { 129 public static boolean parseBoolean(String value, boolean defaultsTo) {
127 if (value == null || value.length() == 0) { 130 if (value == null || value.length() == 0) {
128 return defaultsTo; 131 return defaultsTo;
282 285
283 public static int parseTextSize(Document theme) { 286 public static int parseTextSize(Document theme) {
284 return parseTextSize(theme, XPATH_LABEL_FONT_SIZE); 287 return parseTextSize(theme, XPATH_LABEL_FONT_SIZE);
285 } 288 }
286 289
290
291 /**
292 * Parses the attribute 'showextramark', defaults to false.
293 * @param theme The theme.
294 */
295 public static boolean parseShowExtraMark(Document theme) {
296 String show = XMLUtils.xpathString(theme, XPATH_SHOWEXTRAMARK, null);
297 return parseBoolean(show, false);
298 }
287 299
288 /** 300 /**
289 * Parses the attribute 'showpoints', defaults to false. 301 * Parses the attribute 'showpoints', defaults to false.
290 * @param theme The theme. 302 * @param theme The theme.
291 */ 303 */

http://dive4elements.wald.intevation.org