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.plugin.column;
017
018 import org.opengion.hayabusa.db.AbstractRenderer;
019 import org.opengion.hayabusa.db.CellRenderer;
020 import org.opengion.hayabusa.db.DBColumn;
021 import org.opengion.hayabusa.db.Selection;
022
023 /**
024 * MENU レン?ーは、カラ????タをコードリソースに対応したラベルで
025 * プル?ンメニュー表示する場合に使用するクラスです?
026 *
027 * カラ??表示に?な属?は, DBColumn オブジェク?より取り出します?
028 * こ?クラスは、DBColumn オブジェクト毎に?つ作?されます?
029 *
030 * @og.group ??タ表示
031 *
032 * @version 4.0
033 * @author Kazuhiko Hasegawa
034 * @since JDK5.0,
035 */
036 public class Renderer_MENU extends AbstractRenderer {
037 //* こ?プログラ??VERSION??を設定します? {@value} */
038 private static final String VERSION = "5.5.1.0 (2012/04/03)" ;
039
040 // 3.2.3.0 (2003/06/06) final を削除。サブクラスからアクセスできるように変更?
041 private final Selection selection ;
042 private final String useSLabel ; // 5.5.1.0 (2012/04/03)
043
044 /**
045 * ?ォルトコンストラクター?
046 * こ?コンストラクターで、基本オブジェクトを作?します?
047 *
048 * @og.rev 3.1.1.1 (2003/04/03) ?ブジェクトから???インスタンスを返すファクトリメソ?を追??
049 * @og.rev 3.2.3.0 (2003/06/06) key 変数をローカル化?
050 * @og.rev 5.5.1.0 (2012/04/03) Slabel対?
051 *
052 */
053 public Renderer_MENU() {
054 selection = null;
055 useSLabel = "auto"; // 5.5.1.0 (2012/04/03)
056 }
057
058 /**
059 * ?ォルトコンストラクター?
060 *
061 * @og.rev 3.1.1.1 (2003/04/03) ?ブジェクトから???インスタンスを返すファクトリメソ?を追??
062 * @og.rev 3.2.3.0 (2003/06/06) key 変数をローカル化?
063 * @og.rev 3.3.1.1 (2003/07/03) CodeSelection の設定において、バグ修正?
064 * @og.rev 3.5.4.2 (2003/12/15) makeCodeSelection メソ??CodeSelectionクラスに変更?
065 * @og.rev 3.5.5.7 (2004/05/10) SelectionFactory を使用して、オブジェクト作?
066 * @og.rev 4.0.0.0 (2005/01/31) Selection_CODE の作?の引数?CodeData に変更?
067 * @og.rev 4.0.0.0 (2007/11/07) SelectionオブジェクトをDBColumnから取?
068 * @og.rev 5.5.1.0 (2012/04/03) Slabel対?
069 *
070 * @param clm DBColumnオブジェク?
071 */
072 private Renderer_MENU( final DBColumn clm ) {
073 selection = clm.getSelection(); // 4.0.0.0 (2007/11/07)
074 useSLabel = clm.getUseSLabel() ; // 5.5.1.0 (2012/04/03)
075 }
076
077 /**
078 * ?ブジェクトから???インスタンスを返します?
079 * 自??身をキャ?ュするのか?新たに作?するのか?、各サブクラスの実?
080 * まかされます?
081 *
082 * @og.rev 3.1.1.1 (2003/04/03) ?ブジェクトから???インスタンスを返すファクトリメソ?を追??
083 * @og.rev 3.1.2.1 (2003/04/10) synchronized を?削除します?
084 *
085 * @param clm DBColumnオブジェク?
086 *
087 * @return CellRendererオブジェク?
088 */
089 public CellRenderer newInstance( final DBColumn clm ) {
090 return new Renderer_MENU( clm );
091 }
092
093 /**
094 * ??タの表示用??を返します?
095 *
096 * @og.rev 5.5.1.0 (2012/04/03) Slabel対?
097 *
098 * @param value 入力?
099 *
100 * @return ??タの表示用??
101 */
102 @Override
103 public String getValue( final String value ) {
104 // final boolean uslbl = "true".equalsIgnoreCase( useSLabel ); // 5.5.1.0 (2012/04/03)
105 final boolean uslbl = !"true".equals(useSLabel) ? false : true; // 5.5.1.0 (2012/04/03)
106 // return selection.getValueLabel( value,false );
107 return selection.getValueLabel( value,uslbl ); // 5.5.1.0 (2012/04/03)
108 }
109
110 /**
111 * name属?を変えた???タ表示/編?のHTML??を作?します?
112 * ??ブル上? name に 行番号を付加して、名前_行番号 で登録するキーを作??
113 * リクエスト情報を1つ毎?フィールドで処?きます?
114 *
115 * @og.rev 4.0.0.0 (2005/11/30) ?表示では、短縮ラベルを使用します?
116 * @og.rev 5.5.1.0 (2012/04/03) Slabel対?
117 *
118 * @param row 行番号
119 * @param value 入力?
120 *
121 * @return ??タ表示/編?の??
122 */
123 @Override
124 public String getValue( final int row,final String value ) {
125 // final boolean uslbl = ("auto".equals(useSLabel) || "true".equals(useSLabel) ) ? true : false; // 5.5.1.0 (2012/04/03)
126 final boolean uslbl = "auto".equalsIgnoreCase( useSLabel ) || "true".equalsIgnoreCase( useSLabel ); // 5.5.1.0 (2012/04/03)
127 // return selection.getValueLabel( value,true )
128 return selection.getValueLabel( value,uslbl );
129 }
130 }