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