1 28 package net.sf.jasperreports.charts.base; 29 30 import net.sf.jasperreports.charts.JRDataRange; 31 import net.sf.jasperreports.charts.JRMeterPlot; 32 import net.sf.jasperreports.charts.JRValueDisplay; 33 import net.sf.jasperreports.charts.base.JRBaseDataRange; 34 import net.sf.jasperreports.charts.util.JRMeterInterval; 35 import net.sf.jasperreports.charts.base.JRBaseValueDisplay; 36 import net.sf.jasperreports.engine.JRChartPlot; 37 import net.sf.jasperreports.engine.JRConstants; 38 import net.sf.jasperreports.engine.JRExpressionCollector; 39 import net.sf.jasperreports.engine.base.JRBaseChartPlot; 40 import net.sf.jasperreports.engine.base.JRBaseObjectFactory; 41 42 import java.awt.Color ; 43 import java.util.Iterator ; 44 import java.util.List ; 45 46 52 public class JRBaseMeterPlot extends JRBaseChartPlot implements JRMeterPlot 53 { 54 55 56 59 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 60 61 64 protected JRDataRange dataRange = null; 65 66 69 protected JRValueDisplay valueDisplay = null; 70 71 75 protected byte shape = JRMeterPlot.SHAPE_PIE; 76 77 81 protected List intervals = new java.util.ArrayList (); 82 83 87 protected int meterAngle = 180; 88 89 93 protected String units = null; 94 95 100 protected double tickInterval = 10.0; 101 102 105 protected Color meterBackgroundColor = null; 106 107 110 protected Color needleColor = null; 111 112 115 protected Color tickColor = null; 116 117 118 119 124 public JRBaseMeterPlot(JRChartPlot meterPlot) 125 { 126 super(meterPlot); 127 } 128 129 136 public JRBaseMeterPlot(JRMeterPlot meterPlot, JRBaseObjectFactory factory) 137 { 138 super(meterPlot, factory); 139 140 dataRange = new JRBaseDataRange(meterPlot.getDataRange(), factory); 141 valueDisplay = new JRBaseValueDisplay(meterPlot.getValueDisplay(), factory); 142 shape = meterPlot.getShape(); 143 List origIntervals = meterPlot.getIntervals(); 144 intervals.clear(); 145 if (origIntervals != null) 146 { 147 Iterator iter = origIntervals.iterator(); 148 while (iter.hasNext()) 149 { 150 JRMeterInterval interval = (JRMeterInterval)iter.next(); 151 intervals.add(new JRMeterInterval(interval, factory)); 152 } 153 } 154 155 meterAngle = meterPlot.getMeterAngle(); 156 units = meterPlot.getUnits(); 157 tickInterval = meterPlot.getTickInterval(); 158 159 meterBackgroundColor = meterPlot.getMeterBackgroundColor(); 160 needleColor = meterPlot.getNeedleColor(); 161 tickColor = meterPlot.getTickColor(); 162 } 163 164 165 166 169 public JRDataRange getDataRange() 170 { 171 return dataRange; 172 } 173 174 177 public JRValueDisplay getValueDisplay() 178 { 179 return valueDisplay; 180 } 181 182 185 public byte getShape() 186 { 187 return shape; 188 } 189 190 193 public List getIntervals(){ 194 return intervals; 195 } 196 197 200 public int getMeterAngle() 201 { 202 return meterAngle; 203 } 204 205 208 public String getUnits() 209 { 210 return units; 211 } 212 213 216 public double getTickInterval() 217 { 218 return tickInterval; 219 } 220 221 224 public Color getMeterBackgroundColor() 225 { 226 return meterBackgroundColor; 227 } 228 229 232 public Color getNeedleColor() 233 { 234 return needleColor; 235 } 236 237 240 public Color getTickColor() 241 { 242 return tickColor; 243 } 244 245 252 public void collectExpressions(JRExpressionCollector collector) 253 { 254 collector.collect(this); 255 } 256 257 } 258 | Popular Tags |