Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java @ 3254:9a4707ec7800
Add styles for W(t) chart domain markers
flys-artifacts/trunk@4888 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 06 Jul 2012 14:45:23 +0000 |
parents | |
children | 17ca0a43027a |
comparison
equal
deleted
inserted
replaced
3253:209d50ee8e9f | 3254:9a4707ec7800 |
---|---|
1 package de.intevation.flys.jfree; | |
2 | |
3 import de.intevation.flys.utils.ThemeUtil; | |
4 | |
5 import java.awt.Color; | |
6 | |
7 import org.jfree.chart.plot.IntervalMarker; | |
8 import org.w3c.dom.Document; | |
9 | |
10 /** | |
11 * Marker that represents a highlighted interval. | |
12 * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a> | |
13 */ | |
14 public class StyledDomainMarker extends IntervalMarker { | |
15 | |
16 private static final long serialVersionUID = -4369410661339512342L; | |
17 | |
18 private final Color fillColor, backgroundColor; | |
19 | |
20 public StyledDomainMarker(double start, double end, Document theme) { | |
21 super(start, end); | |
22 | |
23 backgroundColor = ThemeUtil.parseColor( | |
24 ThemeUtil.getBackgroundColorString(theme)); | |
25 fillColor = ThemeUtil.parseColor( | |
26 ThemeUtil.getFillColorString(theme)); | |
27 useSecondColor(false); | |
28 | |
29 int alpha = ThemeUtil.parseInteger(ThemeUtil.getTransparencyAlpha(theme), 128); | |
30 setAlpha(alpha / 255.0f); | |
31 } | |
32 | |
33 /** | |
34 * To properly differentiate several styled domain markers side by side, | |
35 * we can use this switch to toggle between two colors. | |
36 * @param secondColor | |
37 */ | |
38 public void useSecondColor(boolean secondColor) { | |
39 if(secondColor) { | |
40 setPaint(backgroundColor); | |
41 } | |
42 else { | |
43 setPaint(fillColor); | |
44 } | |
45 } | |
46 } |