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.plugin.view; 017 018import org.opengion.hayabusa.common.HybsSystem; 019import org.opengion.hayabusa.db.DBTableModel; 020import org.opengion.hayabusa.html.AbstractViewForm; 021import org.opengion.fukurou.model.Formatter; 022import org.opengion.fukurou.util.StringUtil; 023 024/** 025 * 検索結果を自動的に表形式に変換する、テーブル作成クラスです。 026 * 027 * AbstractViewForm により、setter/getterメソッドのデフォルト実装を提供しています。 028 * 各HTMLのタグに必要な setter/getterメソッドのみ,追加定義しています。 029 * 030 * AbstractViewForm を継承している為,ロケールに応じたラベルを出力させる事が出来ます。 031 * 032 * @og.group 画面表示 033 * 034 * @version 4.0 035 * @author Kazuhiko Hasegawa 036 * @since JDK5.0, 037 */ 038public class ViewForm_HTMLTable extends AbstractViewForm { 039 //* このプログラムのVERSION文字列を設定します。 {@value} */ 040 private static final String VERSION = "5.3.4.0 (2011/04/01)" ; 041 042// private String caption = null; // 表のタイトル 5.1.6.0 (2010/05/01) 削除 043 private String cacheTag = null; // 3.5.5.5 (2004/04/23) 044 private boolean isCache = false; // 3.5.5.5 (2004/04/23) 045 private int[] popupClmNo = null; // 3.8.6.1 (2006/10/20) 046 047// protected int[] rowNo = null; // 5.1.6.0 (2010/05/01) 削除 048 /** ヘッダー部分のキャッシュ変数 */ 049 protected String headerLine = null; // 3.5.2.0 (2003/10/20) 050 051 private final boolean useRowId = HybsSystem.sysBool( "USE_CHECKBOX_ROW_ID" ) ; // 3.6.0.0 (2004/09/17) 052 053 // 5.2.3.0 (2010/12/01) テーブル罫線対応 054 private final String tableParam = HybsSystem.sys( "HTML_TABLE_PARAM" ) ; 055 056 // 5.9.3.3 (2015/12/24) HTML5 で colgroup が効かない対応。 057 protected final boolean useIE7Header = HybsSystem.sysBool( "USE_IE7_HEADER" ); 058 059 060 // 3.6.0.0 (2004/09/17) チェック済みの行の先頭に、フォーカスを当てる処理 061 private static final String LAYER_FOCUS = "<a href=\"#top\" name=\"h_fcs\" id=\"h_fcs\" ></a>" ; 062 063 // 4.3.4.4 (2009/01/01) 064// /** 065// * デフォルトコンストラクター 066// * 067// */ 068// public ViewForm_HTMLTable() { 069// super(); 070// super.clear(); 071// } 072 073 /** 074 * 内容をクリア(初期化)します。 075 * 076 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 077 * @og.rev 3.5.2.0 (2003/10/20) ヘッダー繰り返し属性( headerSkipCount )を採用 078 * @og.rev 3.5.5.5 (2004/04/23) cacheTag,isCache 属性追加(チェックボックス作成用) 079 * @og.rev 3.5.6.2 (2004/07/05) bgColorCycle 変数の削除。 080 * @og.rev 3.8.6.1 (2006/10/20) popup の値を返す為のカラム番号配列(popupClmNo)追加 081 * @og.rev 5.1.6.0 (2010/05/01) caption 属性が使われていないため、削除する。 082 */ 083 @Override 084 public void clear() { 085 super.clear(); 086// caption = null; // 表のタイトル 087 cacheTag = null; // 3.5.5.5 (2004/04/23) 088 isCache = false; // 3.5.5.5 (2004/04/23) 089 popupClmNo = null; // 3.8.6.1 (2006/10/20) 090 } 091 092 /** 093 * DBTableModel から HTML文字列を作成して返します。 094 * startNo(表示開始位置)から、pageSize(表示件数)までのView文字列を作成します。 095 * 表示残りデータが pageSize 以下の場合は,残りのデータをすべて出力します。 096 * 097 * @og.rev 3.5.2.0 (2003/10/20) ヘッダー繰り返し属性( headerSkipCount )を採用 098 * @og.rev 3.5.3.1 (2003/10/31) skip属性を採用。headerLine のキャッシュクリア 099 * @og.rev 3.5.5.0 (2004/03/12) No 欄そのものの作成判断ロジックを追加 100 * @og.rev 3.5.6.4 (2004/07/16) ヘッダーとボディー部をJavaScriptで分離 101 * @og.rev 3.7.0.3 (2005/03/01) getBgColorCycleClass に、選択行マーカーを採用 102 * @og.rev 4.3.1.0 (2008/09/08) 編集行のみを表示する属性(isSkipNoEdit)追加 103 * @og.rev 4.3.3.0 (2008/10/01) noTransition属性対応 104 * 105 * @param startNo 表示開始位置 106 * @param pageSize 表示件数 107 * 108 * @return DBTableModelから作成された HTML文字列 109 */ 110 public String create( final int startNo, final int pageSize ) { 111 if( getRowCount() == 0 ) { return ""; } // 暫定処置 112 113 headerLine = null; 114 int lastNo = getLastNo( startNo, pageSize ); 115 int blc = getBackLinkCount(); 116 int hsc = getHeaderSkipCount(); // 3.5.2.0 (2003/10/20) 117 int hscCnt = 1; // 3.5.2.0 (2003/10/20) 118 119 StringBuilder out = new StringBuilder( HybsSystem.BUFFER_LARGE ); 120 121 out.append( getCountForm( startNo,pageSize ) ); 122 out.append( getHeader() ); 123 124 String ckboxTD = " <td>"; 125 126 out.append("<tbody>").append( HybsSystem.CR ); 127 int bgClrCnt = 0; 128 int clmCnt = getColumnCount(); // 3.5.5.7 (2004/05/10) 129 for( int row=startNo; row<lastNo; row++ ) { 130// if( isSkip( row ) ) { continue; } // 3.5.3.1 (2003/10/31) 131 if( isSkip( row ) || isSkipNoEdit( row ) ) { continue; } // 4.3.1.0 (2008/09/08) 132 out.append("<tr").append( getBgColorCycleClass( bgClrCnt++,row ) ); 133 if( isNoTransition() ) { // 4.3.3.0 (2008/10/01) 134 out.append( getHiddenRowValue( row ) ); 135 } 136 out.append(">"); // 3.7.0.3 (2005/03/01) 137 out.append( HybsSystem.CR ); 138 // 3.5.5.0 (2004/03/12) No 欄そのものの作成判断追加 139 if( isNumberDisplay() ) { 140 out.append( makeCheckbox( ckboxTD, row, blc ) ).append( HybsSystem.CR ); 141 } 142 for(int column = 0; column < clmCnt; column++) { 143 if( isColumnDisplay( column ) ) { 144 out.append(" <td>"); 145 out.append( getValueLabel(row,column) ); 146 out.append("</td>").append( HybsSystem.CR ); 147 } 148 } 149 out.append("</tr>").append( HybsSystem.CR ); 150 151 // 3.5.2.0 (2003/10/20) ヘッダー繰り返し属性( headerSkipCount )を採用 152 if( hsc > 0 && hscCnt % hsc == 0 ) { 153 out.append( getHeadLine() ); 154 hscCnt = 1; 155 } 156 else { 157 hscCnt ++ ; 158 } 159 } 160 out.append("</tbody>").append( HybsSystem.CR ); 161 out.append("</table>").append( HybsSystem.CR ); 162 163 out.append( getScrollBarEndDiv() ); // 3.8.0.3 (2005/07/15) 164 165 return out.toString(); 166 } 167 168 /** 169 * 選択用のチェックボックスと行番号と変更タイプ(A,C,D)を表示します。 170 * 171 * @og.rev 3.5.1.0 (2003/10/03) Noカラムに、numberType 属性を追加 172 * @og.rev 3.5.4.0 (2003/11/25) Formatter をローカル変数に変更 173 * @og.rev 3.5.4.1 (2003/12/01) table オブジェクトのセット廃止 174 * @og.rev 3.5.5.5 (2004/04/23) Attributes オブジェクトのセット廃止 175 * @og.rev 3.6.0.0 (2004/09/17) ガントチャートの移動時にチェックするためのIDを追加 176 * @og.rev 3.6.0.0 (2004/09/17) チェック済みの行の先頭に、フォーカスを当てる処理を追加 177 * @og.rev 3.8.6.1 (2006/10/20) popup 用の値を設定する機能を追加 178 * 179 * @param ckboxTD チェックボックスのタグ(マルチカラム時のrowspan対応) 180 * @param row 行番号 181 * @param blc バックラインカウント(先頭へ戻るリンク間隔) 182 * 183 * @return tdタグで囲まれたチェックボックスのHTML文字列 184 */ 185 protected String makeCheckbox( final String ckboxTD,final int row,final int blc ) { 186 StringBuilder out = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 187 188 DBTableModel table = getDBTableModel() ; 189 190 String opAtt = null; 191 String fmt = getOptionTypeAttributes(); 192 if( fmt != null ) { 193 Formatter format = new Formatter( table ); 194 format.setFormat( fmt ); 195 opAtt = format.getFormatString( row ); 196 } 197 198 out.append( ckboxTD ); 199 out.append( table.getModifyType( row ) ); 200 out.append("</td>"); 201 out.append( ckboxTD ); 202 203 // 3.5.5.5 (2004/04/23) Attributes オブジェクトのセット廃止 204 String inputTag = makeChboxTag(); 205 if( isWritable( row ) && inputTag != null ) { 206 out.append( inputTag ); 207 if( opAtt != null ) { out.append( opAtt ); } 208 if( isChecked( row ) ) { 209 out.append( " checked=\"checked\"" ); 210 } 211 if( useRowId ) { // 3.6.0.0 (2004/09/17) 212 out.append( " id=\"" ); 213 out.append( HybsSystem.ROW_ID_KEY ); 214 out.append( row ).append( "\"" ); 215 } 216 if( popupClmNo != null ) { // 3.8.6.1 (2006/10/20) 217 out = makePopupReturn( out,row ); // 内部で StringBuilder に append しています。 218 } 219 out.append( " value=\"" ).append( row ).append( "\" />" ); 220 } 221 out.append("</td>"); 222 out.append( ckboxTD ); 223 224 // 3.5.1.0 (2003/10/03) Noカラムに、numberType 属性を追加 225 if( blc != 0 && (row+1) % blc == 0 ) { 226 out.append( "<a href=\"#top\">" ).append( getNumberData( row ) ).append( "</a>"); 227 } else { 228 out.append( getNumberData( row ) ); 229 } 230 231 // 4.3.5.3 (2008/02/22) Focus2のアンカー位置をtdタグ内に変更 232 if( isFirstChecked( row ) ) { 233 out.append( LAYER_FOCUS ); 234 } 235 out.append("</td>"); 236 // if( isFirstChecked( row ) ) { 237 // out.insert( 0,LAYER_FOCUS ); 238 // } 239 240 return out.toString(); 241 } 242 243 /** 244 * DBTableModel から テーブルのヘッダータグ文字列を作成して返します。 245 * 246 * @og.rev 3.5.2.0 (2003/10/20) ヘッダーそのもののキャッシュはしない。 247 * 248 * @return テーブルのヘッダータグ文字列 249 */ 250 protected String getHeader() { 251 return getTableTag() + getTableHead() ; 252 } 253 254 /** 255 * DBTableModel から テーブルのタグ文字列を作成して返します。 256 * 257 * @og.rev 3.5.6.4 (2004/07/16) ヘッダーとボディー部をJavaScriptで分離 258 * @og.rev 3.6.0.0 (2004/09/17) ヘッダー固定スクロールの簡素化(スクロールバーを右に出す) 259 * @og.rev 3.6.0.5 (2004/10/18) 印刷時の罫線出力関連機能の追加。id 属性を出力します。 260 * @og.rev 4.0.0.0 (2005/08/31) テーブル表示の CSSファイル利用の有無 261 * @og.rev 5.1.6.0 (2010/05/01) caption 属性が使われていないため、削除する。 262 * @og.rev 5.2.3.0 (2010/12/01) テーブル罫線対応 263 * @og.rev 5.3.4.0 (2011/04/01) テーブル罫線の初期値チェック変更 264 * 265 * @return テーブルのタグ文字列 266 */ 267 protected String getTableTag() { 268 StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 269 270 buf.append( getScrollBarStartDiv() ); // 3.8.0.3 (2005/07/15) 271 272 buf.append("<table "); 273 // 5.2.3.0 (2010/12/01) テーブル罫線対応 274// if( tableParam != null ) { // 5.3.4.0 (2011/04/01) 275 if( tableParam != null && !tableParam.isEmpty() ) { 276 buf.append( tableParam ); 277 buf.append( " " ); 278 } 279 buf.append("id=\"viewTable\" "); 280 buf.append("class=\"").append( getTableClass() ).append( "\"" ); 281 282 buf.append(">").append( HybsSystem.CR ); 283 284// if( caption != null ) { 285// buf.append("<caption>"); 286// buf.append( caption ); 287// buf.append("</caption>").append( HybsSystem.CR ); 288// } 289 290 return buf.toString(); 291 } 292 293 294 /** 295 * HTML5 で colgroup が効かない暫定対応の、処理をまとめるメソッド 296 * 297 * #viewTable td:nth-child(n) { text-align:right; } CSSを出力するメソッドをまとめました。 298 * 呼び出し元の、getTableHead() のコードをすっきりさせるためのメソッドです。 299 * 300 * @og.rev 5.9.3.3 (2015/12/26) 6.1.2.0での対応を移植 301 * @og.rev 5.9.5.3 (2016/02/26) viewTableにtableIdのクラスを追加する対応 302 * @og.rev 5.9.9.0 (2016/06/03) getViewClass 303 * 304 * @param buf タグ文字列をappendしていくStringBuilder 305 * @param ad TDタグの番号 nth-child(n)設置する場合の n の値 306 * @param dbType text-alignを決めるためのDBTYPE 307 * (R,S9,X9→text-align:right; , BIT→text-align:center; , 他素通り) 308 * 309 * @return テーブルのタグ文字列(入力と同じStringBuilder) 310 * @og.rtnNotNull 311 * @see #getTableHead() 312 */ 313 protected StringBuilder makeNthChild( final StringBuilder buf , final int ad , final String dbType ) { 314 if( "R".equalsIgnoreCase( dbType ) || "S9".equalsIgnoreCase( dbType ) || "X9".equalsIgnoreCase( dbType ) ) { 315// buf.append( " #viewTable td:nth-child(" ).append( ad ).append( ") { text-align:right; }" ); 316// buf.append( " #viewTable."+ getTableClazz() +" td:nth-child(" ).append( ad ).append( ") { text-align:right; }" ); // 5.9.5.3 (2016/02/26) 317 buf.append( " #viewTable."+ getViewClass() +" td:nth-child(" ).append( ad ).append( ") { text-align:right; }" ); // 5.9.9.0 318 buf.append( HybsSystem.CR ); 319 } 320 else if( "BIT".equalsIgnoreCase( dbType ) ) { // BIT は 真ん中 321// buf.append( " #viewTable td:nth-child(" ).append( ad ).append( ") { text-align:center; }" ); 322// buf.append( " #viewTable."+ getTableClazz() + " td:nth-child(" ).append( ad ).append( ") { text-align:center; }" );// 5.9.5.3 (2016/02/26) 323 buf.append( " #viewTable."+ getViewClass() + " td:nth-child(" ).append( ad ).append( ") { text-align:center; }" );// 5.9.9.0 324 buf.append( HybsSystem.CR ); 325 } 326 // 上記(R,S9,X9,BIT)以外のdbTypeの場合は、素通りします。(入力のStringBuilderをそのまま返すだけ) 327 328 return buf ; 329 } 330 331 /** 332 * DBTableModel から テーブルのタグ文字列を作成して返します。 333 * 334 * @og.rev 3.5.1.0 (2003/10/03) Noカラムに、numberType 属性を追加 335 * @og.rev 3.5.2.0 (2003/10/20) ヘッダー繰り返し部をgetHeadLine()へ移動 336 * @og.rev 3.5.3.1 (2003/10/31) VERCHAR2 を VARCHAR2 に修正。 337 * @og.rev 3.5.5.0 (2004/03/12) No 欄そのものの作成判断ロジックを追加 338 * @og.rev 3.5.6.5 (2004/08/09) thead に、id="header" を追加 339 * @og.rev 4.0.0.0 (2005/01/31) DBColumn の 属性(CLS_NM)から、DBTYPEに変更 340 * @og.rev 4.0.0.0 (2005/01/31) 新規作成(getColumnClassName ⇒ getColumnDbType) 341 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 342 * @og.rev 5.9.3.3 (2015/12/26) colgroup対応 343 * 344 * @return テーブルのタグ文字列 345 */ 346 protected String getTableHead() { 347 StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 348 349 // 5.9.3.3 (2015/12/26) HTML5 で colgroup が効かない対応 350 // 互換モードでない場合専用。処理速度を気にするより、処理を一か所にまとめておきます。 351 if( !useIE7Header ) { 352 buf.append( "<style type=\"text/css\">" ) 353 .append( HybsSystem.CR ); 354 int ad ; 355 if( isNumberDisplay() ) { 356 makeNthChild( buf,2,"BIT" ); 357 makeNthChild( buf,3,"S9" ); 358 ad = 4; 359 } 360 else { 361 ad = 1; 362 } 363 364 final int clmCnt = getColumnCount(); 365 for( int column=0; column<clmCnt; column++ ) { 366 if( isColumnDisplay( column ) ) { 367 makeNthChild( buf,ad,getColumnDbType(column) ); 368 ad++ ; // tdタグの順番なので、表示する場合のみカウントする。 369 } 370 } 371 buf.append( "</style>" ) 372 .append( HybsSystem.CR ); 373 } 374 375 // 3.5.5.0 (2004/03/12) No 欄そのものの作成判断追加 376 if( isNumberDisplay() ) { 377// buf.append("<colgroup class=\"X\" />"); // 4.0.0 (2005/01/31) 378// buf.append("<colgroup class=\"BIT\" />"); 379// buf.append("<colgroup class=\"S9\" />"); // 4.0.0 (2005/01/31) 380 buf.append("<colgroup class=\"X\" ><!-- --></colgroup>"); // 5.9.1.2 (2015/10/23) 381 buf.append("<colgroup class=\"BIT\" ><!-- --></colgroup>"); 382 buf.append("<colgroup class=\"S9\" ><!-- --></colgroup>"); 383 buf.append( HybsSystem.CR ); 384 } 385 386 int clmCnt = getColumnCount(); // 3.5.5.7 (2004/05/10) 387 for(int column = 0; column < clmCnt; column++) { 388 if( isColumnDisplay( column ) ) { 389 buf.append("<colgroup class=\"" ); 390 buf.append( getColumnDbType(column) ); // 4.0.0 (2005/01/31) 391// buf.append("\"/>"); 392 buf.append("\"><!-- --></colgroup>"); // 5.9.1.2 (2015/10/23) 393 buf.append( HybsSystem.CR ); 394 } 395 } 396 397 // 3.5.2.0 (2003/10/20) ヘッダー繰り返し部をgetHeadLine()へ移動 398 buf.append("<thead id=\"header\">").append( HybsSystem.CR ); // 3.5.6.5 (2004/08/09) 399 buf.append( getHeadLine() ); 400 buf.append("</thead>").append( HybsSystem.CR ); 401 402 return buf.toString(); 403 } 404 405 /** 406 * ヘッダー繰り返し部を、getTableHead()メソッドから分離。 407 * 408 * @og.rev 3.5.4.5 (2004/01/23) 実装をgetHeadLine( String thTag )に移動 409 * 410 * @return テーブルのタグ文字列 411 */ 412 protected String getHeadLine() { 413 return getHeadLine( "<th" ) ; 414 } 415 416 /** 417 * ヘッダー繰り返し部を、getTableHead()メソッドから分離。 418 * 419 * @og.rev 3.5.2.0 (2003/10/20) 新規作成 420 * @og.rev 3.5.4.3 (2004/01/05) useCheckControl 属性の機能を追加 421 * @og.rev 3.5.4.5 (2004/01/23) thタグの属性設定出来る様に新規追加。 422 * @og.rev 3.5.4.6 (2004/01/30) numberType="none" 時の処理を追加(Noラベルを出さない) 423 * @og.rev 3.5.4.7 (2004/02/06) ヘッダーにソート機能用のリンクを追加します。 424 * @og.rev 3.7.0.1 (2005/01/31) 全件チェックコントロール処理変更 425 * 426 * @param thTag タグの文字列 427 * 428 * @return テーブルのタグ文字列 429 */ 430 protected String getHeadLine( final String thTag ) { 431 if( headerLine != null ) { return headerLine; } // キャッシュを返す。 432 433 StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_MIDDLE ); 434 435 buf.append("<tr class=\"row_h\"").append(" >").append( HybsSystem.CR ); 436 437 // 3.5.5.0 (2004/03/12) No 欄そのものの作成判断追加 438 if( isNumberDisplay() ) { 439 // 3.5.4.3 (2004/01/05) 追加分 440 if( isUseCheckControl() && "checkbox".equals( getSelectedType() ) ) { 441 // 3.5.4.5 (2004/01/23) thタグの属性設定出来る様に変更。 442 buf.append( thTag ).append("></th>"); 443 buf.append( thTag ).append(">").append( getAllCheckControl() ).append("</th>"); 444 buf.append( thTag ).append(">").append( getNumberHeader() ).append("</th>"); // 3.5.4.6 (2004/01/30) 445 } 446 else { 447 // 3.5.4.5 (2004/01/23) thタグの属性設定出来る様に変更。 448 buf.append( thTag ).append(" colspan='3'>").append( getNumberHeader() ).append("</th>"); // 3.5.4.6 (2004/01/30) 449 } 450 } 451 452 buf.append( HybsSystem.CR ); 453 int clmCnt = getColumnCount(); // 3.5.5.7 (2004/05/10) 454 for(int column = 0; column < clmCnt; column++) { 455 if( isColumnDisplay( column ) ) { 456 // 3.5.4.5 (2004/01/23) thタグの属性設定出来る様に変更。 457 buf.append( thTag ).append(">"); 458 buf.append( getSortedColumnLabel(column) ); 459 buf.append("</th>").append( HybsSystem.CR ); 460 } 461 } 462 buf.append("</tr>").append( HybsSystem.CR ); 463 464 headerLine = buf.toString(); 465 return headerLine; 466 } 467 468 /** 469 * テーブルのタイトルをセットします。 470 * 471 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 472 * @og.rev 5.1.6.0 (2010/05/01) caption 属性が使われていないため、削除する。 473 * 474 * @param caption 属性 475 */ 476// public void setCaption( final String caption ) { 477// this.caption = caption; 478// } 479 480 /** 481 * フォーマットメソッドを使用できるかどうかを問い合わせます。 482 * 483 * @return 使用可能(true)/ 使用不可能(false) 484 */ 485 public boolean canUseFormat() { 486 return false; 487 } 488 489 /** 490 * ogPopup で検索結果の値を返すキーを、CSV形式で指定します。 491 * 492 * popup の検索結果を返す画面で、結果のラジオボタンにイベントセットします。 493 * この場合、オープンもとのwindow に値を返しますが、そのキーをCSV形式で 494 * 指定します。なお、設定は、init 以降(つまり、DBTableModelは設定済み)の 495 * 状態で呼び出してください。(エラーにしません) 496 * なお、このメソッドは、一覧表示(HTMLTable)関係のビューのみでサポートして 497 * いますが、チェックメソッドの関係で、それ以外のビューに適用しても素通り 498 * するようにします。(エラーにしません) 499 * 500 * @og.rev 3.8.6.1 (2006/10/20) 新規追加 501 * 502 * @param rtnKeys ogPopupで値を返すカラム文字列(CSV形式) 503 */ 504 @Override 505 public void setPopupReturnKeys( final String rtnKeys ) { 506 DBTableModel table = getDBTableModel() ; 507 if( table != null && table.getRowCount() > 0 && rtnKeys != null ) { 508 String[] clmNames = StringUtil.csv2Array( rtnKeys ); 509 popupClmNo = new int[clmNames.length]; 510 for( int i=0; i<clmNames.length; i++ ) { 511 int no = table.getColumnNo( clmNames[i] ); 512 if( no >= 0 ) { popupClmNo[ i ] = no; } 513 } 514 } 515 } 516 517 /** 518 * ogPopup で検索結果の値を返すキーを、CSV形式で指定します。 519 * 520 * popup の検索結果を返す画面で、結果のラジオボタンにイベントセットします。 521 * この場合、オープンもとのwindow に値を返しますが、そのキーをCSV形式で 522 * 指定します。なお、設定は、init 以降(つまり、DBTableModelは設定済み)の 523 * 状態で呼び出してください。(エラーにしません) 524 * なお、このメソッドは、一覧表示(HTMLTable)関係のビューのみでサポートして 525 * いますが、チェックメソッドの関係で、それ以外のビューに適用しても素通り 526 * するようにします。(エラーにしません) 527 * rtnPopup に値を渡す場合に、ダブルクオート(")、シングルクオート(')は、 528 * それぞれ、ASCII コード(¥x22、¥x27)に置き換えます。 529 * 530 * @og.rev 3.8.6.1 (2006/10/20) 新規追加 531 * 532 * @param buf StringBuilder 追加するStringBuilderオブジェクト 533 * @param rowNo 列番号 534 * 535 * @return 引数にデータを追加した後の同一オブジェクト 536 */ 537 private StringBuilder makePopupReturn( final StringBuilder buf,final int rowNo ) { 538 buf.append( " onClick=\"rtnPopup(new Array(" ); 539 int clmNo = popupClmNo[ 0 ]; 540 String val = StringUtil.quoteFilter( getValue( rowNo,clmNo ) ); 541 buf.append( "'" ).append( val ).append( "'" ); 542 for( int i=1; i<popupClmNo.length; i++ ) { 543 clmNo = popupClmNo[ i ]; 544 val = StringUtil.quoteFilter( getValue( rowNo,clmNo ) ); 545 buf.append( ",'" ).append( val ).append( "'" ); 546 } 547 buf.append( "));\"" ); 548 549 return buf; 550 } 551 552 /** 553 * 選択用のチェックボックスの input タグを作成します。 554 * 555 * @og.rev 3.5.5.5 (2004/04/23) 新規作成 556 * 557 * @return チェックボックスのinputタグ 558 */ 559 private String makeChboxTag() { 560 if( isCache ) { return cacheTag; } 561 isCache = true; 562 563 String type = getSelectedType(); // "checkbox"/"radio"/"hidden" 564 565 if( type != null ) { 566 StringBuilder buf = new StringBuilder(); 567 568 buf.append( "<input type=\"" ).append( type ).append( "\" " ); 569 buf.append( "name=\"" ).append( HybsSystem.ROW_SEL_KEY ).append( "\"" ); 570 571 cacheTag = buf.toString(); 572 } 573 return cacheTag ; 574 } 575 576 /** 577 * カラムのラベル名(短)を返します。 578 * カラムの項目名に対して,見える形の文字列を返します。 579 * 一般には,リソースバンドルと組合せて,各国ロケール毎にラベルを 580 * 切替えます。 581 * 582 * @og.rev 4.0.0.0 (2005/01/31) 新規追加( shortLabel を返します。) 583 * 584 * @param column カラム番号 585 * 586 * @return カラムのラベル名(短) 587 */ 588 @Override 589 protected String getColumnLabel( final int column ) { 590 return getDBColumn( column ).getShortLabel(); 591 } 592}