001 /* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016 package org.opengion.hayabusa.io; 017 018 import org.opengion.fukurou.util.StringUtil; 019 import org.opengion.hayabusa.common.HybsSystem; 020 import org.opengion.hayabusa.common.HybsSystemException; 021 import org.opengion.hayabusa.db.DBTableModel; 022 023 import java.sql.Connection; 024 import java.sql.SQLException; 025 import java.util.Map; 026 import java.util.HashMap; 027 import java.util.Arrays; 028 029 import org.jfree.chart.LegendItemSource; 030 import org.jfree.data.jdbc.JDBCPieDataset; 031 import org.jfree.data.jdbc.JDBCXYDataset; 032 import org.jfree.data.general.Dataset; 033 import org.jfree.data.general.DefaultValueDataset; 034 035 import org.jfree.data.category.DefaultCategoryDataset; 036 import org.jfree.data.xy.CategoryTableXYDataset; 037 import org.jfree.data.general.DefaultPieDataset; 038 import org.jfree.data.DefaultKeyedValues; 039 040 /** 041 * 引数タイプに応じたレン?ー?ータセ?を管?ます? 042 * 043 * タイプ?レン?ー、データセ? の?合わせで、構築するオブジェクトが異なります? 044 * 045 * @version 0.9.0 2007/06/21 046 * @author Kazuhiko Hasegawa 047 * @since JDK1.1, 048 */ 049 final class TypeRenderer { 050 private static final String REND_CLASS = "org.jfree.chart.renderer." ; 051 private static final String HYBS_CLASS = "org.opengion.hayabusa.io." ; // 4.1.1.0 (2008/02/04) 052 053 private final String type ; 054 private final String rend ; // org.jfree.chart.renderer 以降??? 055 private final String dtset ; // org.opengion.hayabusa.io 以降??? 056 private final String plot ; // 以降??? 057 058 /** 059 * TypeRenderer オブジェクトを作?します? 060 * 061 * チャートタイ?は、外部からチャートを?する?に便利なように、キー? 062 * されて?す?こ?キーに基づ?、ChartFactory クラスの 063 * チャートタイプ変換表に基づ?、レン?ー????タセ?を作?します? 064 * こ?クラスは、これらの変換表の個?の属?を管?て?す? 065 * 066 * @og.rev 5.3.0.0 (2010/12/01) plot 追? 067 * 068 * @param type チャート?タイプを区別する?? 069 * @param renderer チャート?タイプに応じたレン?ーのキー?? 070 * @param dtset チャート?タイプに応じたデータセ?のキー?? 071 * @param plot チャート?タイプに応じた?ロ?のキー?? 072 */ 073 // public TypeRenderer( final String type,final String renderer,final String dtset ) { 074 public TypeRenderer( final String type,final String renderer,final String dtset,final String plot ) { 075 this.type = type ; 076 this.rend = renderer ; 077 this.dtset = dtset ; 078 this.plot = plot ; // 5.3.0.0 (2010/12/01) plot 追? 079 } 080 081 /** 082 * チャート?タイプを区別する??を返します? 083 * 084 * @return チャート?タイプを区別する?? 085 */ 086 public String getType() { return type; } 087 088 /** 089 * チャート?タイプに応じたレン?ーのキー??を返します? 090 * 091 * @return チャート?タイプに応じたレン?ーのキー?? 092 */ 093 public String getRendererType() { return rend; } 094 095 /** 096 * チャート?タイプに応じたレン?ーオブジェクトを返します? 097 * 098 * org.jfree.chart.renderer パッケージのサブモジュールのレン?ークラス? 099 * 先に登録してある レン?ーのキー?? と合?して、クラスを動?作?します? 100 * 101 * @og.rev 4.1.1.0 (2008/02/04) Barチャート追? 102 * @og.rev 5.3.0.0 (2010/12/01) レン?ー?null の場合?対? 103 * 104 * @return LegendItemSource チャート?タイプに応じたレン?ーオブジェク?存在しな??合?、null) 105 */ 106 public LegendItemSource getRenderer() { 107 if( rend == null ) { return null; } // 5.3.0.0 (2010/12/01) 108 109 String key ; 110 if( type.startsWith( "Hybs" ) ) { 111 key = HYBS_CLASS + rend ; 112 } 113 else { 114 key = REND_CLASS + rend ; 115 } 116 117 return (LegendItemSource)StringUtil.newInstance( key ) ; 118 } 119 120 /** 121 * チャート?タイプに応じたデータセ?のキー??を返します? 122 * 123 * @return チャート?タイプに応じたデータセ?のキー?? 124 */ 125 public String getDatasetType() { return dtset; } 126 127 /** 128 * チャート?タイプに応じた?ロ?のキー??を返します? 129 * 130 * @og.rev 5.3.0.0 (2010/12/01) 新規追? 131 * 132 * @return チャート?タイプに応じた?ロ?のキー?? 133 */ 134 public String getPlotType() { return plot; } 135 }