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.AbstractEditor; 019import org.opengion.hayabusa.db.CellEditor; 020import org.opengion.hayabusa.db.DBColumn; 021import org.opengion.fukurou.util.XHTMLTag; 022 023/** 024 * 【廃止】RADIO2 エディターは、カラムのデータをラジオボタンで編集する場合に使用するクラスです。 025 * 026 * このエディターは、RADIOとは異なり、コードリソースでの制御など、ラジオボタン特有の制御を全く行いません。 027 * 特性としては、typeがradioであるという1点を除いて、TEXT エディターと同じです 028 * 029 * カラムの表示に必要な属性は, DBColumn オブジェクト より取り出します。 030 * このクラスは、DBColumn オブジェクト毎に1つ作成されます。 031 * 032 * 6.4.4.0 (2016/03/11) 廃止します。 033 * 034 * @og.group データ編集 035 * 036 * @version 4.0 037 * @author Hiroki Nakamura 038 * @since JDK5.0, 039 */ 040public class Editor_RADIO2 extends AbstractEditor { 041 /** このプログラムのVERSION文字列を設定します。 {@value} */ 042 private static final String VERSION = "6.4.4.0 (2016/03/11)" ; 043 044 /** 045 * 【廃止】デフォルトコンストラクター。 046 * このコンストラクターで、基本オブジェクトを作成します。 047 * 048 * @og.rev 6.4.1.1 (2016/01/16) PMD refactoring. It is a good practice to call super() in a constructor 049 */ 050 public Editor_RADIO2() { super(); } // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。 051 052 /** 053 * 【廃止】コンストラクター。 054 * 055 * @param clm DBColumnオブジェクト 056 */ 057 private Editor_RADIO2( final DBColumn clm ) { 058 super( clm ); 059 060 attributes.set( "type", "radio" ); 061 tagBuffer.add( XHTMLTag.inputAttri( attributes ) ); 062 } 063 064 /** 065 * 【廃止】各オブジェクトから自分のインスタンスを返します。 066 * 自分自身をキャッシュするのか、新たに作成するのかは、各サブクラスの実装に 067 * まかされます。 068 * 069 * @og.rev 6.4.4.0 (2016/03/11) 廃止します。 070 * 071 * @param clm DBColumnオブジェクト 072 * 073 * @return CellEditorオブジェクト 074 * @og.rtnNotNull 075 */ 076 public CellEditor newInstance( final DBColumn clm ) { 077 return new Editor_RADIO2( clm ); 078 } 079 080 /** 081 * 【廃止】データの編集用文字列を返します。 082 * 083 * @og.rev 6.4.4.0 (2016/03/11) 廃止します。 084 * 085 * @param value 値 086 * 087 * @return データの編集用文字列 088 * @og.rtnNotNull 089 */ 090 @Override 091 public String getValue( final String value ) { 092 return new StringBuilder( BUFFER_MIDDLE ) 093 .append( "<label>" ) 094 .append( super.getValue( value ) ) 095 .append( value ) 096 .append( "</label>" ) 097 .toString(); 098 } 099 100 /** 101 * 【廃止】name属性を変えた、データ表示/編集用のHTML文字列を作成します。 102 * テーブル上の name に 行番号を付加して、名前_行番号 で登録するキーを作成し, 103 * リクエスト情報を1つ毎のフィールドで処理できます。 104 * 105 * @og.rev 6.4.4.0 (2016/03/11) 廃止します。 106 * 107 * @param row 行番号 108 * @param value 値 109 * 110 * @return データ表示/編集用の文字列 111 * @og.rtnNotNull 112 */ 113 @Override 114 public String getValue( final int row,final String value ) { 115 return new StringBuilder( BUFFER_MIDDLE ) 116 .append( "<label>" ) 117 .append( super.getValue( row,value ) ) 118 .append( value ) 119 .append( "</label>" ) 120 .toString(); 121 } 122}