001: /***********************************************************************************************
002: * File Info: $Id: StockChartProperties.java,v 1.2 2003/08/08 08:51:27 nicolaken Exp $
003: * Copyright (C) 2002
004: * Author: Nathaniel G. Auvil
005: * Contributor(s):
006: *
007: * Copyright 2002 (C) Nathaniel G. Auvil. All Rights Reserved.
008: *
009: * Redistribution and use of this software and associated documentation ("Software"), with or
010: * without modification, are permitted provided that the following conditions are met:
011: *
012: * 1. Redistributions of source code must retain copyright statements and notices.
013: * Redistributions must also contain a copy of this document.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
016: * conditions and the following disclaimer in the documentation and/or other materials
017: * provided with the distribution.
018: *
019: * 3. The name "jCharts" or "Nathaniel G. Auvil" must not be used to endorse or promote
020: * products derived from this Software without prior written permission of Nathaniel G.
021: * Auvil. For written permission, please contact nathaniel_auvil@users.sourceforge.net
022: *
023: * 4. Products derived from this Software may not be called "jCharts" nor may "jCharts" appear
024: * in their names without prior written permission of Nathaniel G. Auvil. jCharts is a
025: * registered trademark of Nathaniel G. Auvil.
026: *
027: * 5. Due credit should be given to the jCharts Project (http://jcharts.sourceforge.net/).
028: *
029: * THIS SOFTWARE IS PROVIDED BY Nathaniel G. Auvil AND CONTRIBUTORS ``AS IS'' AND ANY
030: * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
031: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
032: * jCharts OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
033: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
034: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
035: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY, OR TORT
036: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
037: * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: ************************************************************************************************/package org.krysalis.jcharts.properties;
039:
040: import java.awt.BasicStroke;
041: import java.awt.Stroke;
042:
043: import org.krysalis.jcharts.chartData.interfaces.IAxisPlotDataSet;
044: import org.krysalis.jcharts.test.HTMLGenerator;
045:
046: public final class StockChartProperties extends AxisChartTypeProperties {
047: public static final Stroke DEFAULT_STROKE = new BasicStroke(1.5f);
048:
049: private Stroke hiLowStroke;
050:
051: private Stroke openStroke;
052: private int openLength;
053:
054: private Stroke closeStroke;
055: private int closeLength;
056:
057: /**********************************************************************************************
058: *
059: *
060: ***********************************************************************************************/
061: public StockChartProperties() {
062: this .hiLowStroke = DEFAULT_STROKE;
063: this .openStroke = DEFAULT_STROKE;
064: this .openLength = 5;
065: this .closeStroke = DEFAULT_STROKE;
066: this .closeLength = 5;
067: }
068:
069: /**********************************************************************************************
070: *
071: * @param hiLowStroke
072: * @param openStroke
073: * @param openPixelLength
074: * @param closeStroke
075: * @param closePixelLength
076: ***********************************************************************************************/
077: public StockChartProperties(Stroke hiLowStroke, Stroke openStroke,
078: int openPixelLength, Stroke closeStroke,
079: int closePixelLength) {
080: this .hiLowStroke = hiLowStroke;
081: this .openStroke = openStroke;
082: this .openLength = openPixelLength;
083: this .closeStroke = closeStroke;
084: this .closeLength = closePixelLength;
085: }
086:
087: /**********************************************************************************************
088: *
089: * @return Stroke
090: ***********************************************************************************************/
091: public Stroke getHiLowStroke() {
092: return this .hiLowStroke;
093: }
094:
095: /**********************************************************************************************
096: *
097: * @param stroke
098: ***********************************************************************************************/
099: public void setHiLowStroke(Stroke stroke) {
100: this .hiLowStroke = stroke;
101: }
102:
103: /**********************************************************************************************
104: *
105: * @return Stroke
106: ***********************************************************************************************/
107: public Stroke getOpenStroke() {
108: return this .openStroke;
109: }
110:
111: /**********************************************************************************************
112: *
113: * @param stroke
114: ***********************************************************************************************/
115: public void setOpenStroke(Stroke stroke) {
116: this .openStroke = stroke;
117: }
118:
119: /**********************************************************************************************
120: *
121: * @return int
122: ***********************************************************************************************/
123: public int getOpenPixelLength() {
124: return this .openLength;
125: }
126:
127: /**********************************************************************************************
128: *
129: * @param pixelLength
130: ***********************************************************************************************/
131: public void setOpenPixelLength(int pixelLength) {
132: this .openLength = pixelLength;
133: }
134:
135: /**********************************************************************************************
136: *
137: * @return Stroke
138: ***********************************************************************************************/
139: public Stroke getCloseStroke() {
140: return this .closeStroke;
141: }
142:
143: /**********************************************************************************************
144: *
145: * @param stroke
146: ***********************************************************************************************/
147: public void setCloseStroke(Stroke stroke) {
148: this .closeStroke = stroke;
149: }
150:
151: /**********************************************************************************************
152: *
153: * @return int
154: ***********************************************************************************************/
155: public int getClosePixelLength() {
156: return this .closeLength;
157: }
158:
159: /**********************************************************************************************
160: *
161: * @param pixelLength
162: ***********************************************************************************************/
163: public void setClosePixelLength(int pixelLength) {
164: this .closeLength = pixelLength;
165: }
166:
167: /******************************************************************************************
168: * Validates the properties.
169: *
170: * @param iAxisPlotDataSet
171: * @throws PropertyException
172: *****************************************************************************************/
173: public void validate(IAxisPlotDataSet iAxisPlotDataSet)
174: throws PropertyException {
175: //AxisChart axisChart= (AxisChart) chart;
176: //IAxisPlotDataSet iAxisPlotDataSet= axisChart.getIDataSeries().getIAxisPlotDataSet( ChartType.LINE );
177:
178: }
179:
180: /*********************************************************************************************
181: * Enables the testing routines to display the contents of this Object.
182: *
183: * @param htmlGenerator
184: **********************************************************************************************/
185: public void toHTML(HTMLGenerator htmlGenerator) {
186: htmlGenerator.propertiesTableStart("StockChartProperties");
187: htmlGenerator.addTableRow("HiLow Stroke", this .hiLowStroke);
188: htmlGenerator.addTableRow("Open Stroke", this .openStroke);
189: htmlGenerator.addTableRow("Open Length", Integer
190: .toString(this .openLength));
191: htmlGenerator.addTableRow("Close Stroke", this .closeStroke);
192: htmlGenerator.addTableRow("Close Length", Integer
193: .toString(this.closeLength));
194: htmlGenerator.propertiesTableEnd();
195: }
196:
197: }
|