KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > ui > component > charting > AbstractJFreeChartComponent


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * Created Nov 17, 2005
14  * @author wseyler
15  */

16
17 package org.pentaho.ui.component.charting;
18
19 import java.io.File JavaDoc;
20 import java.util.ArrayList JavaDoc;
21 import java.util.List JavaDoc;
22
23 import org.apache.commons.logging.LogFactory;
24 import org.dom4j.Document;
25 import org.jfree.data.general.Dataset;
26 import org.pentaho.core.system.PentahoSystem;
27 import org.pentaho.core.ui.IPentahoUrlFactory;
28
29 public abstract class AbstractJFreeChartComponent extends AbstractChartComponent {
30
31     protected int chartType;
32     protected Dataset dataDefinition;
33     
34     public AbstractJFreeChartComponent(int chartType, String JavaDoc definitionPath, int width, int height, IPentahoUrlFactory urlFactory, List JavaDoc messages) {
35         this(urlFactory, messages);
36         this.chartType = chartType;
37         this.definitionPath = definitionPath;
38         this.width = width;
39         this.height = height;
40         String JavaDoc info[] = PentahoSystem.parseActionString(definitionPath);
41         if (info != null && info.length == 3) {
42             setSourcePath(info[0] + File.separator + info[2]);
43         }
44     }
45
46     /**
47      * @param definitionPath
48      * @param urlFactory
49      * @param messages
50      */

51     public AbstractJFreeChartComponent(String JavaDoc definitionPath, IPentahoUrlFactory urlFactory, ArrayList JavaDoc messages) {
52         this(urlFactory, messages);
53         this.definitionPath = definitionPath;
54         String JavaDoc info[] = PentahoSystem.parseActionString(definitionPath);
55         if (info != null && info.length == 3) {
56             setSourcePath(info[0] + File.separator + info[2]);
57         }
58     }
59
60     public AbstractJFreeChartComponent(IPentahoUrlFactory urlFactory, List JavaDoc messages) {
61         super(urlFactory, messages);
62         logger = LogFactory.getLog(this.getClass());
63     }
64
65     /**
66      * Creates a Dataset object (actaully one of it's subclasses from the XML
67      * doc
68      *
69      * @param doc
70      * XML document that describes the chart
71      * @return the Dataset Implementation
72      */

73     public abstract Dataset createChart(Document doc);
74
75     /**
76      * @return Returns the dataSet.
77      */

78     public Dataset getDataDefinitiont() {
79         return dataDefinition;
80     }
81
82     /**
83      * @param dataSet
84      * The dataSet to set.
85      */

86     public void setDataDefinition(Dataset dataSet) {
87         this.dataDefinition = dataSet;
88     }
89
90     /**
91      * @return Returns the chartType.
92      */

93     public int getChartType() {
94         return chartType;
95     }
96
97     /**
98      * @param chartType
99      * The chartType to set.
100      */

101     public void setChartType(int chartType) {
102         this.chartType = chartType;
103     }
104
105 }
106
Popular Tags