view flys-artifacts/src/main/java/de/intevation/flys/exports/ChartSettings.java @ 1990:5c1e7c1e9e09

Improved the ChartSettings returned by charts - it now contains a legend specific section. flys-artifacts/trunk@3426 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 15 Dec 2011 15:58:56 +0000
parents 3632150dbe0b
children 3e703d134bbe
line wrap: on
line source
package de.intevation.flys.exports;

import de.intevation.artifactdatabase.state.DefaultSection;
import de.intevation.artifactdatabase.state.DefaultSettings;
import de.intevation.artifactdatabase.state.Section;


/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class ChartSettings extends DefaultSettings {

    protected Section chartSection;
    protected Section legendSection;
    protected Section axesSection;


    public ChartSettings() {
        super();

        axesSection = new DefaultSection("axes");
        addSection(axesSection);
    }


    /**
     * Sets the chart section. Old chart sections are removed.
     *
     * @param chartSection A new Section that stores chart specific attributes.
     */
    public void setChartSection(Section chartSection) {
        Section oldChartSection = getChartSection();

        if (oldChartSection != null) {
            removeSection(oldChartSection);
        }

        this.chartSection = chartSection;
        addSection(chartSection);
    }


    /**
     * Returns the Section that stores chart specific attributes.
     *
     * @return the Section that stores chart specific attributes.
     */
    public Section getChartSection() {
        return chartSection;
    }


    /**
     * Sets the legend section. Old legend sections are removed.
     *
     * @param legendSection A new Section that stores legend specific
     * attributes.
     */
    public void setLegendSection(Section legendSection) {
        Section oldLegendSection = getLegendSection();

        if (oldLegendSection != null) {
            removeSection(oldLegendSection);
        }

        this.legendSection = legendSection;
        addSection(legendSection);
    }


    /**
     * Returns the Section that stores legend specific attributes.
     *
     * @return the Section that stores legend specific attributes.
     */
    public Section getLegendSection() {
        return legendSection;
    }


    /**
     * Adds a Section for a new axis of the chart.
     *
     * @param axisSection The Section specific for a chart axis.
     */
    public void addAxisSection(Section axisSection) {
        if (axisSection != null) {
            axesSection.addSubsection(axisSection);
        }
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org