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?šあã‚?EVAL_BODY_BUFFERED:BODYを評価しã?{@XXXX} を解析しまã�?
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 * autofocus 【HTML5】指定したå?力æ¬?�«カーソルが当たって自動的にフォーカスされますã?
072 * placeholder 【HTML5】å?力æ¬?�«初期表示するå†?®¹を指定しますã?
073 * required 【HTML5】å?力å¿??を指定しまã�?
074 * roles 【TAG】ロールをセãƒ?ƒˆしまã�?
075 * debug 【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
076 * > ... Body ...
077 * </og:textarea>
078 *
079 * ●使用ä¾?
080 * <og:textarea name="BUN" />
081 *
082 * <og:textarea name="BUN"> 初期値に値をセãƒ?ƒˆしたã�?�¨ã�?
083 * test
084 * </og:textarea name="BUN">
085 *
086 * @og.group 画面部å“?
087 *
088 * @version 4.0
089 * @author Kazuhiko Hasegawa
090 * @since JDK5.0,
091 */
092 public class TextareaTag extends HTMLTagSupport {
093 //* こã?プログラãƒ??VERSIONæ–?—å?を設定しますã? {@value} */
094 private static final String VERSION = "5.2.1.0 (2010/10/01)" ;
095
096 private static final long serialVersionUID = 521020101001L ;
097
098 /**
099 * Taglibの開始タグが見つかったときに処ç�?�™ã‚?doStartTag() ã‚?オーバã?ライドしますã?
100 *
101 * @return 後続å?ç�??æŒ?¤º( EVAL_BODY_BUFFERED )
102 */
103 @Override
104 public int doStartTag() {
105 return( EVAL_BODY_BUFFERED ); // Body を評価するã€? extends BodyTagSupport æ™?
106 }
107
108 /**
109 * Taglibのタグ本体を処ç�?�™ã‚?doAfterBody() ã‚?オーバã?ライドしますã?
110 *
111 * @og.rev 3.1.1.0 (2003/03/28) ボディのå†?®¹を取得するå?ç�?‚’、CommonTagSupport で行うã€?
112 * @og.rev 3.1.1.0 (2003/03/28) body 属æ?にã€?{@XXXX} パã?ス機è?を付加するã€?
113 *
114 * @return 後続å?ç�??æŒ?¤º(SKIP_BODY)
115 */
116 @Override
117 public int doAfterBody() {
118 String str = getBodyString();
119
120 if( str != null && str.length() > 0 ) {
121 String label = StringUtil.htmlFilter( str );
122 if( label != null && label.length() > 0 ) {
123 set( "body",label );
124 }
125 }
126
127 return(SKIP_BODY);
128 }
129
130 /**
131 * 検索条件の入力用のãƒ?‚ストフィールドを作æ?しますã?
132 *
133 * ãƒ??ブルタグによりフィールドã?åˆ?‰²されますã?
134 * 使用時ã?、テーブルタグを前後に使用して下さã�??
135 *
136 * @og.rev 4.3.7.1 (2009/06/08) id=labelのclassåŒ?
137 * @og.rev 5.2.1.0 (2010/10/01) must , mustAny 属æ?をè?動化しますã?
138 *
139 * @return 入力用のãƒ?‚ストフィールドタグ
140 */
141 @Override
142 protected String makeTag() {
143 StringBuilder rtn = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
144 if( getMsglbl() == null ) { setLbl( get( "name" ) ); }
145
146 // 4.3.7.1 (2009/06/08) id=labelのclassåŒ?
147 // rtn.append( "<td id=\"label\">" );
148 rtn.append( "<td class=\"label\">" );
149 rtn.append( getLongLabel() ); // 4.0.0 (2005/01/31)
150 rtn.append( "</td>" );
151 rtn.append( "<td>" );
152 rtn.append( XHTMLTag.textarea( getAttributes() ) );
153 rtn.append( "</td>" );
154
155 // 5.2.1.0 (2010/10/01) must , mustAny 属æ?をè?動化しますã?
156 if( getMustType() != null ) { rtn.append( makeMustHidden( get( "name" ) ) ); }
157
158 return rtn.toString() ;
159 }
160
161 /**
162 * 【HTML】名前をæŒ?®šしますã?
163 *
164 * @og.tag 名前を指定しますã?
165 *
166 * @param name 名前
167 */
168 public void setName( final String name ) {
169 set( "name",getRequestParameter( name ) );
170 }
171
172 /**
173 * 【HTML】高さ(行数)を指定しますã?
174 *
175 * @og.tag 高さ(行数)を指定しますã?
176 *
177 * @param rows 高さ(行数)
178 */
179 public void setRows( final String rows ) {
180 set( "rows",getRequestParameter( rows ) );
181 }
182
183 /**
184 * 【HTML】横å¹?カラãƒ?•°)を指定しますã?
185 *
186 * @og.tag 横å¹?‚’æŒ?®šしますã?
187 *
188 * @param cols 横å¹?カラãƒ?•°)
189 */
190 public void setCols( final String cols ) {
191 set( "cols",getRequestParameter( cols ) );
192 }
193 }