Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java @ 6912:058b8dc4e8b6
Artifacts: ThemeDocument. More debug output. Make more getters private to only expose the parsed values.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 23 Aug 2013 14:37:54 +0200 |
parents | 835e07ee769d |
children | 234b1a3b527d |
comparison
equal
deleted
inserted
replaced
6911:1f1acbe5f243 | 6912:058b8dc4e8b6 |
---|---|
97 | 97 |
98 public final static String SHOW_MINIMUM = "showminimum"; | 98 public final static String SHOW_MINIMUM = "showminimum"; |
99 | 99 |
100 public final static String SHOW_MAXIMUM = "showmaximum"; | 100 public final static String SHOW_MAXIMUM = "showmaximum"; |
101 | 101 |
102 public final static String WSPLGEN_FIELDS = "/theme[@name='WSPLGEN']/field"; | |
103 | |
104 public final static String WSPLGEN_STARTCOLOR = "startcolor"; | 102 public final static String WSPLGEN_STARTCOLOR = "startcolor"; |
105 | 103 |
106 public final static String WSPLGEN_ENDCOLOR = "endcolor"; | 104 public final static String WSPLGEN_ENDCOLOR = "endcolor"; |
107 | 105 |
108 public final static String WSPLGEN_NUMCLASSES = "numclasses"; | 106 public final static String WSPLGEN_NUMCLASSES = "numclasses"; |
140 String name = field.getAttribute("name"); | 138 String name = field.getAttribute("name"); |
141 String value = field.getAttribute("default"); | 139 String value = field.getAttribute("default"); |
142 if (!name.isEmpty() && !value.isEmpty()) { | 140 if (!name.isEmpty() && !value.isEmpty()) { |
143 values.put(name, value); | 141 values.put(name, value); |
144 } | 142 } |
143 } | |
144 if (logger.isDebugEnabled()) { | |
145 logger.debug("Theme values: " + values); | |
145 } | 146 } |
146 return values; | 147 return values; |
147 } | 148 } |
148 | 149 |
149 /** Parse string to be boolean with default if empty or unrecognized. */ | 150 /** Parse string to be boolean with default if empty or unrecognized. */ |
455 // Do nothing | 456 // Do nothing |
456 } | 457 } |
457 return null; | 458 return null; |
458 } | 459 } |
459 | 460 |
460 public String getLineColorString() { | 461 private String getLineColorString() { |
461 return getValue(LINE_COLOR); | 462 return getValue(LINE_COLOR); |
462 } | 463 } |
463 | 464 |
464 | 465 |
465 /** Get show border as string. */ | 466 /** Get show border as string. */ |
466 public String getShowBorderString() { | 467 private String getShowBorderString() { |
467 return getValue(SHOW_BORDER); | 468 return getValue(SHOW_BORDER); |
468 } | 469 } |
469 | 470 |
470 | 471 |
471 /** Get fill color as string. */ | 472 /** Get fill color as string. */ |
472 private String getFillColorString() { | 473 private String getFillColorString() { |
473 return getValue(FILL_COLOR); | 474 return getValue(FILL_COLOR); |
474 } | 475 } |
475 | 476 |
476 public String getSymbol() { | 477 private String getSymbol() { |
477 return getValue(SYMBOL); | 478 return getValue(SYMBOL); |
478 } | 479 } |
479 | |
480 | 480 |
481 private String getTransparencyString() { | 481 private String getTransparencyString() { |
482 return getValue(TRANSPARENCY); | 482 return getValue(TRANSPARENCY); |
483 } | 483 } |
484 | 484 |
485 | 485 |
486 public String getAreaTransparencyString() { | 486 private String getAreaTransparencyString() { |
487 return getValue(AREA_TRANSPARENCY); | 487 return getValue(AREA_TRANSPARENCY); |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 public String getShowMinimum() { | 491 private String getShowMinimum() { |
492 return getValue(SHOW_MINIMUM); | 492 return getValue(SHOW_MINIMUM); |
493 } | 493 } |
494 | 494 |
495 | 495 |
496 public String getShowMaximum() { | 496 private String getShowMaximum() { |
497 return getValue(SHOW_MAXIMUM); | 497 return getValue(SHOW_MAXIMUM); |
498 } | 498 } |
499 | |
500 | 499 |
501 /** | 500 /** |
502 * Gets color from color field. | 501 * Gets color from color field. |
503 * @param theme the theme document. | 502 * @param theme the theme document. |
504 * @return color. | 503 * @return color. |
505 */ | 504 */ |
506 public Color parseFillColorField() { | 505 public Color parseFillColorField() { |
507 return parseRGB(getFillColorString()); | 506 return parseRGB(getFillColorString()); |
508 } | 507 } |
509 | 508 |
510 | |
511 public boolean parseShowBorder() { | 509 public boolean parseShowBorder() { |
512 return parseBoolean(getShowBorderString(), false); | 510 return parseBoolean(getShowBorderString(), false); |
513 } | 511 } |
514 | |
515 | 512 |
516 public int parseTransparency() { | 513 public int parseTransparency() { |
517 return parseInteger(getTransparencyString(), 50); | 514 return parseInteger(getTransparencyString(), 50); |
518 } | 515 } |
519 | 516 |
643 * @param idx Current class index that is being processed. | 640 * @param idx Current class index that is being processed. |
644 * @param maxIdx Highest class index. | 641 * @param maxIdx Highest class index. |
645 * @param meta Caller meta object used to determine locale. | 642 * @param meta Caller meta object used to determine locale. |
646 * @return | 643 * @return |
647 */ | 644 */ |
648 protected static String createWSPLGENClassName(float val, float step, int idx, int maxIdx, CallMeta meta) { | 645 protected static String createWSPLGENClassName( |
646 float val, | |
647 float step, | |
648 int idx, | |
649 int maxIdx, | |
650 CallMeta meta | |
651 ) { | |
649 assert meta != null : "CallMeta instance is null"; | 652 assert meta != null : "CallMeta instance is null"; |
650 | 653 |
651 if (idx < maxIdx) { | 654 if (idx < maxIdx) { |
652 return Resources.getMsg(meta, MSG_ISOBATH_CLASS, | 655 return Resources.getMsg(meta, MSG_ISOBATH_CLASS, |
653 new Object[] {val, val + step}); | 656 new Object[] {val, val + step}); |