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.hayabusa.db; 017 018/** 019 * データのコード情報を取り扱うSelectionクラスの、NULL時オブジェクトです。 020 * 021 * 以前は、Selection オブジェクトが null の場合に、NullPointerException で 022 * いきなりエラーで停止していましたが、この、NULLセレクションを作成することで、 023 * 取りあえず、どういう状況なのか、判るようにします。 024 * 025 * @og.rev 5.7.3.0 (2014/02/07) 新規追加 026 * @og.rev 5.7.7.1 (2014/06/13) Selectionオブジェクトの基本実装とします。 027 * @og.group 選択データ制御 028 * 029 * @version 4.0 030 * @author Kazuhiko Hasegawa 031 * @since JDK5.0, 032 */ 033// public class Selection_NULL extends Selection_KEYVAL { 034public class Selection_NULL implements Selection { 035 private final String initMsg ; 036 037 /** 038 * デフォルトコンストラクター 039 * 継承元のクラスから、呼び出させるように、作成しておきます。 040 * 041 * @og.rev 5.7.7.1 (2014/06/13) 新規追加 042 */ 043 public Selection_NULL() { initMsg = null; } 044 045 /** 046 * 引数に初期メッセージを指定して作成する、コンストラクター 047 * 048 * @og.rev 5.7.3.0 (2014/02/07) 新規追加 049 * 050 * @param strCode 初期メッセージ文字列 051 */ 052 public Selection_NULL( final String strCode ) { 053// super( null ); 054 initMsg = strCode ; 055 } 056 057 /** 058 * 初期値が選択済みの 選択肢(オプション)を返します。 059 * このオプションは、引数の値を初期値とするオプションタグを返します。 060 * このメソッドでは、ラベル(短)が設定されている場合でも、これを使用せずに必ずラベル(長)を使用します。 061 * 062 * @og.rev 5.7.7.1 (2014/06/13) 新規追加 063 * 064 * @param selectValue 選択されている値 065 * @param seqFlag シーケンスアクセス機能 [true:ON/false:OFF] 066 * 067 * @return オプションタグ 068 * @see #getOption( String, boolean, boolean ) 069 */ 070 @Override 071 public String getOption( final String selectValue,final boolean seqFlag ) { 072 return getOption( selectValue, seqFlag, false ); 073 } 074 075 /** 076 * 初期値が選択済みの 選択肢(オプション)を返します。 077 * 無条件で、初期メッセージを返します。 078 * 079 * @og.rev 5.7.3.0 (2014/02/07) 新規追加 080 * 081 * @param selectValue 選択されている値 082 * @param seqFlag シーケンスアクセス機能 [true:ON/false:OFF] 083 * @param useShortLabel ラベル(短)をベースとしたオプション表示を行うかどうか(常にfalse)。 084 * 085 * @return オプションタグ 086 * @see #getOption( String, boolean ) 087 */ 088 @Override 089 public String getOption( final String selectValue,final boolean seqFlag, final boolean useShortLabel ) { 090 return initMsg + " value=[" + selectValue + "]"; 091 } 092 093 /** 094 * 初期値が選択済みの 選択肢(オプション)を返します。 095 * このオプションは、引数の値を初期値とするオプションタグを返します。 096 * ※ このクラスでは実装されていません。 097 * 098 * @param name ラジオの name 099 * @param selectValue 選択されている値 100 * @param useLabel ラベル表示の有無 [true:有/false:無] 101 * 102 * @return オプションタグ 103 */ 104 @Override 105 public String getRadio( final String name,final String selectValue,final boolean useLabel ) { 106 String errMsg = "このクラスでは実装されていません。"; 107 throw new UnsupportedOperationException( errMsg ); 108 } 109 110 /** 111 * 初期値が選択済みの 選択肢(オプション)を返します。 112 * このオプションは、引数の値を初期値とするオプションタグを返します。 113 * ※ このクラスでは実装されていません。 114 * 115 * @param selectValue 選択されている値 116 * 117 * @return オプションタグ 118 */ 119 @Override 120 public String getRadioLabel( final String selectValue ) { 121 String errMsg = "このクラスでは実装されていません。"; 122 throw new UnsupportedOperationException( errMsg ); 123 } 124 125 /** 126 * 選択肢(value)に対するラベルを返します。 127 * 選択肢(value)が、存在しなかった場合は、選択肢そのものを返します。 128 * getValueLabel( XX ) は、getValueLabel( XX,false ) と同じです。 129 * 130 * @param selectValue 選択肢の値 131 * 132 * @return 選択肢のラベル 133 * @see #getValueLabel( String,boolean ) 134 */ 135 @Override 136 public String getValueLabel( final String selectValue ) { 137 return getValueLabel( selectValue,false ); 138 } 139 140 /** 141 * 選択肢(value)に対するラベルを返します。 142 * 無条件で、初期メッセージを返します。 143 * 144 * @og.rev 5.7.3.0 (2014/02/07) 新規追加 145 * 146 * @param selectValue 選択肢の値 147 * @param flag 短縮ラベルを [true:使用する/false:しない](常に false) 148 * 149 * @return 選択肢のラベル 150 * @see #getValueLabel( String ) 151 */ 152 @Override 153 public String getValueLabel( final String selectValue,final boolean flag ) { 154 return initMsg + " value=[" + selectValue + "]"; 155 } 156 157 /** 158 * マルチ・キーセレクトを使用するかどうかを返します。 159 * true:使用する。false:使用しない です。 160 * ただし、実際に使用するかどうかは、HTML出力時に決めることが出来ます。 161 * ここでは、USE_MULTI_KEY_SELECT が true で、USE_SIZE(=20)以上の場合に 162 * true を返します。 163 * 164 * ※ ここでは、常に false を返します。 165 * 166 * @return 選択リストで、マルチ・キーセレクトを使用するかどうか(true:使用する) 167 */ 168 @Override 169 public boolean useMultiSelect() { 170 return false; 171 } 172 173 /** 174 * オブジェクトのキャッシュが時間切れかどうかを返します。 175 * キャッシュが時間切れ(無効)であれば、true を、有効であれば、 176 * false を返します。 177 * 178 * ※ ここでは、常に false を返します。 179 * 180 * @return キャッシュが時間切れなら true 181 */ 182 @Override 183 public boolean isTimeOver() { 184 return false; 185 } 186}