KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > krysalis > jcharts > properties > AxisTypeProperties


1 /***********************************************************************************************
2  * File Info: $Id: AxisTypeProperties.java,v 1.2 2003/08/27 04:37:44 kiwicmc Exp $
3  * Copyright (C) 2002
4  * Author: Nathaniel G. Auvil
5  * Contributor(s): John Thomson
6  *
7  * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
8  *
9  * Redistribution and use of this software and associated documentation ("Software"), with or
10  * without modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain copyright statements and notices.
13  * Redistributions must also contain a copy of this document.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
16  * conditions and the following disclaimer in the documentation and/or other materials
17  * provided with the distribution.
18  *
19  * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote
20  * products derived from this Software without prior written permission of Nathaniel G.
21  * Auvil. For written permission, please contact nathaniel_auvil@users.sourceforge.net
22  *
23  * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear
24  * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a
25  * registered trademark of Nathaniel G. Auvil.
26  *
27  * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/).
28  *
29  * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY
30  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT
36  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
37  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
38  ************************************************************************************************/

39
40
41 package org.krysalis.jcharts.properties;
42
43
44 import org.krysalis.jcharts.properties.util.ChartFont;
45 import org.krysalis.jcharts.properties.util.ChartStroke;
46 import org.krysalis.jcharts.test.HTMLGenerator;
47 import org.krysalis.jcharts.test.HTMLTestable;
48
49 import java.lang.reflect.Field JavaDoc;
50
51
52 public class AxisTypeProperties extends Properties implements HTMLTestable
53 {
54     public static final int TICKS_NONE = 0;
55     public static final int TICKS_ALL = 1;
56     public static final int TICKS_ONLY_WITH_LABELS = 2;
57
58     public static final int GRID_LINES_NONE = 0;
59     public static final int GRID_LINES_ALL = 1;
60     public static final int GRID_LINES_ONLY_WITH_LABELS = 2;
61
62
63     private int showTicks = TICKS_ALL;
64     private ChartStroke tickChartStroke= ChartStroke.DEFAULT_TICKS;
65
66     private int showGridLines = GRID_LINES_NONE;
67     private ChartStroke gridLineChartStroke= ChartStroke.DEFAULT_GRIDLINES;
68
69     private ChartFont scaleChartFont = ChartFont.DEFAULT_AXIS_SCALE;
70     private ChartFont axisTitleChartFont= ChartFont.DEFAULT_AXIS_TITLE;
71
72     private ChartStroke axisStroke = ChartStroke.DEFAULT_AXIS;
73
74
75     private float paddingBetweenAxisTitleAndLabels = 25.0f;
76     private float axisTickMarkPixelLength = 3.0f;
77
78     //---number of pixels between axis values and tick marks.
79
private float paddingBetweenLabelsAndTicks = 3.0f;
80
81     //---number of pixels between axis values and the axis if no ticks are shown.
82
private float paddingBetweenAxisAndLabels = 3.0f;
83
84     //---number of pixels between axis values.
85
private float paddingBetweenAxisLabels = 5.0f;
86
87
88     private boolean showEndBorder = true;
89    private boolean showAxisLabels= true;
90
91         // Dual Y axis changes integrated CMC 25Aug03
92
//variable added for the right axis
93
//the method corresponding are so implemented
94
private ChartFont scaleChartFontRight = ChartFont.DEFAULT_AXIS_SCALE;
95         private boolean showRightAxis = false;
96         private float secondScaleRight=1;
97         private double minRightAxis = 0;
98         private double maxRightAxis = 0;
99
100     private ChartFont titleChartFont= ChartFont.DEFAULT_AXIS_TITLE;
101
102
103     /***********************************************************************************************
104      *
105      ************************************************************************************************/

106     public AxisTypeProperties()
107     {
108         super();
109     }
110
111
112     public ChartFont getTitleChartFont()
113     {
114         return titleChartFont;
115     }
116
117
118     public void setTitleChartFont( ChartFont titleChartFont )
119     {
120         this.titleChartFont = titleChartFont;
121     }
122
123
124     public boolean showAxisLabels()
125     {
126         return showAxisLabels;
127     }
128
129
130     public void setShowAxisLabels( boolean showAxisLabels )
131     {
132         this.showAxisLabels = showAxisLabels;
133     }
134
135
136     public int getShowTicks()
137     {
138         return showTicks;
139     }
140
141
142     public void setShowTicks( int showTicks )
143     {
144         this.showTicks = showTicks;
145     }
146
147
148     public ChartStroke getTickChartStroke()
149     {
150         return this.tickChartStroke;
151     }
152
153
154     public void setTickChartStroke( ChartStroke tickChartStroke )
155     {
156         this.tickChartStroke = tickChartStroke;
157     }
158
159
160     public int getShowGridLines()
161     {
162         return showGridLines;
163     }
164
165
166     public void setShowGridLines( int showGridLines )
167     {
168         this.showGridLines = showGridLines;
169     }
170
171
172     public ChartStroke getGridLineChartStroke()
173     {
174         return this.gridLineChartStroke;
175     }
176
177
178     public void setGridLineChartStroke( ChartStroke gridLineChartStroke )
179     {
180         this.gridLineChartStroke = gridLineChartStroke;
181     }
182
183
184     public float getPaddingBetweenAxisTitleAndLabels()
185     {
186         return paddingBetweenAxisTitleAndLabels;
187     }
188
189
190     public void setPaddingBetweenAxisTitleAndLabels( float paddingBetweenAxisTitleAndLabels )
191     {
192         this.paddingBetweenAxisTitleAndLabels = paddingBetweenAxisTitleAndLabels;
193     }
194
195
196     public float getAxisTickMarkPixelLength()
197     {
198         return axisTickMarkPixelLength;
199     }
200
201
202     public void setAxisTickMarkPixelLength( float axisTickMarkPixelLength )
203     {
204         this.axisTickMarkPixelLength = axisTickMarkPixelLength;
205     }
206
207
208     public float getPaddingBetweenLabelsAndTicks()
209     {
210         return paddingBetweenLabelsAndTicks;
211     }
212
213
214     public void setPaddingBetweenLabelsAndTicks( float paddingBetweenLabelsAndTicks )
215     {
216         this.paddingBetweenLabelsAndTicks = paddingBetweenLabelsAndTicks;
217     }
218
219
220     public float getPaddingBetweenAxisAndLabels()
221     {
222         return paddingBetweenAxisAndLabels;
223     }
224
225
226     public void setPaddingBetweenAxisAndLabels( float paddingBetweenAxisAndLabels )
227     {
228         this.paddingBetweenAxisAndLabels = paddingBetweenAxisAndLabels;
229     }
230
231
232     public ChartStroke getAxisStroke()
233     {
234         return axisStroke;
235     }
236
237
238     public void setAxisStroke( ChartStroke axisStroke )
239     {
240         this.axisStroke = axisStroke;
241     }
242
243
244     public ChartFont getScaleChartFont()
245     {
246         return scaleChartFont;
247     }
248
249
250     public void setScaleChartFont( ChartFont scaleChartFont )
251     {
252         this.scaleChartFont = scaleChartFont;
253     }
254
255         // Dual Y axis changes integrated CMC 25Aug03
256
public ChartFont getScaleChartFontRight()
257     {
258         return scaleChartFontRight;
259     }
260
261
262     public void setScaleChartFontRight( ChartFont scaleChartFontRight )
263     {
264         this.scaleChartFontRight = scaleChartFontRight;
265     }
266
267     public ChartFont getAxisTitleChartFont()
268     {
269         return axisTitleChartFont;
270     }
271
272
273     public void setAxisTitleChartFont( ChartFont axisTitleChartFont )
274     {
275         this.axisTitleChartFont = axisTitleChartFont;
276     }
277
278
279     public boolean getShowEndBorder()
280     {
281         return this.showEndBorder;
282     }
283
284
285     public void setShowEndBorder( boolean showEndBorder )
286     {
287         this.showEndBorder = showEndBorder;
288     }
289
290
291         // Dual Y axis changes integrated CMC 25Aug03
292
public boolean getShowRightAxis()
293     {
294         return this.showRightAxis;
295     }
296
297
298     public void setShowRightAxis( boolean showRightAxis )
299     {
300         this.showRightAxis = showRightAxis;
301     }
302
303
304         public float getSecondScaleRight()
305         {
306                 return this.secondScaleRight;
307         }
308
309
310         public void setSecondScaleRight(float secondScaleRight)
311         {
312                 this.secondScaleRight=secondScaleRight;
313         }
314
315         public double getMinRightAxis()
316         {
317                 return this.minRightAxis;
318         }
319
320         
321         public void setMinRightAxis(double minRightAxis)
322         {
323                 this.minRightAxis=minRightAxis;
324         }
325
326
327         public double getMaxRightAxis()
328         {
329                 return this.maxRightAxis;
330         }
331
332
333         public void setMaxRightAxis(double maxRightAxis)
334         {
335                 this.maxRightAxis=maxRightAxis;
336         }
337
338         
339         public float getPaddingBetweenAxisLabels()
340     {
341         return this.paddingBetweenAxisLabels;
342     }
343
344
345     public void setPaddingBetweenXAxisLabels( float paddingBetweenAxisLabels )
346     {
347         this.paddingBetweenAxisLabels = paddingBetweenAxisLabels;
348     }
349
350
351     /*********************************************************************************************
352      * Enables the testing routines to display the contents of this Object.
353      *
354      * @param htmlGenerator
355      **********************************************************************************************/

356     public void toHTML( HTMLGenerator htmlGenerator )
357     {
358         htmlGenerator.propertiesTableStart( AxisTypeProperties.class.getName() );
359
360         super.toHTML( htmlGenerator );
361
362         Field JavaDoc[] fields = this.getClass().getDeclaredFields();
363         for( int i = 0; i < fields.length; i++ )
364         {
365             try
366             {
367                 htmlGenerator.addField( fields[ i ].getName(), fields[ i ].get( this ) );
368             }
369             catch( IllegalAccessException JavaDoc illegalAccessException )
370             {
371                 System.out.println( "can not access field: " + fields[i].getName() );
372                 //illegalAccessException.printStackTrace();
373
}
374         }
375
376         htmlGenerator.propertiesTableEnd();
377     }
378
379
380 }
381
Popular Tags