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