comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 4686:85876e3a5346

Fixed and improved theme handling for areas.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 17 Dec 2012 15:32:53 +0100
parents fc52ee878412
children dc0d37715e16
comparison
equal deleted inserted replaced
4685:ffe273af84fb 4686:85876e3a5346
27 "/theme/field[@name='fillcolor']/@default"; 27 "/theme/field[@name='fillcolor']/@default";
28 28
29 public final static String XPATH_LINE_COLOR = 29 public final static String XPATH_LINE_COLOR =
30 "/theme/field[@name='linecolor']/@default"; 30 "/theme/field[@name='linecolor']/@default";
31 31
32 public final static String XPATH_AREA_LINE_COLOR =
33 "/theme/field[@name='areabordercolor']/@default";
34
32 public static final String XPATH_LINE_SIZE = 35 public static final String XPATH_LINE_SIZE =
33 "/theme/field[@name='linesize']/@default"; 36 "/theme/field[@name='linesize']/@default";
34 37
35 public static final String XPATH_LINE_STYLE = 38 public static final String XPATH_LINE_STYLE =
36 "/theme/field[@name='linetype']/@default"; 39 "/theme/field[@name='linetype']/@default";
42 "/theme/field[@name='pointcolor']/@default"; 45 "/theme/field[@name='pointcolor']/@default";
43 46
44 public final static String XPATH_SHOW_BORDER = 47 public final static String XPATH_SHOW_BORDER =
45 "/theme/field[@name='showborder']/@default"; 48 "/theme/field[@name='showborder']/@default";
46 49
50 public final static String XPATH_AREA_SHOW_BORDER =
51 "/theme/field[@name='showborder']/@default";
52
47 public final static String XPATH_SHOW_POINTS = 53 public final static String XPATH_SHOW_POINTS =
48 "/theme/field[@name='showpoints']/@default"; 54 "/theme/field[@name='showpoints']/@default";
49 55
50 public final static String XPATH_SHOW_LINE = 56 public final static String XPATH_SHOW_LINE =
51 "/theme/field[@name='showlines']/@default"; 57 "/theme/field[@name='showlines']/@default";
69 "/theme/field[@name='showlevel']/@default"; 75 "/theme/field[@name='showlevel']/@default";
70 76
71 public final static String XPATH_TRANSPARENCY = 77 public final static String XPATH_TRANSPARENCY =
72 "/theme/field[@name='transparency']/@default"; 78 "/theme/field[@name='transparency']/@default";
73 79
80 public final static String XPATH_AREA_TRANSPARENCY =
81 "/theme/field[@name='areatransparency']/@default";
82
74 public final static String XPATH_SHOW_AREA = 83 public final static String XPATH_SHOW_AREA =
75 "/theme/field[@name='showarea']/@default"; 84 "/theme/field[@name='showarea']/@default";
76 85
77 public final static String XPATH_SHOW_MIDDLE_HEIGHT = 86 public final static String XPATH_SHOW_MIDDLE_HEIGHT =
78 "/theme/field[@name='showmiddleheight']/@default"; 87 "/theme/field[@name='showmiddleheight']/@default";
98 public final static String XPATH_LABEL_SHOW_BACKGROUND = 107 public final static String XPATH_LABEL_SHOW_BACKGROUND =
99 "/theme/field[@name='labelshowbg']/@default"; 108 "/theme/field[@name='labelshowbg']/@default";
100 109
101 public final static String XPATH_BACKGROUND_COLOR = 110 public final static String XPATH_BACKGROUND_COLOR =
102 "/theme/field[@name='backgroundcolor']/@default"; 111 "/theme/field[@name='backgroundcolor']/@default";
112
113 public final static String XPATH_AREA_BACKGROUND_COLOR =
114 "/theme/field[@name='areabgcolor']/@default";
103 115
104 public final static String XPATH_SYMBOL = 116 public final static String XPATH_SYMBOL =
105 "/theme/field[@name='symbol']/@default"; 117 "/theme/field[@name='symbol']/@default";
106 118
107 public final static String XPATH_SHOW_MINIMUM = 119 public final static String XPATH_SHOW_MINIMUM =
568 public static String getTransparencyString(Document theme) { 580 public static String getTransparencyString(Document theme) {
569 return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null); 581 return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
570 } 582 }
571 583
572 584
585 public static String getAreaTransparencyString(Document theme) {
586 return XMLUtils.xpathString(theme, XPATH_AREA_TRANSPARENCY, null);
587 }
588
589
573 public static String getShowMinimum(Document theme) { 590 public static String getShowMinimum(Document theme) {
574 return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null); 591 return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null);
575 } 592 }
576 593
577 594
608 public static Color parseLineColorField(Document theme) { 625 public static Color parseLineColorField(Document theme) {
609 String lineColorStr = getLineColorString(theme); 626 String lineColorStr = getLineColorString(theme);
610 logger.debug("parseLineColorField: lineColorStr = " + 627 logger.debug("parseLineColorField: lineColorStr = " +
611 (lineColorStr == null ? "null" : lineColorStr)); 628 (lineColorStr == null ? "null" : lineColorStr));
612 return parseColor(lineColorStr); 629 return parseColor(lineColorStr);
630 }
631
632
633 public static Color parseAreaLineColorField(Document theme) {
634 String lineColorStr = getAreaLineColorString(theme);
635 logger.debug("parseLineColorField: lineColorStr = " +
636 (lineColorStr == null ? "null" : lineColorStr));
637 return parseColor(lineColorStr);
638 }
639
640
641 private static String getAreaLineColorString(Document theme) {
642 return XMLUtils.xpathString(theme, XPATH_AREA_LINE_COLOR, null);
613 } 643 }
614 644
615 645
616 public static boolean parseShowMinimum(Document theme) { 646 public static boolean parseShowMinimum(Document theme) {
617 return parseBoolean(getShowMinimum(theme), false); 647 return parseBoolean(getShowMinimum(theme), false);
721 751
722 ms.addClazz(c); 752 ms.addClazz(c);
723 753
724 return ms.toString(); 754 return ms.toString();
725 } 755 }
756
757
758 public static String getAreaBackgroundColorString(Document theme) {
759 return XMLUtils.xpathString(theme, XPATH_AREA_BACKGROUND_COLOR, null);
760 }
761
762
763 public static Color parseAreaBackgroundColor(Document theme) {
764 return parseColor(getAreaBackgroundColorString(theme));
765 }
766
767
768 public static int parseAreaTransparency(Document theme) {
769 return parseInteger(getAreaTransparencyString(theme), 50);
770 }
771
772
773 public static boolean parseAreaShowBorder(Document theme) {
774 return parseBoolean(getAreaShowBorderString(theme), false);
775 }
776
777
778 private static String getAreaShowBorderString(Document theme) {
779 return XMLUtils.xpathString(theme, XPATH_AREA_SHOW_BORDER, null);
780 }
726 } 781 }
727 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 782 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org