1 28 package net.sf.jasperreports.charts.design; 29 30 import java.util.ArrayList ; 31 import java.util.List ; 32 33 import net.sf.jasperreports.charts.JRTimeSeries; 34 import net.sf.jasperreports.charts.JRTimeSeriesDataset; 35 import net.sf.jasperreports.engine.JRChartDataset; 36 import net.sf.jasperreports.engine.JRConstants; 37 import net.sf.jasperreports.engine.JRExpressionCollector; 38 import net.sf.jasperreports.engine.design.JRDesignChartDataset; 39 import net.sf.jasperreports.engine.design.JRVerifier; 40 41 45 public class JRDesignTimeSeriesDataset extends JRDesignChartDataset implements JRTimeSeriesDataset { 46 47 50 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 51 52 private List timeSeriesList = new ArrayList (); 53 private Class timePeriod = null; 54 55 56 59 public JRDesignTimeSeriesDataset( JRChartDataset dataset ) 60 { 61 super( dataset ); 62 } 63 64 67 public JRTimeSeries[] getSeries() 68 { 69 JRTimeSeries[] timeSeriesArray = new JRTimeSeries[ timeSeriesList.size() ]; 70 timeSeriesList.toArray( timeSeriesArray ); 71 72 return timeSeriesArray; 73 } 74 75 78 public List getSeriesList() 79 { 80 return timeSeriesList; 81 } 82 83 86 public void addTimeSeries( JRTimeSeries timeSeries ) 87 { 88 timeSeriesList.add( timeSeries ); 89 } 90 91 94 public JRTimeSeries removeTimeSeries( JRTimeSeries timeSeries ) 95 { 96 if( timeSeries != null && timeSeriesList.contains( timeSeries )) 97 { 98 timeSeriesList.remove( timeSeries ); 99 } 100 101 return timeSeries; 102 } 103 104 107 public Class getTimePeriod() 108 { 109 return timePeriod; 110 } 111 112 115 public void setTimePeriod( Class timePeriod ) 116 { 117 this.timePeriod = timePeriod; 118 } 119 120 123 public byte getDatasetType() 124 { 125 return JRChartDataset.TIMESERIES_DATASET; 126 } 127 128 131 public void collectExpressions(JRExpressionCollector collector) 132 { 133 collector.collect(this); 134 } 135 136 137 public void validate(JRVerifier verifier) 138 { 139 verifier.verify(this); 140 } 141 142 } 143 | Popular Tags |