java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CombinedChartDefinition.java
author František Kučera <franta-hg@frantovo.cz>
Sat, 28 Feb 2009 21:31:02 +0100
changeset 1 639991d0808a
permissions -rw-r--r--
Rozbalená knihovna verze 1.0
     1 package de.laures.cewolf.taglib;
     2 
     3 import java.io.Serializable;
     4 import java.util.ArrayList;
     5 import java.util.List;
     6 
     7 import org.jfree.chart.JFreeChart;
     8 import org.jfree.chart.plot.DefaultDrawingSupplier;
     9 import org.jfree.chart.plot.DrawingSupplier;
    10 
    11 import de.laures.cewolf.ChartValidationException;
    12 import de.laures.cewolf.DatasetProduceException;
    13 
    14 /**
    15  * Chart definition subclass to handle combined charts
    16  *
    17  * @author guido
    18  * @author tbardzil
    19  */
    20 public class CombinedChartDefinition extends AbstractChartDefinition implements Serializable {
    21     private String layout;
    22 
    23     private List plotDefinitions = new ArrayList();
    24     private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier();
    25 
    26     public void setLayout(String layout) {
    27         this.layout = layout;
    28     }
    29 
    30     public Object getDataset() throws DatasetProduceException {
    31         return ((PlotDefinition)plotDefinitions.get(0)).getDataset();
    32     }
    33 
    34     public void addPlot(PlotDefinition pd) {
    35         pd.setDrawingSupplier(drawingSupplier);
    36         plotDefinitions.add(pd);
    37     }
    38 
    39     protected JFreeChart produceChart() throws DatasetProduceException, ChartValidationException {
    40         return CewolfChartFactory.getCombinedChartInstance(type, title, xAxisLabel, yAxisLabel, plotDefinitions, layout);
    41     }
    42 
    43 }