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 static org.opengion.fukurou.util.StringUtil.nval;
019    
020    import org.opengion.fukurou.util.Attributes;
021    import org.opengion.fukurou.util.XHTMLTag;
022    import org.opengion.hayabusa.common.HybsSystem;
023    import org.opengion.hayabusa.db.DBColumn;
024    import org.opengion.hayabusa.db.DBEditConfig;
025    
026    /**
027     * query.jsp での検索ボタンを表示します?
028     * 検索ボタン以外に、pageSize、maxRowCount、prevNext、timeView などの
029     * ?も表示可能です?
030     * また?BODY部に登録した値は、table 要?して、td 部に追記されます?
031     *
032     * @og.formSample
033     * ●形式?lt;og:queryButton />
034     * ●body?あ?EVAL_BODY_BUFFERED:BODYを評価し?{@XXXX} を解析しま?
035     *
036     * ●Tag定義??
037     *   <og:queryButton
038     *       command            【TAG】リクエストとして送信するコマンドを?しま?初期値:NEW)
039     *       pageSize           【TAG】pageSize プル?ンメニューの初期値を指定しま?(初期値:HTML_PAGESIZE[=100])
040     *       maxRowCount        【TAG】maxRowCount プル?ンメニューの初期値を指定しま?(初期値:DB_MAX_ROW_COUNT[=1000])
041     *       useCrear           【TAG】JavaScriptによる初期化?タンを使用するかど?[true/false]を指定しま?初期値:true)
042     *       type               【TAG】?型的なボタンの形状に設定しま?初期値:null)
043     *       scope              【TAG】リクエストとして送信するスコープを?しま?初期値:null)
044     *       lbl                【TAG】ラベルリソースのラベルIDを指定しま?
045     *       accesskey          【TAG】検索ボタンに使用するショートカ?キー?を?しま?初期値:F)
046     *       usePrevNext        【TAG】??戻る?prev_next リンクを表示するかど?を指定しま?初期値:true)
047     *       usePageSize        【TAG】pageSize 引数を使用するかど?を指定しま?初期値:true)
048     *       useRowCount        【TAG】maxRowCount 引数を使用するかど?を指定しま?初期値:true)
049     *       useTimeView        【TAG】??間を表示する TimeView を表示するかど?を指定しま?初期値:true)
050     *       clearAccesskey     【TAG】クリアボタンに使用するショートカ?キー?を?しま?初期値:C)
051     *       useDummy           【TAG】IE用?ーinputを?力するかど?
052     *       debug              【TAG】デバッグ??を?力するかど?[true/false]を指定しま?初期値:false)
053     *   >   ... Body ...
054     *   </og:queryButton>
055     *
056     * ●使用?
057     *    <og:queryButton
058     *        command     = "NEW"      NEW:通常の検索(初期値)?ENTRY:エントリ登録?
059     *        type        = "ENTRY"    null:標?, SELECT:検索ボタンのみ , ENTRY:登録ボタンのみ
060     *        pageSize    = "100"      pageSize の初期値設?初期値:HTML_PAGESIZE)
061     *        maxRowCount = "100"      maxRowCount の初期値設?初期値:DB_MAX_ROW_COUNT)
062     *        useCrear    = "true"     true:JavaScriptによる初期化/false:通常のresetボタン
063     *        scope       = "request"  null(初期値)?session:セ?ョン登録?request:リクエスト登録
064     *        msg         = "MSG0010"  検索ボタンに表示するメ?ージID(初期値:MSG0010)
065     *        accesskey   = "F"        ショートカ?キー??初期値:F)
066     *        usePrevNext = "true"     Prev-Nextリンクを使用するかど?(初期値:true)
067     *        usePageSize = "true"     pageSize 引数を使用するかど?(初期値:true)
068     *        useRowCount = "true"     maxRowCount 引数を使用するかど?(初期値:true)
069     *        useTimeView = "true"     timeView表示(実行時間表示)を使用するかど?(初期値:true)
070     *    />
071     *
072     *  標準的な検索ボタン
073     *    <og:queryButton />
074     *
075     *  標準的な登録ボタン(command="NEW" で、query.jsp で使用するボタン)
076     *    <og:queryButton type="ENTRY" />
077     *
078     *  BODY 部に追??表示
079     *    <og:queryButton >
080     *        <td><jsp:directive.include file="/jsp/common/timeViewImage.jsp" /></td>
081     *    </og:queryButton >
082     *
083     * @og.rev 4.0.0.0 (2005/01/31) 新規作?
084     * @og.group 画面制御
085     *
086     * @version  4.0
087     * @author   Kazuhiko Hasegawa
088     * @since    JDK5.0,
089     */
090    public class QueryButtonTag extends CommonTagSupport {
091            //* こ?プログラ??VERSION??を設定します?       {@value} */
092            private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
093    
094            private static final long serialVersionUID = 4000 ;     // 4.0.0 (2005/01/31)
095    
096            private static final String CR = HybsSystem.CR;
097    
098            private static final String COMMAND     =
099                    "<input type=\"hidden\" name=\"command\" value=\"NEW\" id=\"h_cmd\" />";
100    
101            private static final String JSP = HybsSystem.sys( "JSP" );
102    
103            // 4.2.1.0 (2008/04/07) TDにIDを追?
104            // 4.3.1.0 (2008/09/03) 戻る?進??タンをsubmitにより実行する?
105            private static final String PREV_NEXT =
106                    "<td id=\"prev-next\"><a href=\"forward.jsp?command=FIRST\" target=\"RESULT\" >"            + CR +
107                    "  <img src=\"" + JSP + "/image/FIRST.gif\" alt=\"FIRST\" border=\"0px\" " + CR +
108                    "    onclick=\"return submitPrevNextForm('FIRST');\"/>"      + CR +
109                    "</a>"                                                                                                                            + CR +
110                    "<a href=\"forward.jsp?command=PREV\" target=\"RESULT\" >"                        + CR +
111                    "  <img src=\"" + JSP + "/image/PREV.gif\" alt=\"PREV\" border=\"0px\" "     + CR +
112                    "    onclick=\"return submitPrevNextForm('PREV');\"/>"       + CR +
113                    "</a>"                                                                                                                            + CR +
114                    "<a href=\"forward.jsp?command=NEXT\" target=\"RESULT\" >"                        + CR +
115                    "  <img src=\"" + JSP + "/image/NEXT.gif\" alt=\"NEXT\" border=\"0px\" "     + CR +
116                    "    onclick=\"return submitPrevNextForm('NEXT');\"/>"       + CR +
117                    "</a>"                                                                                                                            + CR +
118                    "<a href=\"forward.jsp?command=LAST\" target=\"RESULT\" >"                        + CR +
119                    "  <img src=\"" + JSP + "/image/LAST.gif\" alt=\"LAST\" border=\"0px\" "     + CR +
120                    "    onclick=\"return submitPrevNextForm('LAST');\"/>"       + CR +
121                    "</a></td>" + CR ;
122    
123            private static final String TIME_VIEW =         // 4.2.1.0 (2008/04/07) 直接色?を?る?
124                    "<td><table cellspacing=\"0\" cellpadding=\"0\">"   + CR +
125                    "<tr>"                                                                                            + CR +
126                    "<td width=\"20px\"> </td>"                                                 + CR +
127                    "<td width=\"0px\" id=\"queryTbl\" title=\"\" ></td>" + CR +        // #ff0000
128                    "<td width=\"0px\" id=\"viewTbl\"  title=\"\" ></td>" + CR +        // #0000ff
129                    "<td width=\"0px\" id=\"pageTbl\"  title=\"\" ></td>" + CR +        // #00ff00
130                    "<td width=\"10px\"></td>"                                          + CR +
131                    "<td style=\"background-color:transparent;\" id=\"totalTbl\"></td>" + CR +
132                    "</tr>"                                                                                   + CR +
133                    "</table></td>" + CR ;
134    
135            // 4.3.6.0 (2009/04/01) 件数を?タンで開閉させ?
136            private static final String COUNT_SWITCH=
137                    "<td>" +
138    //              "  <img id=\"queryHide\" src=\"" + JSP + "/image/expand_r.png\" alt=\"Expand\" border=\"0px\" "+
139                    "  <img id=\"queryHide\" src=\"" + JSP + "/image/expand_r.png\" alt=\"pageSize\" border=\"0px\" "+   // 5.5.3.2 (2012/06/08)
140                                    " onClick=\"hideClass( event, this, 'hide', 'expand_r', 'shrink_r' )\"> "    + CR +
141                    "</td>";
142            
143            // 5.6.1.0 (2013/02/01) display:noneの?ー出?
144            private static final String DUMMY_INPUT = "HYBS_DUMMY_NPUT";
145    
146            private String  command         = "NEW";
147            private String  pageSize        = null;
148            private String  maxRowCount     = null;
149            private String  accesskey       = "F";
150            private boolean useCrear        = true;
151            private String  type            = null;         // null:標?, SELECT:検索ボタンのみ , ENTRY:登録ボタンのみ
152            private String  scope           = null;
153            private boolean usePrevNext     = true;
154            private boolean usePageSize     = true;
155            private boolean useRowCount     = true;
156            private boolean useTimeView     = true;
157            private String  body            = null;
158            private String  clearAcskey     = "C";
159            private boolean useDummy        = HybsSystem.sysBool( "USE_DUMMY_INPUT" ); // 5.6.1.0 (2013/02/01)
160    
161            /**
162             * Taglibの開始タグが見つかったときに処??doStartTag() ?オーバ?ライドします?
163             *
164             * @return      後続????( EVAL_BODY_BUFFERED )
165             */
166            @Override
167            public int doStartTag() {
168                    return( EVAL_BODY_BUFFERED );   // Body を評価する? extends BodyTagSupport ?
169            }
170    
171            /**
172             * Taglibのタグ本体を処??doAfterBody() ?オーバ?ライドします?
173             *
174             * @og.rev 2.2.0.0 (2002/12/17) 中国?国際化)対?エンコード?取得方法変更
175             * @og.rev 3.0.0.0 (2002/12/25) StringUtil#changeString ?
176             * @og.rev 3.1.1.0 (2003/03/28) ボディの?を取得する??、CommonTagSupport で行う?
177             *
178             * @return      後続????(SKIP_BODY)
179             */
180            @Override
181            public int doAfterBody() {
182                    body = nval( getBodyString(),body );
183    
184                    return(SKIP_BODY);
185            }
186    
187            /**
188             * Taglibの終?グが見つかったときに処??doEndTag() ?オーバ?ライドします?
189             *
190             * @og.rev 5.3.6.0 (2011/06/01) ??合計などのEdit機?に対応します?
191             * @og.rev 5.6.5.1 (2013/06/14) debugプル?ンの追??つ?に、PageSize と MaxRowCount の 表示条件を?整備します?
192             * @og.rev 5.6.9.4 (2013/10/31) editNameの初期値を外部から与えられるよ?する
193             *
194             * @return      後続????
195             */
196            @Override
197            public int doEndTag() {
198                    debugPrint();           // 4.0.0 (2005/02/28)
199                    StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
200    
201                    buf.append( getHiddenScope() ).append( CR );
202    
203                    buf.append( "<table border=\"0\" frame=\"border\" summary=\"submit\" ><tr>" );
204                    buf.append( CR );
205                    buf.append( "<td>" ).append( getSubmit()  ).append( "</td>" ).append( CR );
206                    buf.append( "<td>" ).append( getReset()           ).append( "</td>" ).append( CR );
207                    buf.append( "<td>" ).append( getCommand() ).append( "</td>" ).append( CR );
208                    buf.append( "<td>" ).append( getGamenId() ).append( "</td>" ).append( CR );
209                    if( usePrevNext ) { buf.append( PREV_NEXT               ).append( CR ); }
210                    buf.append( "<td>" ).append( "<span id=\"query-button-append\"></span>").append( "</td>" ).append( CR ); //4 3.6.0 (2009/04/01)
211                    // if( usePageSize ) { buf.append( getPageSize()        ).append( CR ); }
212                    // if( useRowCount ) { buf.append( getMaxRowCount()).append( CR ); }
213                    if( body != null ) {
214                            buf.append( "<td>" ).append( body ).append( "</td>" ).append( CR );
215                    }
216                    // 5.3.6.0 (2011/06/01) ??合計などのEdit機?に対応します?
217                    String guikey = getGUIInfoAttri( "KEY" );
218                    DBEditConfig[] configs = getUser().getEditConfigs( guikey );
219                    if( configs != null && configs.length > 0 ) {
220    //                      String selEditName = getUser().getSelectedEdit( getGUIInfoAttri( "KEY" ) );
221                            String selEditName = nval( getRequestValue( "editName" ) , getUser().getSelectedEdit( getGUIInfoAttri( "KEY" ) )); // 5.6.9.4 (2013/10/31)
222                            buf.append( getEditSelect( configs, selEditName ) ).append( CR );
223                    }
224    
225                    // 5.6.5.1 (2013/06/14) debugプル?ンの追??つ?に、PageSize と MaxRowCount の 表示条件を?整備します?
226    //              if( usePageSize || useRowCount){ buf.append( COUNT_SWITCH ).append( CR ); } // 4.3.6.0 (2009/04/01)
227    //              if( usePageSize ) { buf.append( getPageSize()   ).append( CR ); }
228    //              if( useRowCount ) { buf.append( getMaxRowCount()).append( CR ); }
229    
230                    if( usePageSize || useRowCount) {
231                            buf.append( COUNT_SWITCH ).append( CR );
232                            if( usePageSize ) { buf.append( getPageSize()   ).append( CR ); }
233                            if( useRowCount ) { buf.append( getMaxRowCount()).append( CR ); }
234                            // ??は、ユーザーのロールが?root の場合?み表示するようにします?
235                            if( "root".equalsIgnoreCase( getUser().getRoles() ) ) {
236                                    buf.append( getDebugClm() ).append( CR );                                               // 5.6.5.1 (2013/06/14) debugプル?ンの追?
237                            }
238                    }
239    
240                    if( useTimeView ) { buf.append( TIME_VIEW ).append( CR ); }
241    
242                    buf.append( "</tr></table>" ).append( CR );
243    
244                    jspPrint( buf.toString() );
245                    if( useDummy ){ jspPrint( getDummyInput() ); }// 5.6.1.0 (2013/02/01)
246                    return(EVAL_PAGE);              // ペ?ジの残りを評価する?
247            }
248    
249            /**
250             * タグリブオブジェクトをリリースします?
251             * キャ?ュされて再利用される?で、フィールド?初期設定を行います?
252             *
253             * @og.rev 5.6.1.0 (2013/02/01) useDummy
254             */
255            @Override
256            protected void release2() {
257                    super.release2();
258                    command         = "NEW";
259                    pageSize        = null;
260                    maxRowCount     = null;
261                    accesskey       = "F";
262                    useCrear        = true;
263                    type            = null;
264                    scope           = null;
265                    usePrevNext     = true;
266                    usePageSize     = true;
267                    useRowCount     = true;
268                    useTimeView     = true;
269                    clearAcskey     = "C"; // 5.3.5.0 (2011/05/01) クリアボタンアクセスキー対?
270                    useDummy        = HybsSystem.sysBool( "USE_DUMMY_INPUT" ); // 5.6.1.0 (2013/02/01)
271            }
272    
273            /**
274             * サブミ?ボタンを作?します?
275             *
276             * @og.rev 5.3.6.0 (2011/06/01) accessKeyを削除できるように対?
277             * @og.rev 5.5.7.1 (2012/10/05) 不要な括弧出力を削除
278             * @og.rev 5.6.9.3 (2013/10/25) IDを?力す?
279             *
280             * @return      サブミ?ボタン
281             */
282            private String getSubmit() {
283                    String msglbl = getLongLabel();         // 4.0.0 (2005/01/31)
284                    if( msglbl == null ) {
285                            if( "ENTRY".equalsIgnoreCase( type ) ) {
286                                    msglbl = getLabel( "ENTRY" );
287                            }
288                            else {
289                                    msglbl = getLabel( "QUERY" );
290                            }
291                    }
292    
293    //              String rtn = "<button type=\"submit\" accesskey=\"" + accesskey + "\">"
294    //                                      msglbl + "(" + accesskey + ")</button>" ;
295    //              String rtn = "<button type=\"submit\" "
296                    String rtn = "<button type=\"submit\" id=\"queryButtonSubmit\" " // 5.6.9.3 (2013/10/25)
297    //                                              + ( accesskey == null ? "" : "accesskey=\"" + accesskey + "\" )" )
298                                                    + ( accesskey == null ? "" : "accesskey=\"" + accesskey + "\"" )  // 5.5.7.1 (2012/10/05)
299                                                    + ">" + msglbl
300                                                    + ( accesskey == null ? "" : "(" + accesskey + ")" )
301                                                    +"</button>" ;
302    
303                    return rtn;
304            }
305    
306            /**
307             * リセ?ボタンを作?します?
308             *
309             * @og.rev 4.0.0.0 (2007/10/18) メ?ージリソース統? getResource().getMessage > getResource().getLabel )
310             * @og.rev 5.0.2.0 (2009/11/01) 戻る?タンが?力されて?状態で、クリアボタンを押すと、戻る?タンが消える不?合を修正
311             * @og.rev 5.3.5.0 (2011/05/01) クリアボタンにもアクセスキーが付加できるように対?
312             * @og.rev 5.3.6.0 (2011/06/01) accessKeyを削除できるように対?
313             *
314             * @return      リセ?ボタン
315             */
316            private String getReset() {
317                    final String rtn ;
318    
319                    if( useCrear ) {
320                            rtn = "<button onClick=\"window.open('" + JSP + "/" + getGUIInfoAttri("ADDRESS") +
321    //                              "/query.jsp?GAMENID=" + getGUIInfoAttri("KEY") + "','QUERY')\" >" +
322                                    "/query.jsp?GAMENID=" + getGUIInfoAttri("KEY") + "&command=NEW','QUERY')\" " +
323    //                              "accesskey=\"" + clearAcskey + "\">" +
324                                    ( clearAcskey == null ? "" : "accesskey=\"" + clearAcskey + "\"" ) +
325                                    ">" +
326    //                              getResource().getMessage( "MSG0011" ) + "</button>" ;
327    //                              getResource().getLabel( "MSG0011" ) + "</button>" ;
328                                    getResource().getLabel( "MSG0011" ) +
329                                    ( clearAcskey == null ? "" : "(" + clearAcskey + ")" ) +
330                                    "</button>" ;
331                    }
332                    else {
333                            rtn = "<button type=\"reset\" " +
334                                    ( clearAcskey == null ? "" : "accesskey=\"" + clearAcskey + "\"" ) +
335                                    ">" +
336    //                              getResource().getMessage( "MSG0011" ) + "</button>" ;
337                                    getResource().getLabel( "MSG0011" ) +
338                                    ( clearAcskey == null ? "" : "(" + clearAcskey + ")" ) +
339                                    "</button>" ;
340                    }
341    
342                    return rtn;
343            }
344    
345            /**
346             * コマンドを出力す?hidden を作?します?
347             *
348             * @return      コマンドを出力す?hidden
349             */
350            private String getCommand() {
351                    final String rtn ;
352    
353                    if( "NEW".equals( command ) ) {
354                            rtn = COMMAND;
355                    }
356                    else {
357                            rtn = "<input type=\"hidden\" name=\"command\" value=\"" +
358                                                    command + "\" id=\"h_cmd\" />" ;
359                    }
360    
361                    return rtn;
362            }
363    
364            /**
365             * スコープを出力す?hidden を作?します?
366             *
367             * @return      スコープを出力す?hidden
368             */
369            private String getHiddenScope() {
370                    String rtn = "";
371    
372                    if( scope != null ) {
373                            rtn = "<input type=\"hidden\" name=\"scope\" value=\"" +
374                                                    scope + "\" />" ;
375                    }
376    
377                    return rtn;
378            }
379    
380            /**
381             * 画面IDを?力す?hidden を作?します?
382             *
383             * @return      画面IDを?力す?hidden
384             */
385            private String getGamenId() {
386                    String rtn = "<input type=\"hidden\" name=\"GAMENID\" value=\"" +
387                                                    getGUIInfoAttri("KEY") + "\" />";
388    
389                    return rtn;
390            }
391    
392            /**
393             * ペ?ジサイズプル?ンメニューを作?します?
394             *
395             * @og.rev 4.3.6.0 (2008/04/01) idとclassの変更
396             *
397             * @return      ペ?ジサイズプル?ンメニュー
398             */
399            private String getPageSize() {
400    //              String rtn = "";
401    
402    //              if( usePageSize ) {
403                            if( pageSize == null ) {
404                                    String PAGESIZE  = sys( "HTML_PAGESIZE" );
405                                    pageSize = nval( getRequestValue( "pageSize" ),PAGESIZE ) ;
406                            }
407    
408                            DBColumn column = getDBColumn( "pageSize" );
409                            String tag = column.getEditorValue( pageSize );
410    
411                            // return ( "<td id=\"label\">" +
412                            return ( "<td class=\"label pageSize hide\">" + // 4.3.6.0 (2008/04/01) class出?
413                                                    column.getLongLabel() +
414                                                    ":</td><td class=\"pageSize hide\">" + tag + "</td>" ) ;
415    //              }
416    
417    //              return rtn;
418            }
419    
420            /**
421             * 検索時??検索数のプル?ンメニューを作?します?
422             *
423             * @og.rev 4.3.6.0 (2008/04/01) idとclassの変更
424             *
425             * @return      ?検索数のプル?ンメニュー
426             */
427            private String getMaxRowCount() {
428    //              String rtn = "";
429    
430    //              if( useRowCount ) {
431                            if( maxRowCount == null ) {
432                                    String ROW_COUNT = sys( "DB_MAX_ROW_COUNT" );
433                                    maxRowCount = nval( getRequestValue( "maxRowCount" ), ROW_COUNT ) ;
434                            }
435    
436                            DBColumn column = getDBColumn( "maxRowCount" );
437                            String tag = column.getEditorValue( maxRowCount );
438    
439                            // return ( "<td id=\"label\">" +
440                            return ( "<td class=\"label maxRowCount hide\">" + // 4.3.6.0 (2008/04/01) class出?
441                                                    column.getLongLabel() +
442                                                    ":</td><td class=\"maxRowCount hide\">" + tag + "</td>" ) ;
443    //              }
444    //              return rtn;
445            }
446    
447            /**
448             *  debugプル?ンメニューを作?します?
449             *
450             * @og.rev 5.6.5.1 (2013/06/14) 新規追?
451             *
452             * @return      debugプル?ンメニュー
453             */
454            private String getDebugClm() {
455                    DBColumn column = getDBColumn( "debug" );
456                    String tag = column.getEditorValue( "false" );
457    
458                    return ( "<td class=\"label debug hide\">" +
459                                            column.getLongLabel() +
460                                            ":</td><td class=\"debug hide\">" + tag + "</td>" ) ;
461            }
462    
463            /**
464             * エ??設定?のプル?ンメニューを作?します?
465             *
466             * @og.rev 5.3.6.0 (2011/06/01) 新規追?
467             *
468             * @param configs エ???(配?)
469             * @param selEditName 選択中のエ???
470             *
471             * @return      エ???のプル?ン
472             */
473            private String getEditSelect( final DBEditConfig[] configs, final String selEditName ) {
474                    DBColumn column = getDBColumn( "editName" );
475    
476                    StringBuilder buf = new StringBuilder();
477                    buf.append( "<td class=\"label editName\">" )
478                            .append( column.getLongLabel() )
479                            .append( ":</td><td class=\"editName\">" )
480                            .append( "<select name=\"editName\">" )
481                            .append( "<option />" );
482                    for( DBEditConfig config : configs ) {
483                            String name = config.getEditName();
484                            if( name != null && name.length() > 0 ) {
485                                    buf.append( "<option value=\"" ).append( name ).append( "\"" );
486                                    if( config.isCommon() ) {
487                                            buf.append( " class=\"commonEdit\"" );
488                                    }
489                                    if( name.equals( selEditName ) ) {
490                                            buf.append( " selected" );
491                                    }
492                                    buf.append( ">" ).append( name ).append( "</option>" );
493                            }
494                    }
495                    buf.append( "</select></td>" );
496                    return buf.toString();
497            }
498            
499            /**
500             * IEのEnterボタンのための?しinput出力?
501             *
502             * ※?コール用
503             *
504             * @og.rev 5.6.1.0 (2013/02/01) 新規作?
505             *
506             * @return      ?属?タグ
507             */
508            private final String getDummyInput() {
509    
510                    StringBuilder strRet = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
511                    Attributes attributes = new Attributes();
512                    attributes.set("name",DUMMY_INPUT);
513                    attributes.set("value",null);
514                    attributes.set("optionAttributes","style='display:none;'");
515                    strRet.append( XHTMLTag.input( attributes ) );
516    
517                    return strRet.toString();
518            }
519    
520            /**
521             * 【TAG】リクエストとして送信するコマンドを?しま?初期値:NEW)?
522             *
523             * @og.tag
524             *  NEW:通常の検索(初期値)?ENTRY:エントリ登録?
525             *
526             * @param       cmd     送信するコマン?
527             */
528            public void setCommand( final String cmd ) {
529                    command = nval( getRequestParameter( cmd ),command );
530            }
531    
532            /**
533             * 【TAG】JavaScriptによる初期化?タンを使用するかど?[true/false]を指定しま?初期値:true)?
534             *
535             * @og.tag
536             * 通常の初期化?タンでは、HTMLが作?された状態に戻すだけです?例えば?
537             * 引数付きで設定された場合?そ?引数が設定されて?状態へ戻します?
538             * こ?JavaScriptによる初期化?タンの場?trueの場?は、JavaScriptにより
539             * INIT状態でもう?QUERYフレー?呼び出します?で、指定された引数?
540             * クリアされます?
541             * 初期値は、true:JavaScriptによる初期化です?
542             *
543             * @param   flag [true:JavaScriptによる初期?false:通常のresetボタン]
544             */
545            public void setUseCrear( final String flag ) {
546                    useCrear = nval( getRequestParameter( flag ),useCrear );
547            }
548    
549            /**
550             * 【TAG】?型的なボタンの形状に設定しま?初期値:null)?
551             *
552             * @og.tag
553             * クエリーボタンでは、検索ボタン以外に、pageSize、maxRowCount?
554             * prevNext、timeView などの?も表示可能です?
555             * これらを、?別に設定可能ですが??常使用するタイプとして?タイプを
556             * 用意します?これは、設定状態?初期値と?ます?
557             * null  :通常の検索ボタンで、フル?の?です?
558             * SELECT:?件のみ検索するようなケースで使用します?
559             *        検索ボタンとクリアボタンのみを表示します?
560             * ENTRY :?なり登録するようなケースで使用します?
561             *        登録ボタンとクリアボタンのみを表示します?(command="NEW" です?)
562             *
563             * @param       tp      タイプ指?null,SELECT,ENTRY)
564             */
565            public void setType( final String tp ) {
566                    type = nval( getRequestParameter( tp ),type );
567    
568                    if( "SELECT".equalsIgnoreCase( type ) ) {
569                            accesskey       = "F";
570                            usePrevNext     = false;
571                            usePageSize     = false;
572                            useRowCount     = false;
573                            useTimeView     = false;
574                    }
575                    else if( "ENTRY".equalsIgnoreCase( type ) ) {
576                            accesskey       = "W";
577                            usePrevNext     = false;
578                            usePageSize     = false;
579                            useRowCount     = false;
580                            useTimeView     = false;
581                    }
582            }
583    
584            /**
585             * 【TAG】リクエストとして送信するスコープを?しま?初期値:null)?
586             *
587             * @og.tag
588             * リクエスト時に、付与する引数??の?の、スコープを?します?
589             * これは、検索専用画面の場合?、scope="request" にする事で、メモリの
590             * 無?確保を行わずに、検索結果を表示できます?
591             * ただし?そ?結果に対して、NEXT-PREV ??ヘッ??ソートリンクなどの
592             * 機?が使えなくなります?
593             * 通常は、何も?しな??null)で、RESULT画面の設定に任せるのが良?しょ??
594             * 初期値は、null = session(セ?ョン登録) です?
595             *
596             * @param   scp [session:セ?ョン登録/request:リクエスト登録]
597             */
598            @Override
599            public void setScope( final String scp ) {
600                    scope = nval( getRequestParameter( scp ),scope );
601            }
602    
603            /**
604             * 【TAG】検索ボタンに使用するショートカ?キー?を?しま?初期値:F)?
605             *
606             * @og.tag
607             * ボタンを?Alt-XX で実行できるようにするショートカ?キーを設定します?
608             * 標準では、検索ボタンは?F" に設定して?す?で、Alt-F となります?
609             * ゼロ??を指定すると、ショートカ?キーなしに設定できます?
610             * 初期値は、Find の "F" です?
611             *
612             * @og.rev 5.3.6.0 (2011/06/01) accessKeyを削除できるように対?
613             * @og.rev 5.6.0.3 (2012/01/24) getRequestParameter を何度も呼んで?ので修正?
614             *
615             * @param       accsKey ショートカ?キー??初期値:F)
616             */
617            public void setAccesskey( final String accsKey ) {
618    //              accesskey = nval( getRequestParameter( accsKey ),accesskey );
619                    String val = getRequestParameter( accsKey );
620                    if( val == null || val.length() == 0 ) {
621                            accesskey = null;
622                    }
623                    else {
624    //                      accesskey = getRequestParameter( accsKey );
625                            accesskey = val;                                                                // 5.6.0.3 (2012/01/24)
626                    }
627            }
628    
629            /**
630             * 【TAG】クリアボタンに使用するショートカ?キー?を?しま?初期値:C)?
631             *
632             * @og.tag
633             * ボタンを?Alt-XX で実行できるようにするショートカ?キーを設定します?
634             * 標準では、検索ボタンは?C" に設定して?す?で、Alt-C となります?
635             * ゼロ??を指定すると、ショートカ?キーなしに設定できます?
636             * 初期値は、Clear の "C" です?
637             *
638             * @og.rev 5.3.6.0 (2011/06/01) accessKeyを削除できるように対?
639             * @og.rev 5.6.0.3 (2012/01/24) getRequestParameter を何度も呼んで?ので修正?
640             *
641             * @param       accsKey クリアボタンのショートカ?キー??初期値:C)
642             */
643            public void setClearAccesskey( final String accsKey ) {
644    //              clearAcskey = nval( getRequestParameter( accsKey ),clearAcskey );
645                    String val = getRequestParameter( accsKey );
646                    if( val == null || val.length() == 0 ) {
647                            clearAcskey = null;
648                    }
649                    else {
650    //                      clearAcskey = getRequestParameter( accsKey );
651                            clearAcskey = val;                                                              // 5.6.0.3 (2012/01/24)
652                    }
653            }
654    
655            /**
656             * 【TAG】??戻る?prev_next リンクを表示するかど?を指定しま?初期値:true)?
657             *
658             * @og.tag
659             * 進?戻るリンクは、RESULT画面にコマン?FIRST,PREV,NEXT,LAST) と?
660             * コマンドを送る事で実現して?画像リンクです?
661             * PREV_NEXT が存在しな?面では、消去しておく?があります?
662             * 初期値は、true(表示する)です?
663             *
664             * @param       flag    prev_next リンクを表示するかど?
665             */
666            public void setUsePrevNext( final String flag ) {
667                    usePrevNext = nval( getRequestParameter( flag ),usePrevNext );
668            }
669    
670            /**
671             * 【TAG】pageSize 引数を使用するかど?を指定しま?初期値:true)?
672             *
673             * @og.tag
674             * pageSize 引数は、RESULT画面のviewタグで使用する ?の表示に
675             * 何件の??タを表示させるかを指定する引数です?
676             * こ?件数が多いと、多くの??タを見ることが?来ますが、その?示?
677             * ?なります??、少な?、PREV_NEXT を多用することになり?
678             * 目??行を探し?しにくくなります?
679             * pageSize の値は、pageSizeパラメータで画面単位に?するか、シス?
680             * パラメータの HTML_PAGESIZE でシス?単位に?できます?
681             * 初期値は、true(使用する)です?
682             *
683             * @param       flag    pageSize引数を使用するかど?
684             * @see     #setPageSize( String )
685             */
686            public void setUsePageSize( final String flag ) {
687                    usePageSize = nval( getRequestParameter( flag ),usePageSize );
688            }
689    
690            /**
691             * 【TAG】maxRowCount 引数を使用するかど?を指定しま?初期値:true)?
692             *
693             * @og.tag
694             * maxRowCount 引数は、RESULT画面のqueryタグで使用する ?の検索時に
695             * 何件の??タを取得させるかを?する引数です?
696             * こ?件数が多いと、多くの??タを検索することが?来ますが、その?示?
697             * ?なります??、少な?、目??行まで探し?せな?もしれません?
698             * maxRowCount の値は、rowCountパラメータで画面単位に?するか、シス?
699             * パラメータの DB_MAX_ROW_COUNT でシス?単位に?できます?
700             *
701             * 初期値は、true(使用する)です?
702             *
703             * @param       flag    maxRowCount引数を使用するかど?
704             * @see     #setMaxRowCount( String )
705             */
706            public void setUseRowCount( final String flag ) {
707                    useRowCount = nval( getRequestParameter( flag ),useRowCount );
708            }
709    
710            /**
711             * 【TAG】??間を表示する TimeView を表示するかど?を指定しま?初期値:true)?
712             *
713             * @og.tag
714             * true に設定すると、??間を表示するバ?イメージが表示されます?
715             * これは、DB検索、APサーバ?処??画面表示の???間をバ?イメージで
716             * 表示させる機?です?処?間?目安になります?
717             * 初期値は、true です?
718             *
719             * @param       flag    TimeView表示をするかど?(初期値:true)
720             */
721            public void setUseTimeView( final String flag ) {
722                    useTimeView = nval( getRequestParameter( flag ),useTimeView );
723            }
724    
725            /**
726             * 【TAG】pageSize プル?ンメニューの初期値を指定しま?
727             *              (初期値:HTML_PAGESIZE[={@og.value org.opengion.hayabusa.common.SystemData#HTML_PAGESIZE}])?
728             *
729             * @og.tag
730             * プル?ンメニューを表示する場合?初期値を指定します?
731             * (初期値:ユーザー定数のHTML_PAGESIZE[={@og.value org.opengion.hayabusa.common.SystemData#HTML_PAGESIZE}])?
732             *
733             * @param       pSize   プル?ンメニューの初期値
734             * @see     #setUsePageSize( String )
735             * @see         org.opengion.hayabusa.common.SystemData#HTML_PAGESIZE
736             */
737            public void setPageSize( final String pSize ) {
738                    pageSize = nval( getRequestParameter( pSize ),pageSize );
739            }
740    
741            /**
742             * 【TAG】maxRowCount プル?ンメニューの初期値を指定しま?
743             *              (初期値:DB_MAX_ROW_COUNT[={@og.value org.opengion.hayabusa.common.SystemData#DB_MAX_ROW_COUNT}])?
744             *
745             * @og.tag
746             * プル?ンメニューを表示する場合?初期値を指定します?
747             * (初期値:ユーザー定数のDB_MAX_ROW_COUNT[={@og.value org.opengion.hayabusa.common.SystemData#DB_MAX_ROW_COUNT}])?
748             *
749             * @param       maxSize maxRowCountプル?ンメニューの初期値
750             * @see     #setUseRowCount( String )
751             * @see         org.opengion.hayabusa.common.SystemData#DB_MAX_ROW_COUNT
752             */
753            public void setMaxRowCount( final String maxSize ) {
754                    maxRowCount = nval( getRequestParameter( maxSize ),maxRowCount );
755            }
756            
757            /**
758             * 【TAG】ダミ?のinputタグ(display:none)を?力するか設定します?
759             *              (初期値:USE_DUMMY_INPUT[={@og.value org.opengion.hayabusa.common.SystemData#USE_DUMMY_INPUT}])?
760             *
761             * @og.tag
762             * ?ーのinputタグ(display:none)を?力するか設定します?
763             * IEではinputが1つ?の場合にエンターでのsubmitが上手くいかな?め??ーを?置する?があります?
764             * trueに設定するとWriteCheckタグがダミ?を(常に??力します?
765             * (初期値:USE_DUMMY_INPUT[={@og.value org.opengion.hayabusa.common.SystemData#USE_DUMMY_INPUT}])?
766             *
767             * @og.rev 5.6.1.0 (2013/02/01) 新規追?
768             *
769             * @param   flag 出力[する(true)/しな?false)]
770             * @see         org.opengion.hayabusa.common.SystemData#USE_DUMMY_INPUT
771             */
772            public void setUseDummy( final String flag ) {
773                    useDummy = nval( getRequestParameter( flag ), useDummy );
774            }
775    
776            /**
777             * こ?オブジェクト???表現を返します?
778             * 基本???目?使用します?
779             *
780             * @return こ?クラスの??表現
781             */
782            @Override
783            public String toString() {
784                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
785                                    .println( "VERSION"             ,VERSION                )
786                                    .println( "command"             ,command                )
787                                    .println( "pageSize"    ,pageSize               )
788                                    .println( "maxRowCount" ,maxRowCount    )
789                                    .println( "accesskey"   ,accesskey              )
790                                    .println( "scope"               ,scope                  )
791                                    .println( "useCrear"    ,useCrear               )
792                                    .println( "usePrevNext" ,usePrevNext    )
793                                    .println( "usePageSize" ,usePageSize    )
794                                    .println( "useRowCount" ,useRowCount    )
795                                    .println( "useTimeView" ,useTimeView    )
796                                    .println( "body"                ,body                   )
797                                    .println( "Other..."    ,getAttributes().getAttribute() )
798                                    .fixForm().toString() ;
799            }
800    }