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 020 /** 021 * 検索結果を単純なリスト形式で表示するクラスです? 022 * 023 * こ?クラスでは、検索結果を単純なリストで表示します? 024 * 表示のみでこ?表示フォーマットを利用して??タ編?行うことはできません? 025 * 026 * ?ラ????タは、カンマによって連結され?また??ー部?出力されません? 027 * さらに?ラ??属?値に基づくclass属?等も??出力されません? 028 * 029 * AbstractViewForm により、setter/getterメソ?の?ォルト実?提供して?す? 030 * 各HTMLのタグに?な setter/getterメソ?のみ?追?義して?す? 031 * 032 * AbstractViewForm を継承して?為,ロケールに応じたラベルを?力させる事が出来ます? 033 * 034 * @og.group 画面表示 035 * 036 * @version 4.0 037 * @author Hiroki Nakamura 038 * @since JDK5.0, 039 */ 040 public class ViewForm_HTMLSimpleList extends ViewForm_HTMLTable { 041 //* こ?プログラ??VERSION??を設定します? {@value} */ 042 private static final String VERSION = "5.1.6.0 (2010/05/01)" ; 043 044 // 警告時の行ごとに色を変更する時?、デフォルトクラス属? 045 private static final String BG_WARNING_COLOR = " class=\"row_warning\""; 046 047 // エラー時?行ごとに色を変更する時?、デフォルトクラス属? 048 private static final String BG_ERROR_COLOR = " class=\"row_error\""; 049 050 private String color_row = ""; 051 052 // 4.3.4.4 (2009/01/01) 053 // /** 054 // * ?ォルトコンストラクター 055 // * 056 // */ 057 // public ViewForm_HTMLSimpleList() { 058 // super(); 059 // } 060 061 // 4.3.4.4 (2009/01/01) 062 // /** 063 // * ?をクリア(初期?します? 064 // * 065 // */ 066 // public void clear() { 067 // super.clear(); 068 // } 069 070 /** 071 * DBTableModel から HTML??を作?して返します? 072 * startNo(表示開始位置)から、pageSize(表示件数)までのView??を作?します? 073 * 表示残り??タ?pageSize 以下?場合?,残りの??タをすべて出力します? 074 * 075 * @param startNo 表示開始位置 076 * @param pageSize 表示件数 077 * 078 * @return DBTableModelから作?され?HTML?? 079 */ 080 @Override 081 public String create( final int startNo, final int pageSize ) { 082 if( getRowCount() == 0 ) { return ""; } 083 084 int lastNo = getLastNo( startNo, pageSize ); 085 086 StringBuilder out = new StringBuilder( HybsSystem.BUFFER_LARGE ); 087 088 int clmCnt = getColumnCount(); 089 for( int row=startNo; row<lastNo; row++ ) { 090 if( isSkip( row ) || isSkipNoEdit( row ) ) { continue; } 091 092 if( row != startNo ) { out.append( "<br />" ); } 093 094 out.append( "<span " +getBgColorCycleClass(row) + ">" ); 095 boolean isFirstColumn = true; 096 for(int column = 0; column < clmCnt; column++) { 097 if( isColumnDisplay( column ) ) { 098 if( isColumnDisplay( column ) ) { 099 if( isFirstColumn ) { 100 int no = row + 1; 101 out.append( no + "." ); 102 } 103 else { 104 out.append( "," ); 105 } 106 out.append( getValueLabel(row,column) ); 107 isFirstColumn = false; 108 } 109 } 110 } 111 out.append( "</span>" ); 112 } 113 114 return out.toString(); 115 } 116 117 /** 118 * ??ブルのバックグラウンドカラーの入れ替え?サイクルをセ?します? 119 * 0以?通常)?1(ワーニング)?2以?エラー) 120 * 初期値は?以?通常)です? 121 * 122 * @param sycle 0以?通常)?1(ワーニング)?2以?エラー) 123 */ 124 @Override 125 public void setBgColorCycle( final int sycle ) { 126 if( sycle == -1 ) { // -1(ワーニング) 127 color_row = BG_WARNING_COLOR ; 128 } 129 else if( sycle < -1 ) { // -2以?エラー) 130 color_row = BG_ERROR_COLOR ; 131 } 132 } 133 134 /** 135 * ??ブルのバックグラウンドカラーの値をセ?します? 136 * 137 * @param row 行番号( ?から始め?) 138 * 139 * @return 行?色を指定す?class 属?( cssファイルで??) 140 */ 141 @Override 142 protected String getBgColorCycleClass( final int row ) { 143 return color_row ; 144 } 145 146 /** 147 * 表示?の編?並び替?が可能かど?を返しま? 148 * 149 * @og.rev 5.1.6.0 (2010/05/01) 新規追? 150 * 151 * @return 表示?の編?並び替?が可能かど?(false:不可能) 152 */ 153 @Override 154 public boolean isEditable() { 155 return false; 156 } 157 158 }