teichmann@5831: package org.dive4elements.river.jfree; ingo@1677: teichmann@5831: import org.dive4elements.river.artifacts.model.HYKFactory; christian@4044: felix@2138: import java.util.Collections; ingo@1677: import java.util.List; ingo@1677: christian@4044: import org.jfree.chart.annotations.XYTextAnnotation; ingo@1679: import org.w3c.dom.Document; ingo@1679: felix@1721: /** felix@4277: * List of Text- Annotations (Sticky to one axis or in space) felix@4277: * and 'HYK'-Annotations (rectangles/areas) with name and theme. felix@1721: */ ingo@1677: public class FLYSAnnotation { ingo@1677: christian@4044: /** 'Other' Text Annotations. */ felix@2138: protected List textAnnotations; felix@2138: felix@2183: /** Annotations at axis. */ felix@2161: protected List axisTextAnnotations; felix@2161: felix@2183: /** Areas at axis. */ felix@2138: protected List boxes; ingo@1679: felix@2183: /** Styling information. */ ingo@1679: protected Document theme; ingo@1677: felix@2183: /** Chart-legend information. */ ingo@1677: protected String label; ingo@1677: ingo@1677: felix@2161: public FLYSAnnotation(String label, List annotations) { felix@2152: this(label, annotations, null, null); felix@2152: } felix@2152: felix@2152: felix@2138: /** Create annotations, parameter might be null. */ felix@2161: public FLYSAnnotation(String label, List annotations, felix@2138: List bAnnotations felix@2138: ) { felix@2152: this(label, annotations, bAnnotations, null); felix@2152: } felix@2152: felix@2152: felix@2152: /** Create annotations, parameter might be null. */ felix@2161: public FLYSAnnotation(String label, List annotations, felix@2152: List bAnnotations, Document theme felix@2152: ) { felix@4277: this.label = label; felix@2161: this.axisTextAnnotations = (annotations != null) felix@4277: ? annotations felix@4277: : Collections.emptyList(); felix@4277: this.boxes = (bAnnotations != null) felix@4277: ? bAnnotations felix@4277: : Collections.emptyList(); felix@2161: this.textAnnotations = Collections.emptyList(); felix@2152: this.setTheme(theme); felix@2138: } felix@2138: ingo@1677: ingo@1712: public void setLabel(String label) { ingo@1712: this.label = label; ingo@1712: } ingo@1712: ingo@1677: public String getLabel() { ingo@1677: return label; ingo@1677: } ingo@1677: felix@2161: public List getAxisTextAnnotations() { felix@2161: return axisTextAnnotations; felix@2161: } felix@2161: felix@2183: public void setTextAnnotations(List annotations) { felix@2183: this.textAnnotations = annotations; felix@2183: } felix@2183: felix@2183: /** Set the "other" Text Annotations. */ felix@2138: public List getTextAnnotations() { felix@2138: return textAnnotations; felix@2138: } felix@2138: felix@2138: public List getBoxes() { felix@2138: return boxes; ingo@1677: } ingo@1679: ingo@1679: public void setTheme(Document theme) { ingo@1679: this.theme = theme; ingo@1679: } ingo@1679: ingo@1679: public Document getTheme() { ingo@1679: return theme; ingo@1679: } felix@2768: felix@2768: /** felix@2768: * Set sticky axis of all axisTextAnnotations felix@2768: * to the X axis if it is currently Y, and vice versa. felix@2768: * @return this felix@2768: */ felix@2768: public FLYSAnnotation flipStickyAxis() { felix@2768: for (StickyAxisAnnotation saa: axisTextAnnotations) { felix@2768: saa.flipStickyAxis(); felix@2768: } felix@2768: return this; felix@2768: } ingo@1677: } ingo@1677: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :