001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * MeterPlot.java
028: *
029: * Created on 16 agosto 2005, 10.19
030: *
031: */
032:
033: package it.businesslogic.ireport.chart;
034:
035: import java.awt.Color;
036:
037: /**
038: *
039: * @author Administrator
040: */
041: public class MeterPlot extends Plot {
042:
043: private String shape = "pie";
044: private int angle = 180;
045: private String units = "";
046: private double tickInterval = 10.0;
047: private java.awt.Color meterColor = null;
048: private java.awt.Color needleColor = null;
049: private java.awt.Color tickColor = null;
050:
051: private java.util.List meterIntervals = new java.util.ArrayList();
052:
053: private ValueDisplay valueDisplay = new ValueDisplay();
054:
055: private DataRange dataRange = new DataRange();
056:
057: /** Creates a new instance of PiePlot */
058: public MeterPlot() {
059: }
060:
061: public Plot cloneMe() {
062: MeterPlot obj = new MeterPlot();
063: copyBasePlot(obj);
064: obj.setShape(new String(getShape()));
065: obj.setAngle(getAngle());
066: obj.setUnits(new String(getUnits()));
067: obj.setTickInterval(getTickInterval());
068: if (getTickColor() != null)
069: obj.setTickColor(new Color(getTickColor().getRGB()));
070: if (getNeedleColor() != null)
071: obj.setNeedleColor(new Color(getNeedleColor().getRGB()));
072: if (getMeterColor() != null)
073: obj.setMeterColor(new Color(getMeterColor().getRGB()));
074: obj.setValueDisplay(getValueDisplay().cloneMe());
075: obj.setDataRange(getDataRange().cloneMe());
076:
077: for (int i = 0; i < getMeterIntervals().size(); ++i) {
078: obj.getMeterIntervals().add(
079: ((MeterInterval) getMeterIntervals().get(i))
080: .cloneMe());
081: }
082:
083: return obj;
084: }
085:
086: public String getShape() {
087: return shape;
088: }
089:
090: public void setShape(String shape) {
091: this .shape = shape;
092: }
093:
094: public int getAngle() {
095: return angle;
096: }
097:
098: public void setAngle(int angle) {
099: this .angle = angle;
100: }
101:
102: public String getUnits() {
103: return units;
104: }
105:
106: public void setUnits(String units) {
107: this .units = units;
108: }
109:
110: public double getTickInterval() {
111: return tickInterval;
112: }
113:
114: public void setTickInterval(double tickInterval) {
115: this .tickInterval = tickInterval;
116: }
117:
118: public java.awt.Color getMeterColor() {
119: return meterColor;
120: }
121:
122: public void setMeterColor(java.awt.Color meterColor) {
123: this .meterColor = meterColor;
124: }
125:
126: public java.awt.Color getNeedleColor() {
127: return needleColor;
128: }
129:
130: public void setNeedleColor(java.awt.Color needleColor) {
131: this .needleColor = needleColor;
132: }
133:
134: public java.awt.Color getTickColor() {
135: return tickColor;
136: }
137:
138: public void setTickColor(java.awt.Color tickColor) {
139: this .tickColor = tickColor;
140: }
141:
142: public ValueDisplay getValueDisplay() {
143: return valueDisplay;
144: }
145:
146: public void setValueDisplay(ValueDisplay valueDisplay) {
147: this .valueDisplay = valueDisplay;
148: }
149:
150: public java.util.List getMeterIntervals() {
151: return meterIntervals;
152: }
153:
154: public void setMeterIntervals(java.util.List meterIntervals) {
155: this .meterIntervals = meterIntervals;
156: }
157:
158: public DataRange getDataRange() {
159: return dataRange;
160: }
161:
162: public void setDataRange(DataRange dataRange) {
163: this.dataRange = dataRange;
164: }
165:
166: }
|