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.fukurou.util.XHTMLTag; 020 021 import org.opengion.fukurou.util.StringUtil; 022 023 /** 024 * 【?力??行?入力が可能な?スト?力フィールドを作?するHTML拡張タグです? 025 * 026 * name 属?に ラベルリソース のキーを与えることで?ロケールにあわせたリソースを使用して? 027 * 画面に表示します? 028 * ロケールは、ユーザー??の lang 属?を?期?で使用し? セ?されて???合?? 029 * リクエスト情報のロケールから取得します? 030 * ラベル部?入力フィールド部???ブルタグの <td> により左右に?されます? 031 * HTML 表示時?、前後に<tr>タグで囲って?整形できます? 032 * 033 * @og.formSample 034 * ●形式?lt;og:queryOption > 035 * SELECT? 036 * </og:queryOption > 037 * ●body?あ? 038 * 039 * ●Tag定義?? 040 * <og:textarea 041 * name ○?HTML】名前を?します?(??) 042 * lbl 【TAG】ラベルリソースのラベルIDを指定しま? 043 * rows 【HTML】高さ(行数)を指定しま? 044 * cols 【HTML】横?カラ?)を指定しま? 045 * must 【TAG】??入力を表す色に変えるかど?[true/false]を指定しま?初期値:false) 046 * mustAny 【TAG】選択??入?どれかひとつ??)を表す色[true/mustAny/そ?他]を指定しま?初期値:無?? 047 * id 【HTML】要?対して固有?名前(id)をつける場合に設定しま? 048 * lang 【HTML】要???と他?属?値の??lang,xml:lang)を指定しま? 049 * dir 【HTML】文字表記?方?dir)を指定しま? 050 * title 【HTML】要?対する補足?報(title)を設定しま? 051 * style 【HTML】この要?対して適用させるスタイルシー?style)を設定しま? 052 * readonly 【TAG】その部品に対して変更が?来な??(readonly)?しま?サーバ?に送信され? 053 * disabled 【TAG】その部品に対して?択や変更が?来な??(disabled)?しま?サーバ?に送信されな? 054 * tabindex 【HTML】タブ?移動?(tabindex)を指定しま?0 ??32767) 055 * accesskey 【HTML】アクセスキー(alt+キーで直接??を割り当てま? 056 * clazz 【HTML】要?対して class 属?を設定しま? 057 * language 【TAG】タグ?で使用する?コード[ja/en/zh/…]を指定しま? 058 * onClick 【HTML】JavaScriptのイベン?onClick を設定しま??onClick="renew('query.jsp','QUERY');") 059 * onBlur 【HTML】JavaScriptのイベン?onBlur を設定しま??onBlur="this.value=value.toUpperCase();") 060 * onFocus 【HTML】JavaScriptのイベン?onFocus を設定しま? 061 * ondblClick 【HTML】JavaScriptのイベン?ondblClick を設定しま? 062 * onMouseDown 【HTML】JavaScriptのイベン?onMouseDown を設定しま? 063 * onMouseUp 【HTML】JavaScriptのイベン?onMouseUp を設定しま? 064 * onMouseMove 【HTML】JavaScriptのイベン?onMouseMove を設定しま? 065 * onMouseOut 【HTML】JavaScriptのイベン?onMouseOut を設定しま? 066 * onMouseOver 【HTML】JavaScriptのイベン?onMouseOver を設定しま? 067 * onSelect 【HTML】JavaScriptのイベン?onSelect を設定しま? 068 * onKeydown 【HTML】JavaScriptのイベン?onKeydown を設定しま? 069 * onKeypress 【HTML】JavaScriptのイベン?onKeypress を設定しま? 070 * onKeyup 【HTML】JavaScriptのイベン?onKeyup を設定しま? 071 * roles 【TAG】ロールをセ?しま? 072 * debug 【TAG】デバッグ??を?力するかど?[true/false]を指定しま?初期値:false) 073 * > ... Body ... 074 * </og:textarea> 075 * 076 * ●使用? 077 * <og:textarea name="BUN" /> 078 * 079 * <og:textarea name="BUN"> 初期値に値をセ?した?? 080 * test 081 * </og:textarea name="BUN"> 082 * 083 * @og.group 画面部? 084 * 085 * @version 4.0 086 * @author Kazuhiko Hasegawa 087 * @since JDK5.0, 088 */ 089 public class TextareaTag extends HTMLTagSupport { 090 //* こ?プログラ??VERSION??を設定します? {@value} */ 091 private static final String VERSION = "5.2.1.0 (2010/10/01)" ; 092 093 private static final long serialVersionUID = 521020101001L ; 094 095 /** 096 * Taglibの開始タグが見つかったときに処??doStartTag() ?オーバ?ライドします? 097 * 098 * @return 後続????( EVAL_BODY_BUFFERED ) 099 */ 100 @Override 101 public int doStartTag() { 102 return( EVAL_BODY_BUFFERED ); // Body を評価する? extends BodyTagSupport ? 103 } 104 105 /** 106 * Taglibのタグ本体を処??doAfterBody() ?オーバ?ライドします? 107 * 108 * @og.rev 3.1.1.0 (2003/03/28) ボディの?を取得する??、CommonTagSupport で行う? 109 * @og.rev 3.1.1.0 (2003/03/28) body 属?に?{@XXXX} パ?ス機?を付加する? 110 * 111 * @return 後続????(SKIP_BODY) 112 */ 113 @Override 114 public int doAfterBody() { 115 String str = getBodyString(); 116 117 if( str != null && str.length() > 0 ) { 118 String label = StringUtil.htmlFilter( str ); 119 if( label != null && label.length() > 0 ) { 120 set( "body",label ); 121 } 122 } 123 124 return(SKIP_BODY); 125 } 126 127 /** 128 * 検索条件の入力用の?ストフィールドを作?します? 129 * 130 * ??ブルタグによりフィールド??されます? 131 * 使用時?、テーブルタグを前後に使用して下さ?? 132 * 133 * @og.rev 4.3.7.1 (2009/06/08) id=labelのclass? 134 * @og.rev 5.2.1.0 (2010/10/01) must , mustAny 属?を?動化します? 135 * 136 * @return 入力用の?ストフィールドタグ 137 */ 138 @Override 139 protected String makeTag() { 140 StringBuilder rtn = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 141 if( getMsglbl() == null ) { setLbl( get( "name" ) ); } 142 143 // 4.3.7.1 (2009/06/08) id=labelのclass? 144 // rtn.append( "<td id=\"label\">" ); 145 rtn.append( "<td class=\"label\">" ); 146 rtn.append( getLongLabel() ); // 4.0.0 (2005/01/31) 147 rtn.append( "</td>" ); 148 rtn.append( "<td>" ); 149 rtn.append( XHTMLTag.textarea( getAttributes() ) ); 150 rtn.append( "</td>" ); 151 152 // 5.2.1.0 (2010/10/01) must , mustAny 属?を?動化します? 153 if( getMustType() != null ) { rtn.append( makeMustHidden( get( "name" ) ) ); } 154 155 return rtn.toString() ; 156 } 157 158 /** 159 * 【HTML】名前を?します? 160 * 161 * @og.tag 名前を指定します? 162 * 163 * @param name 名前 164 */ 165 public void setName( final String name ) { 166 set( "name",getRequestParameter( name ) ); 167 } 168 169 /** 170 * 【HTML】高さ(行数)を指定します? 171 * 172 * @og.tag 高さ(行数)を指定します? 173 * 174 * @param rows 高さ(行数) 175 */ 176 public void setRows( final String rows ) { 177 set( "rows",getRequestParameter( rows ) ); 178 } 179 180 /** 181 * 【HTML】横?カラ?)を指定します? 182 * 183 * @og.tag 横??します? 184 * 185 * @param cols 横?カラ?) 186 */ 187 public void setCols( final String cols ) { 188 set( "cols",getRequestParameter( cols ) ); 189 } 190 }