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