comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/FLYSAnnotation.java @ 3786:4adc35aa655c

merged flys-artifacts/2.9.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:47 +0200
parents 0f7abd95c6e2
children 7eebd9e58641
comparison
equal deleted inserted replaced
3719:e82acd5c86f7 3786:4adc35aa655c
1 package de.intevation.flys.jfree;
2
3 import java.util.Collections;
4 import java.util.List;
5
6 import org.w3c.dom.Document;
7
8 import org.jfree.chart.annotations.XYTextAnnotation;
9
10 import de.intevation.flys.artifacts.model.HYKFactory;
11
12 /**
13 * List of Text- Annotations with name and theme.
14 */
15 public class FLYSAnnotation {
16
17 /* 'Other' Text Annotations. */
18 protected List<XYTextAnnotation> textAnnotations;
19
20 /** Annotations at axis. */
21 protected List<StickyAxisAnnotation> axisTextAnnotations;
22
23 /** Areas at axis. */
24 protected List<HYKFactory.Zone> boxes;
25
26 /** Styling information. */
27 protected Document theme;
28
29 /** Chart-legend information. */
30 protected String label;
31
32
33 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations) {
34 this(label, annotations, null, null);
35 }
36
37
38 /** Create annotations, parameter might be null. */
39 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
40 List<HYKFactory.Zone> bAnnotations
41 ) {
42 this(label, annotations, bAnnotations, null);
43 }
44
45
46 /** Create annotations, parameter might be null. */
47 public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
48 List<HYKFactory.Zone> bAnnotations, Document theme
49 ) {
50 this.label = label;
51 this.axisTextAnnotations = (annotations != null)
52 ? annotations
53 : Collections.<StickyAxisAnnotation>emptyList();
54 this.boxes = (bAnnotations != null)
55 ? bAnnotations
56 : Collections.<HYKFactory.Zone>emptyList();
57 this.textAnnotations = Collections.<XYTextAnnotation>emptyList();
58 this.setTheme(theme);
59 }
60
61
62 public void setLabel(String label) {
63 this.label = label;
64 }
65
66 public String getLabel() {
67 return label;
68 }
69
70 public List<StickyAxisAnnotation> getAxisTextAnnotations() {
71 return axisTextAnnotations;
72 }
73
74 public void setTextAnnotations(List<XYTextAnnotation> annotations) {
75 this.textAnnotations = annotations;
76 }
77
78 /** Set the "other" Text Annotations. */
79 public List<XYTextAnnotation> getTextAnnotations() {
80 return textAnnotations;
81 }
82
83 public List<HYKFactory.Zone> getBoxes() {
84 return boxes;
85 }
86
87 public void setTheme(Document theme) {
88 this.theme = theme;
89 }
90
91 public Document getTheme() {
92 return theme;
93 }
94
95 /**
96 * Set sticky axis of all axisTextAnnotations
97 * to the X axis if it is currently Y, and vice versa.
98 * @return this
99 */
100 public FLYSAnnotation flipStickyAxis() {
101 for (StickyAxisAnnotation saa: axisTextAnnotations) {
102 saa.flipStickyAxis();
103 }
104 return this;
105 }
106 }
107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org