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.plugin.view; 017 018 import org.opengion.hayabusa.common.HybsSystem; 019 import org.opengion.hayabusa.db.DBTableModel; 020 021 /** 022 * å?ƒ•ã‚£ãƒ¼ãƒ«ãƒ‰æƒ…å ±ã‹ã‚‰ã€å‹•çš?«ã‚«ãƒ©ãƒ?‚’作æ?ã™ã‚‹å‹•的カラãƒ?¸?¦§è¡¨ç¤ºã‚¯ãƒ©ã‚¹ã§ã™ã? 023 * 024 * AbstractViewForm ã«ã‚ˆã‚Šã€setter/getterメソãƒ?ƒ‰ã®ãƒ?ƒ•ォルト実è£?‚’æä¾›ã—ã¦ã?¾ã™ã? 025 * å„HTMLã®ã‚¿ã‚°ã«å¿?¦ãª setter/getterメソãƒ?ƒ‰ã®ã¿?Œè¿½åŠ?®šç¾©ã—ã¦ã?¾ã™ã? 026 * 027 * AbstractViewForm を継承ã—ã¦ã?‚‹ç‚º,ãƒã‚±ãƒ¼ãƒ«ã«å¿œã˜ãŸãƒ©ãƒ™ãƒ«ã‚’å?力ã•ã›ã‚‹äº‹ãŒå‡ºæ¥ã¾ã™ã? 028 * 029 * @og.group ç”»é¢è¡¨ç¤º 030 * 031 * @version 4.0 032 * @author Kazuhiko Hasegawa 033 * @since JDK5.0, 034 */ 035 public class ViewForm_HTMLDynamic extends ViewForm_HTMLTable { 036 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 037 private static final String VERSION = "5.1.6.0 (2010/05/01)" ; 038 039 /** カラãƒ??値を返ã™å ´åˆã?ã€ã‚«ãƒ©ãƒ?‚ーåç§° {@value} */ 040 public static final String COLUMN_RETURN_KEY = "COLUMN_RETURN"; 041 private int rtnColumnNo = -1; // column_return カラãƒ??ç•ªå· 042 043 // 4.3.4.4 (2009/01/01) 044 // /** 045 // * ãƒ?ƒ•ォルトコンストラクター 046 // * 047 // */ 048 // public ViewForm_HTMLDynamic() { 049 // super(); 050 // } 051 052 /** 053 * åˆæœŸåŒ–ã—ã¾ã™ã? 054 * ã“ã“ã§ã¯ã€å?部ã§ä½¿ç”¨ã•れã¦ã?‚‹ã‚ャãƒ?‚·ãƒ¥ã‚’クリアã—ã? 055 * æ–°ã—ã„モãƒ?ƒ«(DBTableModel)ã¨è¨?ª?lang) ã‚’å?ã«å†?ƒ¨ãƒ??ã‚¿ã‚’å?構築ã—ã¾ã™ã? 056 * ãŸã ã—ã?è¨å®šæƒ…å ±ã¯ã€ä»¥å‰ã?状態ãŒãã?ã¾ã¾ã‚ープã•れã¦ã?¾ã™ã? 057 * 058 * @og.rev 3.1.1.0 (2003/03/28) åŒæœŸãƒ¡ã‚½ãƒ?ƒ‰(synchronized付ã)ã‚’éžåŒæœŸã«å¤‰æ›´ã™ã‚‹ã€? 059 * @og.rev 3.5.6.1 (2004/06/25) lang è¨?ªžã‚³ãƒ¼ãƒ?属æ?を削除ã—ã¾ã™ã? 060 * 061 * @param table DBTableModelオブジェクãƒ? 062 */ 063 @Override 064 public void init( final DBTableModel table ) { 065 super.init( table ); 066 int clmCnt = getColumnCount(); 067 for( int i=0; i<clmCnt; i++ ) { 068 if( COLUMN_RETURN_KEY.equalsIgnoreCase( getColumnName(i) )) { 069 rtnColumnNo = i; 070 break; 071 } 072 } 073 } 074 075 /** 076 * DBTableModel ã‹ã‚‰ HTMLæ–?—å?を作æ?ã—ã¦è¿”ã—ã¾ã™ã? 077 * startNo(表示開始ä½ç½®)ã‹ã‚‰ã€pageSize(表示件数)ã¾ã§ã®Viewæ–?—å?を作æ?ã—ã¾ã™ã? 078 * 表示残りãƒ??ã‚¿ã?pageSize 以下ã?å ´åˆã?,残りã®ãƒ??ã‚¿ã‚’ã™ã¹ã¦å‡ºåŠ›ã—ã¾ã™ã? 079 * 080 * @og.rev 3.5.4.0 (2003/11/25) getBgColorCycleClass ã®è¿”ã™æ–?—å?を変更ã™ã‚‹ã€? 081 * @og.rev 3.5.6.4 (2004/07/16) ヘッãƒ??ã¨ãƒœãƒ‡ã‚£ãƒ¼éƒ¨ã‚’JavaScriptã§åˆ?›¢ 082 * 083 * @param startNo 表示開始ä½ç½® 084 * @param pageSize 表示件数 085 * 086 * @return DBTableModelã‹ã‚‰ä½œæ?ã•れã?HTMLæ–?—å? 087 */ 088 @Override 089 public String create( final int startNo, final int pageSize ) { 090 if( getRowCount() == 0 ) { return ""; } // 暫定å?ç½® 091 092 int lastNo = getLastNo( startNo, pageSize ); 093 094 StringBuilder out = new StringBuilder( HybsSystem.BUFFER_LARGE ); 095 096 out.append( getCountForm( startNo,pageSize ) ); 097 out.append( getHeader() ); 098 099 int rowIndex = 0; 100 out.append("<tbody>").append( HybsSystem.CR ); 101 out.append("<tr").append( getBgColorCycleClass( rowIndex++ ) ).append(">"); 102 int clmCnt = getColumnCount(); // 3.5.5.7 (2004/05/10) 103 for( int row=startNo; row<lastNo; row++ ) { 104 for(int column = 0; column < clmCnt; column++) { 105 if( isColumnReturn( row,column ) ) { 106 out.append("</tr>"); 107 out.append("<tr").append( getBgColorCycleClass( rowIndex++ ) ).append(">"); 108 } 109 else if( isColumnDisplay( column ) ) { 110 out.append(" <td>"); 111 out.append( getValueLabel(row,column) ); 112 out.append("</td>").append( HybsSystem.CR ); 113 } 114 } 115 } 116 out.append("</tr>").append( HybsSystem.CR ); 117 out.append("</tbody>").append( HybsSystem.CR ); 118 out.append("</table>").append( HybsSystem.CR ); 119 120 out.append( getScrollBarEndDiv() ); // 3.8.0.3 (2005/07/15) 121 return out.toString(); 122 } 123 124 /** 125 * DBTableModel ã‹ã‚‰ ãƒ??ブルã®ã‚¿ã‚°æ–?—å?を作æ?ã—ã¦è¿”ã—ã¾ã™ã? 126 * 127 * @return ãƒ??ブルã®ã‚¿ã‚°æ–?—å? 128 */ 129 @Override 130 protected String getTableHead() { 131 // ヘッãƒ??ã¯?Œä¸è¦ã§ã™ã? 132 return ""; 133 } 134 135 /** 136 * カラãƒ?Œè¡¨ç¤ºå¯èƒ½ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã? 137 * ã‚‚ã—?Œè¡¨ç¤ºä¸å¯ã®å ´åˆã?,ã“ã?カラãƒ??å…¨ãƒ??ã‚¿ãŒï¼Œè¡¨ç¤ºå¯¾è±¡ã‹ã‚‰å¤–ã•れã¾ã™ã? 138 * 139 * @param row è¡Œç•ªå· 140 * @param column カラãƒ?•ªå· 141 * 142 * @return 表示å¯èƒ½(true)?ä¸å¯èƒ½(false) 143 */ 144 private boolean isColumnReturn( final int row,final int column ) { 145 boolean rtnFlag = false; 146 147 if( rtnColumnNo == column && 148 "1".equals( getValue( row,column ) ) ) { 149 rtnFlag = true; 150 } 151 152 return rtnFlag; 153 } 154 155 /** 156 * 表示é ?›®ã®ç·¨é›?ä¸¦ã³æ›¿ã?ãŒå¯èƒ½ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã? 157 * 158 * @og.rev 5.1.6.0 (2010/05/01) æ–°è¦è¿½åŠ? 159 * 160 * @return 表示é ?›®ã®ç·¨é›?ä¸¦ã³æ›¿ã?ãŒå¯èƒ½ã‹ã©ã?‹(false:ä¸å¯èƒ½) 161 */ 162 @Override 163 public boolean isEditable() { 164 return false; 165 } 166 }