Mercurial > dive4elements > river
diff 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 diff
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledTimeSeries.java Mon Oct 22 18:26:05 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledTimeSeries.java Tue Oct 23 16:26:48 2018 +0200 @@ -11,7 +11,7 @@ import java.awt.Shape; import org.dive4elements.river.themes.ThemeDocument; - +import org.jfree.chart.LegendItem; import org.jfree.data.time.TimeSeries; /** @@ -19,25 +19,35 @@ */ public class StyledTimeSeries extends TimeSeries implements StyledSeries { - private Style style; + private static final long serialVersionUID = 1L; - public StyledTimeSeries(String key, ThemeDocument theme) { + 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); - setStyle(new XYStyle(theme)); - } - - public StyledTimeSeries(String key, ThemeDocument theme, Shape shape) { - super(key); - setStyle(new XYStyle(theme, shape)); + + this.style = new XYStyle(theme, shape); + this.themeType = themeType; } @Override - public void setStyle(Style style) { - this.style = style; + public String getThemeType() { + return this.themeType; } @Override public Style getStyle() { - return style; + return this.style; + } + + @Override + public void applyAggregatedLegendTheme(final LegendItem item, final ThemeDocument theme) { + this.style.applyAggregatedLegendTheme(item, theme); } } \ No newline at end of file