114 lines
3.8 KiB
Java
114 lines
3.8 KiB
Java
package net.sf.jasperreports.charts.design;
|
|
|
|
import java.awt.Color;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import net.sf.jasperreports.charts.JRDataRange;
|
|
import net.sf.jasperreports.charts.JRValueDisplay;
|
|
import net.sf.jasperreports.charts.base.JRBaseMeterPlot;
|
|
import net.sf.jasperreports.charts.util.JRMeterInterval;
|
|
import net.sf.jasperreports.engine.JRChart;
|
|
import net.sf.jasperreports.engine.JRChartPlot;
|
|
import net.sf.jasperreports.engine.JRException;
|
|
|
|
public class JRDesignMeterPlot extends JRBaseMeterPlot {
|
|
private static final long serialVersionUID = 10200L;
|
|
|
|
public static final String PROPERTY_DATA_RANGE = "dataRange";
|
|
|
|
public static final String PROPERTY_METER_ANGLE = "meterAngle";
|
|
|
|
public static final String PROPERTY_METER_BACKGROUND_COLOR = "meterBackgroundColor";
|
|
|
|
public static final String PROPERTY_NEEDLE_COLOR = "needleColor";
|
|
|
|
public static final String PROPERTY_SHAPE = "shape";
|
|
|
|
public static final String PROPERTY_TICK_COLOR = "tickColor";
|
|
|
|
public static final String PROPERTY_TICK_INTERVAL = "tickInterval";
|
|
|
|
public static final String PROPERTY_UNITS = "units";
|
|
|
|
public static final String PROPERTY_VALUE_DISPLAY = "valueDisplay";
|
|
|
|
public static final String PROPERTY_INTERVALS = "intervals";
|
|
|
|
public JRDesignMeterPlot(JRChartPlot meterPlot, JRChart chart) {
|
|
super(meterPlot, chart);
|
|
}
|
|
|
|
public void setDataRange(JRDataRange dataRange) throws JRException {
|
|
Object old = this.dataRange;
|
|
this.dataRange = dataRange;
|
|
getEventSupport().firePropertyChange("dataRange", old, this.dataRange);
|
|
}
|
|
|
|
public void setValueDisplay(JRValueDisplay valueDisplay) {
|
|
Object old = this.valueDisplay;
|
|
this.valueDisplay = valueDisplay;
|
|
getEventSupport().firePropertyChange("valueDisplay", old, this.valueDisplay);
|
|
}
|
|
|
|
public void setShape(byte shape) throws JRException {
|
|
if (shape < 0 || shape > 2)
|
|
throw new JRException("Unknown shape for MeterPlot");
|
|
byte old = this.shape;
|
|
this.shape = shape;
|
|
getEventSupport().firePropertyChange("shape", old, this.shape);
|
|
}
|
|
|
|
public void addInterval(JRMeterInterval interval) {
|
|
this.intervals.add(interval);
|
|
getEventSupport().fireCollectionElementAddedEvent("intervals", interval, this.intervals.size() - 1);
|
|
}
|
|
|
|
public void clearIntervals() {
|
|
setIntervals((Collection)null);
|
|
}
|
|
|
|
public void setIntervals(Collection intervals) {
|
|
Object old = new ArrayList(this.intervals);
|
|
this.intervals.clear();
|
|
if (intervals != null)
|
|
this.intervals.addAll(intervals);
|
|
getEventSupport().firePropertyChange("intervals", old, this.intervals);
|
|
}
|
|
|
|
public void setMeterAngle(int meterAngle) {
|
|
int old = this.meterAngle;
|
|
this.meterAngle = meterAngle;
|
|
getEventSupport().firePropertyChange("meterAngle", old, this.meterAngle);
|
|
}
|
|
|
|
public void setUnits(String units) {
|
|
Object old = this.units;
|
|
this.units = units;
|
|
getEventSupport().firePropertyChange("units", old, this.units);
|
|
}
|
|
|
|
public void setTickInterval(double tickInterval) {
|
|
double old = this.tickInterval;
|
|
this.tickInterval = tickInterval;
|
|
getEventSupport().firePropertyChange("tickInterval", old, this.tickInterval);
|
|
}
|
|
|
|
public void setMeterBackgroundColor(Color meterBackgroundColor) {
|
|
Object old = this.meterBackgroundColor;
|
|
this.meterBackgroundColor = meterBackgroundColor;
|
|
getEventSupport().firePropertyChange("meterBackgroundColor", old, this.meterBackgroundColor);
|
|
}
|
|
|
|
public void setNeedleColor(Color needleColor) {
|
|
Object old = this.needleColor;
|
|
this.needleColor = needleColor;
|
|
getEventSupport().firePropertyChange("needleColor", old, this.needleColor);
|
|
}
|
|
|
|
public void setTickColor(Color tickColor) {
|
|
Object old = this.tickColor;
|
|
this.tickColor = tickColor;
|
|
getEventSupport().firePropertyChange("tickColor", old, this.tickColor);
|
|
}
|
|
}
|