comparison artifacts/src/main/java/org/dive4elements/river/jfree/StyledDomainMarker.java @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-artifacts/src/main/java/org/dive4elements/river/jfree/StyledDomainMarker.java@bd047b71ab37
children 4897a58c8746
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 package org.dive4elements.river.jfree;
2
3 import java.awt.Color;
4
5 import org.jfree.chart.plot.IntervalMarker;
6 import org.w3c.dom.Document;
7
8 import org.dive4elements.river.utils.ThemeUtil;
9
10 /**
11 * Marker that represents a highlighted interval.
12 *
13 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a>
14 */
15 public class StyledDomainMarker extends IntervalMarker {
16
17 private static final long serialVersionUID = -4369417661339512342L;
18
19 private final Color backgroundColor, backgroundColor2;
20
21 public StyledDomainMarker(double start, double end, Document theme) {
22 super(start, end);
23
24 backgroundColor = ThemeUtil.parseColor(
25 ThemeUtil.getAreaBackgroundColorString(theme));
26 backgroundColor2 = new Color(
27 255 - backgroundColor.getRed(),
28 255 - backgroundColor.getGreen(),
29 255 - backgroundColor.getBlue());
30 useSecondColor(false);
31
32 int alpha = 100 - ThemeUtil.parseInteger(
33 ThemeUtil.getAreaTransparencyString(theme), 50);
34 setAlpha(alpha / 100.0f);
35 }
36
37 /**
38 * To properly differentiate several styled domain markers side by side,
39 * we can use this switch to toggle between two colors.
40 * @param secondColor
41 */
42 public void useSecondColor(boolean secondColor) {
43 if(!secondColor) {
44 if(backgroundColor != null)
45 setPaint(backgroundColor);
46 }
47 else {
48 if(backgroundColor2 != null)
49 setPaint(backgroundColor2);
50 }
51 }
52 }
53 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org