view artifacts/src/main/java/org/dive4elements/river/jfree/StyledTimeSeries.java @ 9555:ef5754ba5573

Implemented legend aggregation based on type of themes. Added theme-editor style configuration for aggregated legend entries. Only configured themes get aggregated.
author gernotbelger
date Tue, 23 Oct 2018 16:26:48 +0200
parents ddcd52d239cd
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.jfree;

import java.awt.Shape;

import org.dive4elements.river.themes.ThemeDocument;
import org.jfree.chart.LegendItem;
import org.jfree.data.time.TimeSeries;

/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class StyledTimeSeries extends TimeSeries implements StyledSeries {

    private static final long serialVersionUID = 1L;

    private final Style style;

    private final String themeType;

    public StyledTimeSeries(final String themeType, final String key, final ThemeDocument theme) {
        this(themeType, key, theme, null);
    }

    public StyledTimeSeries(final String themeType, final String key, final ThemeDocument theme, final Shape shape) {
        super(key);

        this.style = new XYStyle(theme, shape);
        this.themeType = themeType;
    }

    @Override
    public String getThemeType() {
        return this.themeType;
    }

    @Override
    public Style getStyle() {
        return this.style;
    }

    @Override
    public void applyAggregatedLegendTheme(final LegendItem item, final ThemeDocument theme) {
        this.style.applyAggregatedLegendTheme(item, theme);
    }
}

http://dive4elements.wald.intevation.org