View Javadoc

1   package com.wikihouse.wildcats0201.jdbcchart;
2   
3   import java.sql.Connection;
4   
5   import org.jfree.chart.ChartFactory;
6   import org.jfree.chart.JFreeChart;
7   import org.jfree.data.general.Dataset;
8   import org.jfree.data.xy.XYDataset;
9   
10  import com.wikihouse.wildcats0201.jdbcchart.dto.ChartDTO;
11  
12  /***
13   * <B>LineChartFactory </B>. LineChartのFactoryです。
14   * 
15   * @see LineChart
16   * @author $Author: wildcats $
17   * @version $Revision: 5 $
18   */
19  public class LineChartFactory {
20  
21      private LineChartFactory() {
22      }
23  
24      /***
25       * LineChartを返却します。 この実装ではXyLineChartを生成し返却します。
26       * 
27       * @return LineChartのインスタンス
28       */
29      public static LineChart create() {
30          return new XYLineChart();
31      }
32  
33      /***
34       * <B>XYLineChart </B>. LineChartの実装です。
35       * 
36       * @author $Author$
37       * @version $Revision: 5 $
38       */
39      private static class XYLineChart implements LineChart {
40  
41          /***
42           * @see com.wikihouse.wildcats0201.jdbcchart.LineChart#getDataSet(java.sql.Connection,
43           *      java.lang.String)
44           */
45          public Dataset getDataSet(Connection conn, String sql) {
46              return DatasetFactory
47                      .create(
48                              "com.wikihouse.wildcats0201.jdbcchart.impl.JDBCXYDatasetEnhanceImpl",
49                              conn, sql);
50          }
51  
52          /***
53           * @see com.wikihouse.wildcats0201.jdbcchart.LineChart#getJFreeChart(com.wikihouse.wildcats0201.jdbcchart.dto.ChartDTO)
54           */
55          public JFreeChart getJFreeChart(ChartDTO data) {
56              return ChartFactory.createXYLineChart(data.getTitle(), data
57                      .getXAxisLabel(), data.getYAxisLabel(), (XYDataset) data
58                      .getDataset(), data.getOrientation(), data.isLegend(), data
59                      .isTooltips(), data.isUrls());
60          }
61  
62      }
63  
64  }