ingo@1677: package de.intevation.flys.jfree;
ingo@1677: 
christian@4044: import de.intevation.flys.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@2138:  * List of Text- Annotations with name and theme.
felix@1721:  */
ingo@1677: public class FLYSAnnotation {
ingo@1677: 
christian@4044:     /** 'Other' Text Annotations. */
felix@2138:     protected List<XYTextAnnotation> textAnnotations;
felix@2138: 
felix@2183:     /** Annotations at axis. */
felix@2161:     protected List<StickyAxisAnnotation> axisTextAnnotations;
felix@2161: 
felix@2183:     /** Areas at axis. */
felix@2138:     protected List<HYKFactory.Zone> 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<StickyAxisAnnotation> 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<StickyAxisAnnotation> annotations,
felix@2138:         List<HYKFactory.Zone> 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<StickyAxisAnnotation> annotations,
felix@2152:         List<HYKFactory.Zone> bAnnotations, Document theme
felix@2152:     ) {
felix@2138:         this.label           = label;
felix@2161:         this.axisTextAnnotations = (annotations != null)
felix@2138:                                ? annotations
felix@2161:                                : Collections.<StickyAxisAnnotation>emptyList();
felix@2138:         this.boxes  = (bAnnotations != null)
felix@2138:                                ? bAnnotations
felix@2138:                                : Collections.<HYKFactory.Zone>emptyList();
felix@2161:         this.textAnnotations = Collections.<XYTextAnnotation>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<StickyAxisAnnotation> getAxisTextAnnotations() {
felix@2161:         return axisTextAnnotations;
felix@2161:     }
felix@2161: 
felix@2183:     public void setTextAnnotations(List<XYTextAnnotation> annotations) {
felix@2183:         this.textAnnotations = annotations;
felix@2183:     }
felix@2183: 
felix@2183:     /** Set the "other" Text Annotations. */
felix@2138:     public List<XYTextAnnotation> getTextAnnotations() {
felix@2138:         return textAnnotations;
felix@2138:     }
felix@2138: 
felix@2138:     public List<HYKFactory.Zone> 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 :