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