KickJava   Java API By Example, From Geeks To Geeks.

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


1 /***********************************************************************************************
2  * File Info: $Id: StockChartProperties.java,v 1.2 2003/08/08 08:51:27 nicolaken Exp $
3  * Copyright (C) 2002
4  * Author: Nathaniel G. Auvil
5  * Contributor(s):
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 package org.krysalis.jcharts.properties;
41
42
43 import java.awt.BasicStroke JavaDoc;
44 import java.awt.Stroke JavaDoc;
45
46 import org.krysalis.jcharts.chartData.interfaces.IAxisPlotDataSet;
47 import org.krysalis.jcharts.test.HTMLGenerator;
48
49
50 public final class StockChartProperties extends AxisChartTypeProperties
51 {
52     public static final Stroke JavaDoc DEFAULT_STROKE= new BasicStroke JavaDoc( 1.5f );
53
54     private Stroke JavaDoc hiLowStroke;
55
56     private Stroke JavaDoc openStroke;
57     private int openLength;
58
59     private Stroke JavaDoc closeStroke;
60     private int closeLength;
61
62
63     /**********************************************************************************************
64      *
65      *
66      ***********************************************************************************************/

67     public StockChartProperties()
68     {
69         this.hiLowStroke = DEFAULT_STROKE;
70         this.openStroke = DEFAULT_STROKE;
71         this.openLength = 5;
72         this.closeStroke = DEFAULT_STROKE;
73         this.closeLength = 5;
74     }
75
76
77     /**********************************************************************************************
78      *
79      * @param hiLowStroke
80      * @param openStroke
81      * @param openPixelLength
82      * @param closeStroke
83      * @param closePixelLength
84      ***********************************************************************************************/

85     public StockChartProperties( Stroke JavaDoc hiLowStroke,
86                                  Stroke JavaDoc openStroke,
87                                  int openPixelLength,
88                                  Stroke JavaDoc closeStroke,
89                                  int closePixelLength )
90     {
91         this.hiLowStroke = hiLowStroke;
92         this.openStroke = openStroke;
93         this.openLength = openPixelLength;
94         this.closeStroke = closeStroke;
95         this.closeLength = closePixelLength;
96     }
97
98
99     /**********************************************************************************************
100      *
101      * @return Stroke
102      ***********************************************************************************************/

103     public Stroke JavaDoc getHiLowStroke()
104     {
105         return this.hiLowStroke;
106     }
107
108
109     /**********************************************************************************************
110      *
111      * @param stroke
112      ***********************************************************************************************/

113     public void setHiLowStroke( Stroke JavaDoc stroke )
114     {
115         this.hiLowStroke = stroke;
116     }
117
118
119     /**********************************************************************************************
120      *
121      * @return Stroke
122      ***********************************************************************************************/

123     public Stroke JavaDoc getOpenStroke()
124     {
125         return this.openStroke;
126     }
127
128
129     /**********************************************************************************************
130      *
131      * @param stroke
132      ***********************************************************************************************/

133     public void setOpenStroke( Stroke JavaDoc stroke )
134     {
135         this.openStroke = stroke;
136     }
137
138
139     /**********************************************************************************************
140      *
141      * @return int
142      ***********************************************************************************************/

143     public int getOpenPixelLength()
144     {
145         return this.openLength;
146     }
147
148
149     /**********************************************************************************************
150      *
151      * @param pixelLength
152      ***********************************************************************************************/

153     public void setOpenPixelLength( int pixelLength )
154     {
155         this.openLength = pixelLength;
156     }
157
158
159     /**********************************************************************************************
160      *
161      * @return Stroke
162      ***********************************************************************************************/

163     public Stroke JavaDoc getCloseStroke()
164     {
165         return this.closeStroke;
166     }
167
168
169     /**********************************************************************************************
170      *
171      * @param stroke
172      ***********************************************************************************************/

173     public void setCloseStroke( Stroke JavaDoc stroke )
174     {
175         this.closeStroke = stroke;
176     }
177
178
179     /**********************************************************************************************
180      *
181      * @return int
182      ***********************************************************************************************/

183     public int getClosePixelLength()
184     {
185         return this.closeLength;
186     }
187
188
189     /**********************************************************************************************
190      *
191      * @param pixelLength
192      ***********************************************************************************************/

193     public void setClosePixelLength( int pixelLength )
194     {
195         this.closeLength = pixelLength;
196     }
197
198
199     /******************************************************************************************
200      * Validates the properties.
201      *
202      * @param iAxisPlotDataSet
203      * @throws PropertyException
204      *****************************************************************************************/

205     public void validate( IAxisPlotDataSet iAxisPlotDataSet ) throws PropertyException
206     {
207         //AxisChart axisChart= (AxisChart) chart;
208
//IAxisPlotDataSet iAxisPlotDataSet= axisChart.getIDataSeries().getIAxisPlotDataSet( ChartType.LINE );
209

210     }
211
212
213     /*********************************************************************************************
214      * Enables the testing routines to display the contents of this Object.
215      *
216      * @param htmlGenerator
217      **********************************************************************************************/

218     public void toHTML( HTMLGenerator htmlGenerator )
219     {
220         htmlGenerator.propertiesTableStart( "StockChartProperties" );
221         htmlGenerator.addTableRow( "HiLow Stroke", this.hiLowStroke );
222         htmlGenerator.addTableRow( "Open Stroke", this.openStroke );
223         htmlGenerator.addTableRow( "Open Length", Integer.toString( this.openLength ) );
224         htmlGenerator.addTableRow( "Close Stroke", this.closeStroke );
225         htmlGenerator.addTableRow( "Close Length", Integer.toString( this.closeLength ) );
226         htmlGenerator.propertiesTableEnd();
227     }
228
229
230 }
231
Popular Tags