KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > efs > openreports > objects > ReportChart


1 /*
2  * Copyright (C) 2003 Erik Swenson - erik@oreports.com
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */

19
20 package org.efs.openreports.objects;
21
22 import java.io.Serializable JavaDoc;
23
24 public class ReportChart implements Serializable JavaDoc
25 {
26     private static final long serialVersionUID = 7406441909199255551L;
27     
28     public static final int BAR_CHART = 0;
29     public static final int PIE_CHART = 1;
30     public static final int XY_CHART = 2;
31     public static final int TIME_CHART = 3;
32     public static final int RING_CHART = 4;
33     
34     public static final int HORIZONTAL = 1;
35     public static final int VERTICAL = 2;
36     
37     public static final String JavaDoc DRILLDOWN_PARAMETER = "DrillDown";
38     
39     private Integer JavaDoc id;
40     private String JavaDoc name;
41     private String JavaDoc description;
42     private String JavaDoc query;
43     
44     private int chartType;
45     private int width = 400;
46     private int height = 400;
47     
48     private String JavaDoc xAxisLabel;
49     private String JavaDoc yAxisLabel;
50     
51     private boolean showLegend;
52     private boolean showTitle;
53     private boolean showValues;
54     private int plotOrientation;
55
56     private ReportDataSource dataSource;
57     
58     private Report drillDownReport;
59
60     public ReportChart()
61     {
62     }
63
64     public void setId(Integer JavaDoc id)
65     {
66         this.id = id;
67     }
68
69     public String JavaDoc toString()
70     {
71         return name;
72     }
73
74     public String JavaDoc getDescription()
75     {
76         return description;
77     }
78
79     public String JavaDoc getTitle()
80     {
81         if (showTitle) return description;
82         return null;
83     }
84     
85     public Integer JavaDoc getId()
86     {
87         return id;
88     }
89
90     public String JavaDoc getName()
91     {
92         return name;
93     }
94
95     public void setDescription(String JavaDoc description)
96     {
97         this.description = description;
98     }
99
100     public void setName(String JavaDoc name)
101     {
102         this.name = name;
103     }
104
105     public int compareTo(Object JavaDoc object)
106     {
107         ReportChart reportChart = (ReportChart) object;
108         return name.compareTo(reportChart.getName());
109     }
110
111     public ReportDataSource getDataSource()
112     {
113         return dataSource;
114     }
115
116     public void setDataSource(ReportDataSource dataSource)
117     {
118         this.dataSource = dataSource;
119     }
120
121     public String JavaDoc getQuery()
122     {
123         return query;
124     }
125
126     public void setQuery(String JavaDoc query)
127     {
128         this.query = query;
129     }
130
131     public int getChartType()
132     {
133         return chartType;
134     }
135
136     public void setChartType(int chartType)
137     {
138         this.chartType = chartType;
139     }
140
141     public int getHeight()
142     {
143         return height;
144     }
145
146     public void setHeight(int height)
147     {
148         this.height = height;
149     }
150
151     public int getWidth()
152     {
153         return width;
154     }
155
156     public void setWidth(int width)
157     {
158         this.width = width;
159     }
160
161     public String JavaDoc getXAxisLabel()
162     {
163         return xAxisLabel;
164     }
165
166     public void setXAxisLabel(String JavaDoc axisLabel)
167     {
168         xAxisLabel = axisLabel;
169     }
170
171     public String JavaDoc getYAxisLabel()
172     {
173         return yAxisLabel;
174     }
175
176     public void setYAxisLabel(String JavaDoc axisLabel)
177     {
178         yAxisLabel = axisLabel;
179     }
180
181     public boolean isShowLegend()
182     {
183         return showLegend;
184     }
185
186     public void setShowLegend(Boolean JavaDoc showLegend)
187     {
188         if (showLegend == null) showLegend = new Boolean JavaDoc(false);
189         this.showLegend = showLegend.booleanValue();
190     }
191     
192     public boolean isShowTitle()
193     {
194         return showTitle;
195     }
196
197     public void setShowTitle(Boolean JavaDoc showTitle)
198     {
199         if (showTitle == null) showTitle = new Boolean JavaDoc(false);
200         this.showTitle = showTitle.booleanValue();
201     }
202
203     public int getPlotOrientation()
204     {
205         return plotOrientation;
206     }
207
208     public void setPlotOrientation(Integer JavaDoc plotOrientation)
209     {
210         if (plotOrientation == null) plotOrientation = new Integer JavaDoc(VERTICAL);
211         this.plotOrientation = plotOrientation.intValue();
212     }
213
214     public Report getDrillDownReport()
215     {
216         return drillDownReport;
217     }
218
219     public void setDrillDownReport(Report drillDownReport)
220     {
221         this.drillDownReport = drillDownReport;
222     }
223
224     public boolean isShowValues()
225     {
226         return showValues;
227     }
228
229     public void setShowValues(Boolean JavaDoc showValues)
230     {
231         if (showValues == null) showValues = new Boolean JavaDoc(false);
232         this.showValues = showValues.booleanValue();
233     }
234 }
Popular Tags