comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.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 940cd2ef149f
children
comparison
equal deleted inserted replaced
4685:ffe273af84fb 4686:85876e3a5346
14 */ 14 */
15 public class StyledDomainMarker extends IntervalMarker { 15 public class StyledDomainMarker extends IntervalMarker {
16 16
17 private static final long serialVersionUID = -4369417661339512342L; 17 private static final long serialVersionUID = -4369417661339512342L;
18 18
19 private final Color fillColor, backgroundColor; 19 private final Color backgroundColor, backgroundColor2;
20 20
21 public StyledDomainMarker(double start, double end, Document theme) { 21 public StyledDomainMarker(double start, double end, Document theme) {
22 super(start, end); 22 super(start, end);
23 23
24 backgroundColor = ThemeUtil.parseColor( 24 backgroundColor = ThemeUtil.parseColor(
25 ThemeUtil.getBackgroundColorString(theme)); 25 ThemeUtil.getAreaBackgroundColorString(theme));
26 fillColor = ThemeUtil.parseColor( 26 backgroundColor2 = new Color(
27 ThemeUtil.getFillColorString(theme)); 27 255 - backgroundColor.getRed(),
28 255 - backgroundColor.getGreen(),
29 255 - backgroundColor.getBlue());
28 useSecondColor(false); 30 useSecondColor(false);
29 31
30 int alpha = 100 - ThemeUtil.parseInteger( 32 int alpha = 100 - ThemeUtil.parseInteger(
31 ThemeUtil.getTransparencyString(theme), 50); 33 ThemeUtil.getAreaTransparencyString(theme), 50);
32 setAlpha(alpha / 100.0f); 34 setAlpha(alpha / 100.0f);
33 } 35 }
34 36
35 /** 37 /**
36 * To properly differentiate several styled domain markers side by side, 38 * To properly differentiate several styled domain markers side by side,
37 * we can use this switch to toggle between two colors. 39 * we can use this switch to toggle between two colors.
38 * @param secondColor 40 * @param secondColor
39 */ 41 */
40 public void useSecondColor(boolean secondColor) { 42 public void useSecondColor(boolean secondColor) {
41 if(secondColor) { 43 if(!secondColor) {
42 if(backgroundColor != null) 44 if(backgroundColor != null)
43 setPaint(backgroundColor); 45 setPaint(backgroundColor);
44 } 46 }
45 else { 47 else {
46 if(fillColor != null) 48 if(backgroundColor2 != null)
47 setPaint(fillColor); 49 setPaint(backgroundColor2);
48 } 50 }
49 } 51 }
50 } 52 }
51 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 53 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org