comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/XYStyle.java @ 2648:8aaa7f4ce06a

Let theme define whether or not to display a (yet static) label for line). flys-artifacts/trunk@4306 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 26 Apr 2012 09:51:13 +0000
parents 991e4a5df323
children f1dcd5f94ffa
comparison
equal deleted inserted replaced
2647:4b7a28e81643 2648:8aaa7f4ce06a
11 11
12 import de.intevation.flys.utils.ThemeUtil; 12 import de.intevation.flys.utils.ThemeUtil;
13 13
14 14
15 /** 15 /**
16 * Utility to apply theme-settings to a renderer.
16 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
17 */ 18 */
18 public class XYStyle implements Style { 19 public class XYStyle implements Style {
19 20
20 protected Document theme; 21 protected Document theme;
36 applyShowLine(r, idx); 37 applyShowLine(r, idx);
37 applyShowPoints(r, idx); 38 applyShowPoints(r, idx);
38 applyPointSize(r, idx); 39 applyPointSize(r, idx);
39 applyShowMinimum(r, idx); 40 applyShowMinimum(r, idx);
40 applyShowMaximum(r, idx); 41 applyShowMaximum(r, idx);
42 applyShowLineLabel(r, idx);
41 43
42 return r; 44 return r;
43 } 45 }
44 46
45 47
47 protected void applyLineColor(XYLineAndShapeRenderer r, int idx) { 49 protected void applyLineColor(XYLineAndShapeRenderer r, int idx) {
48 Color c = ThemeUtil.parseLineColorField(theme); 50 Color c = ThemeUtil.parseLineColorField(theme);
49 r.setSeriesPaint(idx, c); 51 r.setSeriesPaint(idx, c);
50 } 52 }
51 53
54
55 /** Tells the renderer whether or not to add a label to a line. */
56 protected void applyShowLineLabel(XYLineAndShapeRenderer r, int idx) {
57 if (!(r instanceof EnhancedLineAndShapeRenderer)) {
58 return;
59 }
60 boolean showLabelLine = ThemeUtil.parseShowLineLabel(theme);
61 ((EnhancedLineAndShapeRenderer)r).setShowLineLabel(showLabelLine, idx);
62 }
52 63
53 protected void applyLineSize(XYLineAndShapeRenderer r, int idx) { 64 protected void applyLineSize(XYLineAndShapeRenderer r, int idx) {
54 int size = ThemeUtil.parseLineWidth(theme); 65 int size = ThemeUtil.parseLineWidth(theme);
55 r.setSeriesStroke( 66 r.setSeriesStroke(
56 idx, 67 idx,

http://dive4elements.wald.intevation.org