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 */ 016package org.opengion.plugin.column; 017 018import org.opengion.hayabusa.db.AbstractRenderer; 019import org.opengion.hayabusa.db.CellRenderer; 020import org.opengion.hayabusa.db.DBColumn; 021import org.opengion.hayabusa.db.Selection; 022import org.opengion.hayabusa.db.SelectionFactory; // 5.7.3.0 (2014/02/07) 023 024/** 025 * RADIO レンデラーは、カラムのデータをコードリソースに対応したラジオボタンの 026 * 代替えラベルで表示する場合に使用するクラスです。 027 * 028 * カラムの表示に必要な属性は, DBColumn オブジェクト より取り出します。 029 * このクラスは、DBColumn オブジェクト毎に1つ作成されます。 030 * 031 * @og.rev 3.5.1.0 (2003/10/03) 新規作成 032 * @og.group データ表示 033 * 034 * @version 4.0 035 * @author Kazuhiko Hasegawa 036 * @since JDK5.0, 037 */ 038public class Renderer_RADIO extends AbstractRenderer { 039 //* このプログラムのVERSION文字列を設定します。 {@value} */ 040 private static final String VERSION = "5.7.3.0 (2014/02/07)" ; 041 042 private final Selection selection ; 043 044 /** 045 * デフォルトコンストラクター。 046 * このコンストラクターで、基本オブジェクトを作成します。 047 * 048 */ 049 public Renderer_RADIO() { 050 selection = null; 051 } 052 053 /** 054 * デフォルトコンストラクター。 055 * 056 * @og.rev 3.5.4.2 (2003/12/15) makeCodeSelection メソッドを CodeSelectionクラスに変更。 057 * @og.rev 3.5.5.7 (2004/05/10) SelectionFactory を使用して、オブジェクト作成 058 * @og.rev 4.0.0.0 (2005/01/31) SelectionFactory ではなく、直接 Selection_RADIO を作成。 059 * @og.rev 5.7.3.0 (2014/02/07) SelectionFactory 対応 060 * 061 * @param clm DBColumnオブジェクト 062 */ 063 private Renderer_RADIO( final DBColumn clm ) { 064 // 5.7.3.0 (2014/02/07) SelectionFactory 対応 065 selection = SelectionFactory.newSelection( "RADIO" , clm.getCodeData() ); 066 } 067 068 /** 069 * 各オブジェクトから自分のインスタンスを返します。 070 * 自分自身をキャッシュするのか、新たに作成するのかは、各サブクラスの実装に 071 * まかされます。 072 * 073 * @param clm DBColumnオブジェクト 074 * 075 * @return CellRendererオブジェクト 076 */ 077 public CellRenderer newInstance( final DBColumn clm ) { 078 return new Renderer_RADIO( clm ); 079 } 080 081 /** 082 * データの表示用文字列を返します。 083 * 084 * @param value 入力値 085 * 086 * @return データの表示用文字列 087 */ 088 @Override 089 public String getValue( final String value ) { 090 return "<pre class=\"RADIO\">" + 091 selection.getRadioLabel( value ) + 092 "</pre>" ; 093 } 094}