1 package com.wikihouse.wildcats0201.jdbcchart.dto;
2
3 import org.jfree.chart.JFreeChart;
4
5 import com.wikihouse.wildcats0201.jdbcchart.fsutil.Directory;
6 import com.wikihouse.wildcats0201.jdbcchart.fsutil.DirectoryFactory;
7
8 /***
9 * <B>ChartFile </B>.
10 *
11 * @author $Author: wildcats $
12 * @version $Revision: 5 $
13 */
14 public class ChartFile {
15
16 private final String path;
17
18 private final String name;
19
20 private final FileType type;
21
22 /***
23 * 生成.
24 *
25 * @param path
26 * 生成パス
27 * @param name
28 * 生成ファイル名
29 * @param type
30 * ファイルタイプ
31 * @param width
32 * グラフの横幅
33 * @param height
34 * グラフの縦幅
35 * @see FileTypeFactory#create(String,int,int)
36 */
37 public ChartFile(String path, String name, String type, int width,
38 int height) {
39 this.path = path;
40 this.name = name;
41 this.type = FileTypeFactory.create(type, width, height);
42 }
43
44 public String getName() {
45 return this.name;
46 }
47
48 public String getPath() {
49 return this.path;
50 }
51
52 private FileType getType() {
53 return this.type;
54 }
55
56 public void saveChart(JFreeChart myChart) {
57 String path = this.getPath();
58 String createFileName = path + "/" + this.getName();
59 Directory directory = DirectoryFactory.create(path);
60 directory.make();
61 this.getType().saveChart(createFileName, myChart);
62 }
63
64 }