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.taglib; 017 018 import org.opengion.hayabusa.common.HybsSystem; 019 import org.opengion.hayabusa.common.HybsSystemException; 020 import org.opengion.fukurou.util.XHTMLTag; 021 022 import static org.opengion.fukurou.util.StringUtil.nval ; 023 024 /** 025 * 入力フィールドやボタンなどを作?するHTML拡張タグです? 026 * 027 * 簡易的な入力用タグとして、columnタグがあります?で??常は、columnタグをお使?さ?? 028 * name 属?に ラベルリソース のキーを与えることで、ロケールにあわせたリソース? 029 * 使用して、画面に表示します? 030 * ロケールは、session 登録?の HybsSystem#LANG_KEY を?期?で使用し? 031 * language 属?で定義されて?場合?、そちらを優先します? 032 * 033 * @og.formSample 034 * ●形式?lt;og:input name=… value=… /> 035 * ●body?あ?EVAL_BODY_BUFFERED:BODYを評価し?{@XXXX} を解析しま? 036 * 037 * ●Tag定義?? 038 * <og:input 039 * type 【HTML】表示形式[text/password/checkbox/radio/submit/reset/button/image/file]を指定しま?初期値:text) 040 * HTML5追??[search/tel/url/email/datetime/date/month/week/time/datetime-local/number/range/color] 041 * name 【HTML】名前を?しま? 042 * value 【HTML】このフィールドに設定する?を指定しま? 043 * caseKey 【TAG】このタグ自体を利用するかど?の条件キーを指定しま?初期値:null) 044 * caseVal 【TAG】このタグ自体を利用するかど?の条件値を指定しま?初期値:null) 045 * caseNN 【TAG】指定?値が?null/ゼロ?? でな???Not Null=NN)は、このタグは使用されま?初期値:true) 046 * caseNull 【TAG】指定?値が?null/ゼロ?? の場合?、このタグは使用されま?初期値:true) 047 * lbl 【TAG】ラベルリソースのラベルIDを指定しま? 048 * lbls 【TAG】ラベルをCSV形式で??しま? 049 * td 【TAG】テーブル形式? <td> タグを使用するかど?[yes/no/false]を指定しま?初期値:yes) 050 * colspan 【TAG】フィールド部?? colspan を指定しま? 051 * nextForm 【TAG】?力カーソルを指定されたname属?のフィールドへ自動的に移動しま? 052 * optionAttributes 【TAG】JavaScript などの HTML基本タグ以外?属?を?そ?ままタグとして使用しま? 053 * must 【TAG】??入力を表す色に変えるかど?[true/false]を指定しま?初期値:false) 054 * mustAny 【TAG】選択??入?どれかひとつ??)を表す色[true/mustAny/そ?他]を指定しま?初期値:無?? 055 * aimai 【TAG】曖昧検索可能フィールドとして、曖昧検索方法を?しま?初期値:null) 056 * size 【HTML】横??しま?typeがtextまた?passwordの場合??数で、それ以外?ピクセル) 057 * maxlength 【HTML】最大入力文字数を指定しま?typeがtextまた?passwordの場? 058 * checked 【HTML】type ?checkbox ?radio のとき?初めから選択された状態で表示しま?"checked"のみ?可) 059 * src 【HTML】type ?image の場合?送信ボタンとして利用する画像?URLをセ?しま? 060 * alt 【HTML】type ?image の場合で、画像が表示できな??合?代替?ストをセ?しま? 061 * accept 【HTML】type ?file の場合に、MIMEタイプをCSV形式で???来ま? 062 * usemap 【HTML】type ?image の場合?クライアントサイド?イメージマップ?URLを指定しま? 063 * ismap 【HTML】type ?image の場合に、サーバ?サイド?イメージマップを使用する場合に?しま? 064 * id 【HTML】要?対して固有?名前(id)をつける場合に設定しま? 065 * lang 【HTML】要???と他?属?値の??lang,xml:lang)を指定しま? 066 * dir 【HTML】文字表記?方?dir)を指定しま? 067 * title 【HTML】要?対する補足?報(title)を設定しま? 068 * style 【HTML】この要?対して適用させるスタイルシー?style)を設定しま? 069 * readonly 【TAG】その部品に対して変更が?来な??(readonly)?しま?サーバ?に送信され? 070 * disabled 【TAG】その部品に対して?択や変更が?来な??(disabled)?しま?サーバ?に送信されな? 071 * tabindex 【HTML】タブ?移動?(tabindex)を指定しま?0 ??32767) 072 * accesskey 【HTML】アクセスキー(alt+キーで直接??を割り当てま? 073 * clazz 【HTML】要?対して class 属?を設定しま? 074 * language 【TAG】タグ?で使用する?コード[ja/en/zh/…]を指定しま? 075 * onClick 【HTML】JavaScriptのイベン?onClick を設定しま??onClick="renew('query.jsp','QUERY');") 076 * onChange 【HTML】JavaScriptのイベン?onChange を設定しま??onChange="renew('query.jsp','QUERY');") 077 * onBlur 【HTML】JavaScriptのイベン?onBlur を設定しま??onBlur="this.value=value.toUpperCase();") 078 * onFocus 【HTML】JavaScriptのイベン?onFocus を設定しま? 079 * ondblClick 【HTML】JavaScriptのイベン?ondblClick を設定しま? 080 * onMouseDown 【HTML】JavaScriptのイベン?onMouseDown を設定しま? 081 * onMouseUp 【HTML】JavaScriptのイベン?onMouseUp を設定しま? 082 * onMouseMove 【HTML】JavaScriptのイベン?onMouseMove を設定しま? 083 * onMouseOut 【HTML】JavaScriptのイベン?onMouseOut を設定しま? 084 * onMouseOver 【HTML】JavaScriptのイベン?onMouseOver を設定しま? 085 * onSelect 【HTML】JavaScriptのイベン?onSelect を設定しま? 086 * onKeydown 【HTML】JavaScriptのイベン?onKeydown を設定しま? 087 * onKeypress 【HTML】JavaScriptのイベン?onKeypress を設定しま? 088 * onKeyup 【HTML】JavaScriptのイベン?onKeyup を設定しま? 089 * autocomplete 【HTML5】?力?補を提示して入力?容を?動補完する[on/off]??期?はon?? 090 * autofocus 【HTML5】指定した?力?カーソルが当たって自動的にフォーカスされます? 091 * pattern 【HTML5】正規表現で入力?のパターンを指定します? 092 * placeholder 【HTML5】?力?初期表示する?を指定します? 093 * required 【HTML5】?力??を指定しま? 094 * list 【HTML5】ユーザーに入力?補として提案するデータリスト?要??id属?の値を指定します? 095 * min 【HTML5】?力?入力できる??を指定します? 096 * max 【HTML5】?力?入力できる?値を指定します? 097 * step 【HTML5】?力?刻??プ?を指定する? 098 * roles 【TAG】ロールをセ?しま? 099 * debug 【TAG】デバッグ??を?力するかど?[true/false]を指定しま?初期値:false) 100 * > ... Body ... 101 * </og:input> 102 * 103 * ●使用? 104 * <og:input name="OYA" /> lbl属?が指定されて???合?、name属?をキーにしてLabelResourceを読み取ります? 105 * <og:input name="PN" lbl="KO" /> lbl属?を指定することで、ラベル?を付替えることができます? 106 * <og:input name="PN" size="13" maxlength="11" /> 強制?サイズの変更をするとき?、size属?、maxlength属?を使用できます? 107 * <og:input name="OYA" td="false" /> 自動作?されるtdタグ?ベルを外すとき?td属?を使?す? 108 * <og:input name="OYA" td="no" /> 自動作?されるtdタグを外し、ラベルとフィールド?残します? 109 * <og:input name="PN" optionAttributes="onBlur='blr()' 110 * onFocus='fcs()'" /> 111 * JavaScriptのイベントをコー?ングするとき?、optionAttributes属?を使?す? 112 * <og:input type="radio" name="OYA" /> ラベル部?入力フィールド部???ブルタグの<td>により左右に?されます? 113 * 114 * <table> 115 * <tr><og:input name="PN" value="{@PN}" /></tr> 116 * <tr><og:input name="CD" value="{@CD}" /></tr> 117 * </table> 118 * 119 * <table> 120 * <tr><og:input name="PN" value="{@PN}" >部品?力フィール?lt;/og:input></tr> 121 * <tr><og:input name="CD" value="{@CD}" >コードフィール?lt;/og:input></tr> 122 * </table> 123 * HTML 表示時?、前後に<tr>タグで囲って,整形できます? 124 * 125 * <og:input name="A" nextForm="B" /> ?桁数入力後?フォー?B にフォーカスが移動します? 126 * <og:input name="B" /> 127 * 128 * BODY 部?記述した値は、?力フィールド?直後にセ?されます? 129 * <og:input name="PN" > 130 * <button type="button" onclick="popup(???);return false;"> 131 * <og:message lbl="POPUP" comment="▼" /> 132 * </button> 133 * </og:input> 134 * 135 * @og.group 画面部? 136 * 137 * @version 4.0 138 * @author Kazuhiko Hasegawa 139 * @since JDK5.0, 140 */ 141 public class InputTag extends HTMLTagSupport { 142 //* こ?プログラ??VERSION??を設定します? {@value} */ 143 private static final String VERSION = "5.7.1.0 (2013/12/06)" ; 144 145 private static final long serialVersionUID = 571020131206L ; 146 147 // 5.7.1.0 (2013/12/06) HTML5 で新たに追?れた、type を追? 148 // private static final String CHECK_TYPE = "|text|password|checkbox|radio|submit|reset|button|image|file|hidden|" ; 149 private static final String CHECK_TYPE = "|text|password|checkbox|radio|submit|reset|button|image|file|hidden|" 150 + "search|tel|url|email|datetime|date|month|week|time|datetime-local|number|range|color|" ; 151 152 // 4.0.0 (2005/01/31) HTML_LABEL_SEPARATOR ?boolean 変数として取得します? 153 private final String CLM = ( HybsSystem.sysBool( "HTML_LABEL_SEPARATOR" ) ) ? ":" : "" ; 154 155 private String td_flag = "yes"; // yes:<td> タグを使用 / false:フィールド?み / no:ラベルとフィール? 156 // 3.0.1.4 (2003/03/17) colspan 属?を追?? 157 private String colspan = ""; 158 // 3.5.4.2 (2003/12/15) nextForm 属?を追?? 159 private String nextForm = null; 160 161 // 4.0.0 (2005/01/31) COLUMNS_MAXSIZE を定義しておきます? 162 private final int COLUMNS_MAXSIZE = HybsSystem.sysInt( "HTML_COLUMNS_MAXSIZE" ) ; // 表示フィールド?大きさ 163 164 // 4.0.0 (2007/05/30) BODY 部?記述した値は、?力フィールド?直後にセ?されます? 165 private String body = null; 166 167 /** 168 * Taglibの開始タグが見つかったときに処??doStartTag() ?オーバ?ライドします? 169 * 170 * @og.rev 4.0.0.0 (2007/05/30) 新規追?BODY部の評価) 171 * @og.rev 5.2.2.0 (2010/11/01) caseKey 、caseVal 属?対? 172 * 173 * @return 後続????( EVAL_BODY_BUFFERED ) 174 */ 175 @Override 176 public int doStartTag() { 177 // 5.2.2.0 (2010/11/01) caseKey 、caseVal 属?対? 178 if( useTag() ) { 179 return( EVAL_BODY_BUFFERED ); // Body を評価する? extends BodyTagSupport ? 180 } 181 return ( SKIP_BODY ); // Body を評価しな? 182 } 183 184 /** 185 * Taglibのタグ本体を処??doAfterBody() ?オーバ?ライドします? 186 * 187 * @og.rev 4.0.0.0 (2007/05/30) 新規追?BODY部の評価) 188 * 189 * @return 後続????(SKIP_BODY) 190 */ 191 @Override 192 public int doAfterBody() { 193 body = getBodyString(); 194 return(SKIP_BODY); 195 } 196 197 /** 198 * タグリブオブジェクトをリリースします? 199 * キャ?ュされて再利用される?で、フィールド?初期設定を行います? 200 * 201 * @og.rev 2.0.0.4 (2002/09/27) カスタ?グの release() メソ?を?追? 202 * @og.rev 2.0.0.8 (2002/10/09) yes/no/false で?するよ?変更 203 * @og.rev 3.0.1.4 (2003/03/17) colspan 属?を追?? 204 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応?release2() ?doEndTag()で呼ぶ? 205 * @og.rev 3.5.4.2 (2003/12/15) nextForm 属?を追?? 206 */ 207 @Override 208 protected void release2() { 209 super.release2(); 210 td_flag = "yes"; // table形式? <td> タグを使用するかど? 211 colspan = ""; 212 nextForm = null; // 3.5.4.2 (2003/12/15) 213 } 214 215 /** 216 * 検索条件の入力用の?ストフィールドを作?します? 217 * 218 * ??ブルタグによりフィールド??されます? 219 * 使用時?、テーブルタグを前後に使用して下さ?? 220 * 221 * @og.rev 2.0.0.8 (2002/10/09) yes/no/false で?するよ?変更 222 * @og.rev 2.0.1.0 (2002/10/10) ラベルとフィールド?セパレーターとして、コロン(??を使用するかど?を指定できる 223 * @og.rev 3.0.1.2 (2003/03/07) forward.jsp の代替用 CommonForwardTag を新規作? 224 * @og.rev 3.1.0.1 (2003/03/26) キャ?ュエントリーは、type="submit" の場合?み、登録する? 225 * @og.rev 3.1.1.0 (2003/03/28) forward.jsp 関係?処?削除する? 226 * @og.rev 3.1.1.0 (2003/03/28) radio ボタン等で、ラベルをクリ?しても?をセ?できるようにする? 227 * @og.rev 3.5.4.2 (2003/12/15) 入力カーソルを?動的に次のフィールドへ移動する機?を追?る? 228 * @og.rev 4.0.0.0 (2007/05/30) BODY 部?記述した値は、?力フィールド?直後にセ?されます? 229 * @og.rev 4.3.7.1 (2009/06/08) id=labelのclass? 230 * @og.rev 5.2.1.0 (2010/10/01) must , mustAny 属?を?動化します? 231 * @og.rev 5.6.2.2 (2013/03/15) 自動must処??出力位置を変更 232 * @og.rev 5.8.4.1 (2015/02/10) aimai対?6.2.0.0?? 233 * 234 * @return 入力用の?ストフィールドタグ 235 */ 236 @Override 237 protected String makeTag() { 238 if( get( "value" ) == null ) { set( "value","" ); } 239 if( getMsglbl() == null ) { setLbl( get( "name" ) ); } 240 241 // 3.5.4.2 (2003/12/15) 入力カーソルを?動的に次のフィールドへ移動する機? 242 if( nextForm != null ) { 243 String onKeyup = "nextForm(this,'" + nextForm + "'," + get( "maxlength" ) + ");" ; 244 set( "onKeyup",onKeyup ); 245 } 246 247 String type = get( "type" ); 248 StringBuilder rtn = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 249 // もう少しましな、別の方法を?る?があります? 250 if( "yes".equals( td_flag ) ) { 251 if( type != null && ( "radio".equals( type ) || "checkbox".equals( type ) )) { 252 if( get( "id" ) == null ) { set( "id",TaglibUtil.getTagId() ); } 253 254 rtn.append( "<td>" ); 255 rtn.append( XHTMLTag.input( getAttributes() ) ); 256 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 257 rtn.append( "</td>" ); 258 rtn.append( "<td " ); 259 rtn.append( colspan ); 260 rtn.append( ">" ); 261 rtn.append( "<label for=\"" ); 262 rtn.append( get( "id" ) ); 263 rtn.append( "\">" ); 264 rtn.append( getLongLabel() ); // 4.0.0 (2005/01/31) 265 rtn.append( "</label>" ); 266 // rtn.append( "</td>" ); 267 } 268 else if( type != null && ( "submit".equals( type ) || "reset".equals( type ) || "button".equals( type ) ) ) { 269 set( "value",getMsglbl() ); 270 rtn.append( "<td" ); 271 rtn.append( colspan ); 272 rtn.append( ">" ); 273 rtn.append( XHTMLTag.input( getAttributes() ) ); 274 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 275 rtn.append( "</td>" ); 276 // rtn.append( "<td></td>" ); 277 rtn.append( "<td>" ); 278 } 279 else { 280 // 4.3.7.1 (2009/06/08) id=labelのclass? 281 // rtn.append( "<td id=\"label\">" ); 282 rtn.append( "<td class=\"label\">" ); 283 rtn.append( getLongLabel() ); // 4.0.0 (2005/01/31) 284 rtn.append( CLM ); 285 rtn.append( "</td>" ); 286 rtn.append( "<td" ); 287 rtn.append( colspan ); 288 rtn.append( ">" ); 289 rtn.append( XHTMLTag.input( getAttributes() ) ); 290 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 291 // rtn.append( "</td>" ); 292 } 293 rtn.append( makeAimaiPicker( get("name") ) ); // 5.8.4.2(2015/02/20) 294 if( getMustType() != null ) { rtn.append( makeMustHidden( get( "name" ) ) ); } // 5.6.2.2 (2013/03/15) 295 rtn.append( "</td>" ); 296 } 297 else if( "no".equals( td_flag ) ) { 298 if( type != null && ( "radio".equals( type ) || "checkbox".equals( type ) )) { 299 rtn.append( "<label>" ); 300 rtn.append( XHTMLTag.input( getAttributes() ) ); 301 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 302 // 4.3.7.1 (2009/06/08) id=labelのclass? 303 // rtn.append( "<span id=\"label\">" ); 304 rtn.append( "<span class=\"label\">" ); 305 rtn.append( getLongLabel() ); // 4.0.0 (2005/01/31) 306 rtn.append( "</span>" ); 307 rtn.append( "</label>" ); 308 } 309 else if( type != null && ( "submit".equals( type ) || "reset".equals( type ) || "button".equals( type ) ) ) { 310 set( "value",getMsglbl() ); 311 rtn.append( XHTMLTag.input( getAttributes() ) ); 312 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 313 } 314 else { 315 // 4.3.7.1 (2009/06/08) id=labelのclass? 316 // rtn.append( "<span id=\"label\">" ); 317 rtn.append( "<span class=\"label\">" ); 318 rtn.append( getLongLabel() ); // 4.0.0 (2005/01/31) 319 rtn.append( CLM ); 320 rtn.append( "</span>" ); 321 rtn.append( XHTMLTag.input( getAttributes() ) ); 322 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 323 } 324 rtn.append( makeAimaiPicker( get("name") ) ); // 5.8.4.2(2015/02/20) 325 if( getMustType() != null ) { rtn.append( makeMustHidden( get( "name" ) ) ); } // 5.6.2.2 (2013/03/15) 326 } 327 else { 328 if( type != null && ( "submit".equals( type ) || "reset".equals( type ) || "button".equals( type ) ) ) { 329 set( "value",getMsglbl() ); 330 rtn.append( XHTMLTag.input( getAttributes() ) ); 331 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 332 } 333 else { 334 rtn.append( XHTMLTag.input( getAttributes() ) ); 335 if( body != null ) { rtn.append( body ); } // 4.0.0 (2007/05/30) BODY部の評価 336 } 337 rtn.append( makeAimaiPicker( get("name") ) ); // 5.8.4.2(2015/02/20) 338 if( getMustType() != null ) { rtn.append( makeMustHidden( get( "name" ) ) ); } // 5.6.2.2 (2013/03/15) 339 } 340 341 // 5.2.1.0 (2010/10/01) must , mustAny 属?を?動化します? 342 // 5.6.2.2 (2013/03/15) tdの外に出力される不正形を正しま? 343 // if( getMustType() != null ) { rtn.append( makeMustHidden( get( "name" ) ) ); } 344 345 return rtn.toString() ; 346 } 347 348 /** 349 * 【HTML】名前を?します? 350 * 351 * @og.tag 352 * <og:input name="PN" /> 353 * 354 * @param name 名前 355 */ 356 public void setName( final String name ) { 357 set( "name",getRequestParameter( name ) ); 358 } 359 360 /** 361 * 【HTML】表示形式を?しま?初期値:text)? 362 * 363 * @og.tag 364 * 通常は、表示形式[text/password/checkbox/radio/submit/reset/button/image/file]を指定します? 365 * HTML5 で追?れた形式[search/tel/url/email/datetime/date/month/week/time/datetime-local/number/range/color] 366 * も?設定できます? 367 * 368 * HTML5 の機?を有効にするには、ネイ?ブモードで動作させる?があります? 369 * ?USE_IE7_HEADER = "false" に設定する? 370 * ② USE_HTML5_HEADER = "true" に設定する? 371 * ③ IEの??ル⇒互換表示設定で、互換表示に追?たWebサイトから削除する? 372 * ④ 同上?設定で、イントラサイトを互換表示で表示するのチェ?を外す? 373 * ?があります? 374 * 375 * <og:input type="text" /> ?スト??スを表示 376 * <og:input type="password" /> パスワード専用?スト??スを表示 377 * <og:input type="checkbox" /> チェ?ボックスを表示 378 * <og:input type="radio" /> ラジオボタンを表示 379 * <og:input type="submit" /> 送信実行?タンを表示 380 * <og:input type="reset" /> 入力したフィールド?容を?てリセ? 381 * <og:input type="button" /> ボタンを表示 382 * <og:input type="image" /> イメージを表示してクリ?した座標を返す 383 * <og:input type="file" /> ファイル名?力??スを表示 384 * <og:input type="hidden" /> 表示させずにサーバ?に送信する??タ 385 * 386 * HTML5 で追?れたタイ? 387 * <og:input type="search" /> 検索?スト?入力?作?する 388 * <og:input type="tel" /> 電話番号の入力?作?する 389 * <og:input type="url" /> URLの入力?作?する 390 * <og:input type="email" /> メールアドレスの入力?作?する 391 * <og:input type="datetime" /> UTC?協定世界時)による日時?入力?作?する 392 * <og:input type="date" /> 日付?入力?作?する 393 * <og:input type="month" /> 月?入力?作?する 394 * <og:input type="week" /> 週の入力?作?する 395 * <og:input type="time" /> 時間の入力?作?する 396 * <og:input type="datetime-local" /> UTC?協定世界時)によらな?ーカル日時?入力?作?する 397 * <og:input type="number" /> 数値の入力?作?する 398 * <og:input type="range" /> レンジの入力?作?する 399 * <og:input type="color" /> 色の入力?作?する 400 * 401 * @og.rev 5.7.1.0 (2013/12/06) HTML5 対? 402 * 403 * @param type 表示形式[text/password/checkbox/radio/submit/reset/button/image/file]、HTML5用 [search/tel/url/email/datetime/date/month/week/time/datetime-local/number/range/color] 404 */ 405 public void setType( final String type ) { 406 String tp = getRequestParameter( type ); 407 408 if( check( "|" + tp + "|" , CHECK_TYPE ) ) { 409 set( "type",tp ); 410 } 411 else { 412 String errMsg = "type 属?は、下記?中から選択してください。type=[" 413 + tp + " in [" + CHECK_TYPE + "]"; 414 throw new HybsSystemException( errMsg ); 415 } 416 } 417 418 /** 419 * 【HTML】このフィールドに設定する?を指定します? 420 * 421 * @og.tag 422 * type属?の値?radio"?checkbox"以外?場合?こ?属?は省略可能です? 423 *<og:input name="PN" value="syokichi" /> 424 * 425 * @param value 初期値 426 */ 427 public void setValue( final String value ) { 428 set( "value",getRequestParameter( value ) ); 429 } 430 431 /** 432 * 【HTML】横??しま?typeがtextまた?passwordの場合??数で、それ以外?ピクセル)? 433 * 434 * @og.tag 435 * <og:input name="PN" size="20" /> 436 * 437 * @param size 横? 438 */ 439 public void setSize( final String size ) { 440 set( "size",getRequestParameter( size ) ); 441 } 442 443 /** 444 * 【HTML】最大入力文字数を指定しま?typeがtextまた?passwordの場?? 445 * 446 * @og.tag 447 * ??数はsize?を?得るが??た?合ユーザエージェント?スクロール機構を提供する?があります? 448 *こ?属?の初期値は「無制限?です? 449 *<og:input name="PN" maxlength="20" /> 450 * 451 * @og.rev 3.5.4.2 (2003/12/15) ?入力制限数に応じたサイズ自動生成を入れます? 452 * @og.rev 3.5.4.5 (2004/01/23) CSSで処?る?合?クラス属?は、maxlength ???以下?場合とする? 453 * @og.rev 4.0.0.0 (2005/01/31) getFieldSize メソ??XHTMLTag から DBColumn へ移? 454 * 455 * @param maxlength ?入力文字数 456 */ 457 public void setMaxlength( final String maxlength ) { 458 String mlen = nval( getRequestParameter( maxlength ),null ) ; 459 set( "maxlength",mlen ); 460 if( get( "size" ) == null && mlen != null ) { 461 // 4.0.0 (2005/01/31) getFieldSize メソ??XHTMLTag から DBColumn へ移? 462 int size = Integer.parseInt( mlen ); 463 if( size > COLUMNS_MAXSIZE ) { size = COLUMNS_MAXSIZE; } 464 set( "size",String.valueOf( size ) ); 465 } 466 467 // 3.5.4.5 (2004/01/23) 追? 468 if( mlen != null && mlen.length() == 1 ) { 469 char ch = mlen.charAt(0); 470 if( ch >= '1' && ch <= '5' ) { 471 add( "class", "S0" + ch ); // 3.5.5.9 (2004/06/07) セパレータ引数付きのメソ?に変更 472 } 473 } 474 } 475 476 /** 477 * 【HTML】type ?checkbox ?radio のとき?初めから選択された状態で表示しま?"checked"のみ?可)? 478 * 479 * @og.tag 480 * 481 * <og:input name="PN" type="checkbox" checked="checked" /> 482 * 483 * @param ch 選択された状態にするかど?[checked:選択状?そ??なにもしない] 484 */ 485 public void setChecked( final String ch ) { 486 String checked = getRequestParameter( ch ); 487 if( "checked".equals( checked )) { 488 set( "checked","checked" ); 489 } 490 } 491 492 /** 493 * 【HTML】type ?image の場合?送信ボタンとして利用する画像?URLをセ?します? 494 * 495 * @og.tag src セ? 496 * 497 * @param src 画像?URL 498 */ 499 public void setSrc( final String src ) { 500 set( "src",getRequestParameter( src ) ); 501 } 502 503 /** 504 * 【HTML】type ?image の場合で、画像が表示できな??合?代替?ストをセ?します? 505 * 506 * @og.tag alt セ? 507 * 508 * @param alt 代替?ス? 509 */ 510 public void setAlt( final String alt ) { 511 set( "alt",getRequestParameter( alt ) ); 512 } 513 514 /** 515 * 【HTML】type ?file の場合に、MIMEタイプをCSV形式で???来ます? 516 * 517 * @og.tag accept セ? 518 * 519 * @param accept MIMEタイ?CSV形? 520 */ 521 public void setAccept( final String accept ) { 522 set( "accept",getRequestParameter( accept ) ); 523 } 524 525 /** 526 * 【HTML】type ?image の場合?クライアントサイド?イメージマップ?URLを指定します? 527 * 528 * @og.tag usemap セ? 529 * 530 * @param usemap クライアントサイド?イメージマップ?URL 531 */ 532 public void setUsemap( final String usemap ) { 533 set( "usemap",getRequestParameter( usemap ) ); 534 } 535 536 /** 537 * 【HTML】type ?image の場合に、サーバ?サイド?イメージマップを使用する場合に?します? 538 * 539 * @og.tag ismap セ? 540 * 541 * @param ismap サーバ?サイド?イメージマップを使用する場合に?? 542 */ 543 public void setIsmap( final String ismap ) { 544 set( "ismap",getRequestParameter( ismap ) ); 545 } 546 547 /** 548 * 【TAG】テーブル形式? <td> タグを使用するかど?[yes/no/false]を指定しま?初期値:yes)? 549 * 550 * @og.tag 551 * 通常(初期値:yes)は、テーブル形式?<td> タグを使用して、ラベルとフィールドを整列させます? 552 * no の場合?、tdタグを使用せず、ラベルとフィールドを連続して出力します? 553 * false は、ラベルを?力せず?フィールド?み出力します? 554 * <og:input name="PN" td="false" /> 555 * 556 * @og.rev 2.0.0.8 (2002/10/09) yes/no/false で?するよ?変更 557 * 558 * @param flag [yes:tdタグを使用/no:ラベルとフィール?false:フィールド?み] 559 */ 560 public void setTd( final String flag ) { 561 String td = nval( getRequestParameter( flag ),td_flag ); 562 563 if( check( "|" + td + "|" , "|yes|no|false|" ) ) { 564 td_flag = td; 565 } 566 else { 567 String errMsg = "td 属?は、下記?中から選択してください。td=[" 568 + td + " in [|true|false|label|]"; 569 throw new HybsSystemException( errMsg ); 570 } 571 } 572 573 /** 574 * 【TAG】ラベルをCSV形式で??します? 575 * 576 * @og.tag 577 * シングルラベルの lbl 属?との違いは,ここではラベルを? カンマ区?で 578 * 渡すことが可能であることです?これにより?A,B,C" と?値に対して? 579 * "Aのラベル表示,Bのラベル表示,Cのラベル表示" と?具合に??? 580 * 再合成します? 581 * これは、SQL??Order By 句で、ソート?を指定する?合などに便利です? 582 * 583 * <og:orderBy columns="MKNMJP,MKCD,MKNMEN" lbls="MKNMJP,MKCD,MKNMEN" /> 584 * 585 * @og.rev 3.5.6.2 (2004/07/05) 先に配?に?してからリクエスト変数の値を取? 586 * @og.rev 5.2.2.0 (2010/11/01) setMsglbl ? ?setLbl に置換え 587 * 588 * @param lbls ?ラベルID(カンマ区?) 589 */ 590 public void setLbls( final String lbls ) { 591 592 String[] array = getCSVParameter( lbls ); 593 594 StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 595 596 buf.append( getLabel( array[0] ) ); 597 for( int i=1; i<array.length; i++ ) { 598 buf.append( "," ); 599 buf.append( getLabel( array[i] ) ); 600 } 601 // setMsglbl( buf.toString() ); 602 setLbl( buf.toString() ); // 5.2.2.0 (2010/11/01) setMsglbl ? ?setLbl に置換え 603 } 604 605 /** 606 * 【TAG】フィールド部?? colspan を指定します? 607 * 608 * @og.tag 609 * 通常は、ラベルとフィールドが、別のtdで囲われます?しかし?場合によっては? 610 * フィールド部の長?ラ?ある場合?上下?カラ?の位置関係がおかしくなり? 611 * ラベルとフィールドが離れて表示されるケースがあります? 612 * こ?場合?長?ィールド部を持つカラ?、colspan 属?を指定すると? 613 * そ???カラ?割り当てることにより、上下?カラ?の位置関係を 614 * 調?ることが可能になります? 615 * 通常は? を指定して、フィールド?ラベル、フィールド? 616 * ?合わせ部???ィールドが適用されるよ?使用します? 617 * 618 * <og:input name="PN" colspan="3" /> 619 * 620 * @og.rev 3.0.1.4 (2003/03/17) colspan 属?を追?? 621 * 622 * @param sp フィールド部??colspan 623 */ 624 public void setColspan( final String sp ) { 625 colspan = nval( getRequestParameter( sp ),colspan ); 626 if( colspan.length() > 0 ) { 627 colspan = " colspan=\"" + colspan + "\" "; 628 } 629 } 630 631 /** 632 * 【TAG】?力カーソルを指定されたname属?のフィールドへ自動的に移動します? 633 * 634 * @og.tag 635 * JavaScript の onKeyup イベントを利用して、最大桁数まで入力すると? 636 * 次のフィールドに、?動的に飛?ように設定します? 637 * 引数は、次に飛?すフィールド? name 属?です? 638 * 実行するには、JavaScript の nextForm ファンクションが?です?(default.js で?? 639 * 640 * @og.rev 3.5.4.2 (2003/12/15) 新規追? 641 * 642 * @param name 次にフォーカスを移すタグのname属? 643 */ 644 public void setNextForm( final String name ) { 645 nextForm = nval( getRequestParameter( name ),nextForm ); 646 } 647 648 /** 649 * こ?オブジェクト???表現を返します? 650 * 基本???目?使用します? 651 * 652 * @return こ?クラスの??表現 653 */ 654 @Override 655 public String toString() { 656 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() ) 657 .println( "VERSION" ,VERSION ) 658 .println( "td_flag" ,td_flag ) 659 .println( "colspan" ,colspan ) 660 .println( "nextForm" ,nextForm ) 661 .println( "CHECK_TYPE" ,CHECK_TYPE ) 662 .println( "HTML_LABEL_SEPARATOR" ,CLM ) 663 .println( "HTML_COLUMNS_MAXSIZE" ,COLUMNS_MAXSIZE ) 664 .println( "Other..." ,getAttributes().getAttribute() ) 665 .fixForm().toString() ; 666 } 667 }