view flys-artifacts/src/main/java/de/intevation/flys/jfree/FLYSAnnotation.java @ 3630:28be160b5870

Add a module service. It's now possible to configure the modules which are available for a client. With the selected attribute it is possible to give a hint for the client which module should be pre selected by default flys-artifacts/trunk@5330 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 31 Aug 2012 13:17:16 +0000
parents 0f7abd95c6e2
children 7eebd9e58641
line wrap: on
line source
package de.intevation.flys.jfree;

import java.util.Collections;
import java.util.List;

import org.w3c.dom.Document;

import org.jfree.chart.annotations.XYTextAnnotation;

import de.intevation.flys.artifacts.model.HYKFactory;

/**
 * List of Text- Annotations with name and theme.
 */
public class FLYSAnnotation {

    /* 'Other' Text Annotations. */
    protected List<XYTextAnnotation> textAnnotations;

    /** Annotations at axis. */
    protected List<StickyAxisAnnotation> axisTextAnnotations;

    /** Areas at axis. */
    protected List<HYKFactory.Zone> boxes;

    /** Styling information. */
    protected Document theme;

    /** Chart-legend information. */
    protected String label;


    public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations) {
        this(label, annotations, null, null);
    }


    /** Create annotations, parameter might be null. */
    public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
        List<HYKFactory.Zone> bAnnotations
    ) {
        this(label, annotations, bAnnotations, null);
    }


    /** Create annotations, parameter might be null. */
    public FLYSAnnotation(String label, List<StickyAxisAnnotation> annotations,
        List<HYKFactory.Zone> bAnnotations, Document theme
    ) {
        this.label           = label;
        this.axisTextAnnotations = (annotations != null)
                               ? annotations
                               : Collections.<StickyAxisAnnotation>emptyList();
        this.boxes  = (bAnnotations != null)
                               ? bAnnotations
                               : Collections.<HYKFactory.Zone>emptyList();
        this.textAnnotations = Collections.<XYTextAnnotation>emptyList();
        this.setTheme(theme);
    }


    public void setLabel(String label) {
        this.label = label;
    }

    public String getLabel() {
        return label;
    }

    public List<StickyAxisAnnotation> getAxisTextAnnotations() {
        return axisTextAnnotations;
    }

    public void setTextAnnotations(List<XYTextAnnotation> annotations) {
        this.textAnnotations = annotations;
    }

    /** Set the "other" Text Annotations. */
    public List<XYTextAnnotation> getTextAnnotations() {
        return textAnnotations;
    }

    public List<HYKFactory.Zone> getBoxes() {
        return boxes;
    }

    public void setTheme(Document theme) {
        this.theme = theme;
    }

    public Document getTheme() {
        return theme;
    }

    /**
     * Set sticky axis of all axisTextAnnotations
     * to the X axis if it is currently Y, and vice versa.
     * @return this
     */
    public FLYSAnnotation flipStickyAxis() {
        for (StickyAxisAnnotation saa: axisTextAnnotations) {
            saa.flipStickyAxis();
        }
        return this;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org