java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CombinedChartDefinition.java
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CombinedChartDefinition.java Sat Feb 28 21:31:02 2009 +0100
1.3 @@ -0,0 +1,43 @@
1.4 +package de.laures.cewolf.taglib;
1.5 +
1.6 +import java.io.Serializable;
1.7 +import java.util.ArrayList;
1.8 +import java.util.List;
1.9 +
1.10 +import org.jfree.chart.JFreeChart;
1.11 +import org.jfree.chart.plot.DefaultDrawingSupplier;
1.12 +import org.jfree.chart.plot.DrawingSupplier;
1.13 +
1.14 +import de.laures.cewolf.ChartValidationException;
1.15 +import de.laures.cewolf.DatasetProduceException;
1.16 +
1.17 +/**
1.18 + * Chart definition subclass to handle combined charts
1.19 + *
1.20 + * @author guido
1.21 + * @author tbardzil
1.22 + */
1.23 +public class CombinedChartDefinition extends AbstractChartDefinition implements Serializable {
1.24 + private String layout;
1.25 +
1.26 + private List plotDefinitions = new ArrayList();
1.27 + private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier();
1.28 +
1.29 + public void setLayout(String layout) {
1.30 + this.layout = layout;
1.31 + }
1.32 +
1.33 + public Object getDataset() throws DatasetProduceException {
1.34 + return ((PlotDefinition)plotDefinitions.get(0)).getDataset();
1.35 + }
1.36 +
1.37 + public void addPlot(PlotDefinition pd) {
1.38 + pd.setDrawingSupplier(drawingSupplier);
1.39 + plotDefinitions.add(pd);
1.40 + }
1.41 +
1.42 + protected JFreeChart produceChart() throws DatasetProduceException, ChartValidationException {
1.43 + return CewolfChartFactory.getCombinedChartInstance(type, title, xAxisLabel, yAxisLabel, plotDefinitions, layout);
1.44 + }
1.45 +
1.46 +}