Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 7582:8ebca831486b
issue1606: Added methods to parse omitted theme properties.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 19 Nov 2013 10:19:25 +0100 |
parents | 4dbbdf0c8b2c |
children | 4b67eb1a3a68 |
comparison
equal
deleted
inserted
replaced
7581:b2d750a6df9f | 7582:8ebca831486b |
---|---|
83 | 83 |
84 public final static String LABEL_FONT_FACE = "labelfontface"; | 84 public final static String LABEL_FONT_FACE = "labelfontface"; |
85 | 85 |
86 public final static String LABEL_FONT_STYLE = "labelfontstyle"; | 86 public final static String LABEL_FONT_STYLE = "labelfontstyle"; |
87 | 87 |
88 public final static String FONT = "font"; | |
89 | |
90 public final static String TEXT_SIZE = "textsize"; | |
91 | |
92 public final static String TEXT_STYLE = "textstyle"; | |
93 | |
88 public final static String TEXT_ORIENTATION = "textorientation"; | 94 public final static String TEXT_ORIENTATION = "textorientation"; |
89 | 95 |
90 public final static String LABEL_BGCOLOR = "labelbgcolor"; | 96 public final static String LABEL_BGCOLOR = "labelbgcolor"; |
91 | 97 |
92 public final static String LABEL_SHOW_BACKGROUND = "labelshowbg"; | 98 public final static String LABEL_SHOW_BACKGROUND = "labelshowbg"; |
248 public boolean parseLabelShowBackground() { | 254 public boolean parseLabelShowBackground() { |
249 String show = getValue(LABEL_SHOW_BACKGROUND); | 255 String show = getValue(LABEL_SHOW_BACKGROUND); |
250 return parseBoolean(show, false); | 256 return parseBoolean(show, false); |
251 } | 257 } |
252 | 258 |
259 public Font parseFont() { | |
260 String font = getValue(FONT); | |
261 logger.debug(" font is " + font); | |
262 if (font == null) { | |
263 return null; | |
264 } | |
265 | |
266 int size = parseFontSize(); | |
267 int style = parseFontStyle(); | |
268 Font f = new Font(font, style, size); | |
269 return f; | |
270 } | |
271 | |
253 public Font parseTextFont() { | 272 public Font parseTextFont() { |
254 String font = getValue(LABEL_FONT_FACE); | 273 String font = getValue(LABEL_FONT_FACE); |
255 if (font == null) { | 274 if (font == null) { |
256 return null; | 275 return null; |
257 } | 276 } |
338 } | 357 } |
339 | 358 |
340 public boolean parseShowLine() { | 359 public boolean parseShowLine() { |
341 String show = getValue(SHOW_LINE); | 360 String show = getValue(SHOW_LINE); |
342 return parseBoolean(show, true); | 361 return parseBoolean(show, true); |
362 } | |
363 | |
364 public int parseFontStyle() { | |
365 String style = getValue(TEXT_STYLE); | |
366 if (style == null) { | |
367 return Font.PLAIN; | |
368 } | |
369 | |
370 if (style.equals("italic")) { | |
371 return Font.ITALIC; | |
372 } | |
373 if (style.equals("bold")) { | |
374 return Font.BOLD; | |
375 } | |
376 return Font.PLAIN; | |
343 } | 377 } |
344 | 378 |
345 public int parseTextStyle() { | 379 public int parseTextStyle() { |
346 String style = getValue(LABEL_FONT_STYLE); | 380 String style = getValue(LABEL_FONT_STYLE); |
347 if (style == null) { | 381 if (style == null) { |
439 public Boolean parseUseFillPaint() { | 473 public Boolean parseUseFillPaint() { |
440 String use = getValue(USE_FILL_PAINT); | 474 String use = getValue(USE_FILL_PAINT); |
441 return use != null | 475 return use != null |
442 ? parseBoolean(use, false) | 476 ? parseBoolean(use, false) |
443 : null; | 477 : null; |
478 } | |
479 | |
480 public int parseFontSize() { | |
481 String size = getValue(TEXT_SIZE); | |
482 if (size == null) { | |
483 return 10; | |
484 } | |
485 | |
486 try { | |
487 return Integer.parseInt(size); | |
488 } | |
489 catch (NumberFormatException nfe) { | |
490 // Do nothing | |
491 } | |
492 return 10; | |
444 } | 493 } |
445 | 494 |
446 public int parseTextSize() { | 495 public int parseTextSize() { |
447 String size = getValue(LABEL_FONT_SIZE); | 496 String size = getValue(LABEL_FONT_SIZE); |
448 if (size == null) { | 497 if (size == null) { |