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