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.hayabusa.taglib; 017 018 import org.opengion.hayabusa.common.HybsSystem; 019 import static org.opengion.fukurou.util.StringUtil.nval; 020 021 022 /** 023 * å·¦å³åˆ?‰²ã‚¹ã‚¯ãƒãƒ¼ãƒ«å‡¦ç?‚’行ã†ã€View ã‚’è¨å®šã—ã¾ã™ã? 024 * 025 * BODY部ã«è¨˜è¿°ã•れã?Viewã‚¿ã‚°ã«å¯¾ã—ã¦ã€å·¦å³åˆ?‰²æƒ??を追記è¨å®šã—ã¾ã™ã? 026 * Viewã‚¿ã‚°ã®å·¦å´ã«ã¯ã€ã“ã®ã‚¿ã‚°ã§æŒ?®šã•れ㟠fixDisplay ã®ã‚«ãƒ©ãƒ?‚’ columnDisplay ã« 027 * è¨å®šã™ã‚‹ã¨ã¨ã‚‚ã«ã€ã“ã®ã‚¿ã‚°ã§æŒ?®šã•れ㟠numberType ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã? 028 * (åˆæœŸå€¤ã¯ã€numberType="sequence" ã§ã™ã?) 029 * Viewã‚¿ã‚°ã®å³å´ã«ã¯ã€fixDisplay ã®ã‚«ãƒ©ãƒ?‚’ noDisplay ã®ã‚«ãƒ©ãƒ?«è¨å®šã™ã‚‹ã¨ã¨ã‚‚ã«ã€? 030 * command="VIEW" , noMessage="true" , useSelectedRow="false" , numberType="delete" 031 * ã‚’ã‚»ãƒ?ƒˆã—ã¾ã™ã?(æ—¢å˜ã?è¨å®šå?ãŒã‚れã?ã€ãれã«è¿½è¨˜ã•れã¾ã™ã?) 032 * 033 * @og.formSample 034 * â—å½¢å¼ï¼?lt;og:splitView fixDisplay="CLM,NAME_JA"><og:view ・・・ /></og:splitView> 035 * â—body?šã‚ã‚?EVAL_BODY_INCLUDE:BODYをインクルードã—ã€{@XXXX} ã¯è§£æžã—ã¾ã›ã‚“) 036 * 037 * â—Tag定義?? 038 * <og:splitView 039 * fixDisplay ã€TAG】固定ã™ã‚‹ã‚«ãƒ©ãƒ?ã‚’ã?CSVå½¢å¼?カンマ区åˆ?‚Šæ–?—å?)ã§è¨å®šã—ã¾ã? 040 * debug ã€TAG】デãƒãƒƒã‚°æƒ??ã‚’å?力ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false) 041 * > ... Body ... 042 * </og:splitView> 043 * 044 * â—使用ä¾? 045 * <og:splitView fixDisplay="CLM,NAME_JA"> 046 * <og:view 047 * viewFormType = "HTMLTable" 048 * command = "{@command}" 049 * checked = "{@checked}" 050 * startNo = "{@startNo}" 051 * pageSize = "{@pageSize}" 052 * noWritable = "{@noWritable}" 053 * columnWritable = "{@columnWritable}" 054 * /> 055 * </og:splitView> 056 * 057 * @og.rev 5.3.0.0 (2010/12/01) æ–°è¦ä½œæ? 058 * @og.group ç”»é¢éƒ¨å“? 059 * 060 * @version 4.0 061 * @author Kazuhiko Hasegawa 062 * @since JDK5.0, 063 */ 064 public class SplitViewTag extends CommonTagSupport { 065 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 066 private static final String VERSION = "5.3.0.0 (2010/12/01)" ; 067 068 private static final long serialVersionUID = 530020101201L ; 069 070 private static final String SPLIT_A = 071 "<style type=\"text/css\">#GantBody div tr { height:22px; }</style>" + HybsSystem.CR 072 + "<table id=\"GantBody\" border=\"0px\" cellpadding=\"0px\" cellspacing=\"0px\"" + HybsSystem.CR 073 + " frame=\"box\" rules=\"all\" style=\"margin:0px;padding:0px;\">" + HybsSystem.CR 074 + " <tr style=\"margin:0px;padding:0px;\">" + HybsSystem.CR 075 + " <td valign=\"top\" style=\"margin:0px; padding:0px;\" >" + HybsSystem.CR 076 + " <div id=\"X1\" style=\"overflow-x:hidden; overflow-y:hidden;\" >" + HybsSystem.CR ; 077 078 private static final String SPLIT_B = 079 " </div>" + HybsSystem.CR 080 + " </td>" + HybsSystem.CR 081 + " <td valign=\"top\" style=\"margin:0px; padding:0px;\">" + HybsSystem.CR 082 + " <div id=\"X2\" style=\"position:absolute; overflow-x:hidden; overflow-y:hidden;\" >" + HybsSystem.CR ; 083 084 private static final String SPLIT_C = 085 " </div>" + HybsSystem.CR 086 + " </td>" + HybsSystem.CR 087 + " </tr>" + HybsSystem.CR 088 + "</table>" + HybsSystem.CR ; 089 090 private String fixDisplay = null; 091 private boolean firstStepFlag = true; // BODY部㮠view 処ç??制御 092 093 /** 094 * Taglibã®é–‹å§‹ã‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doStartTag() ã‚?オーãƒã?ライドã—ã¾ã™ã? 095 * 096 * @return 後続å?ç??æŒ?¤º( EVAL_BODY_INCLUDE ) 097 */ 098 @Override 099 public int doStartTag() { 100 firstStepFlag = true; 101 // EVAL_BODY_BUFFERED ã§ã¯ãªãã?Viewãªã®ã§ã€INCLUDE 処ç?—ã¾ã™ã? 102 jspPrint( SPLIT_A ); 103 return( EVAL_BODY_INCLUDE ); // Body インクルーãƒ? extends TagSupport æ™? 104 } 105 106 /** 107 * Taglibã®ã‚¿ã‚°æœ¬ä½“を処ç?™ã‚?doAfterBody() ã‚?オーãƒã?ライドã—ã¾ã™ã? 108 * 109 * @return 後続å?ç??æŒ?¤º(SKIP_BODY) 110 */ 111 @Override 112 public int doAfterBody() { 113 // EVAL_BODY_INCLUDE ãªã®ã§ã€ã‚³ãƒ³ãƒ?ƒ³ãƒ??å–å¾—ã§ã¯ãªãã?処ç??ã¿å®Ÿè¡Œã•れã¾ã™ã? 114 115 if( firstStepFlag ) { 116 firstStepFlag = false; 117 118 jspPrint( SPLIT_B ); 119 return( EVAL_BODY_BUFFERED ); // ボディーをå?評価( extends BodyTagSupport æ™? 120 } 121 else { 122 jspPrint( SPLIT_C ); 123 return(SKIP_BODY); // Body を評価ã—ãªã? 124 } 125 } 126 127 /** 128 * タグリブオブジェクトをリリースã—ã¾ã™ã? 129 * ã‚ャãƒ?‚·ãƒ¥ã•れã¦å†åˆ©ç”¨ã•れるã?ã§ã€ãƒ•ィールドã?åˆæœŸè¨å®šã‚’行ã„ã¾ã™ã? 130 * 131 */ 132 @Override 133 protected void release2() { 134 super.release2(); 135 fixDisplay = null; 136 } 137 138 /** 139 * ã€TAG】固定ã™ã‚‹ã‚«ãƒ©ãƒ?ã‚’ã?CSVå½¢å¼?カンマ区åˆ?‚Šæ–?—å?)ã§è¨å®šã—ã¾ã™ã? 140 * 141 * @og.tag 142 * Viewã‚¿ã‚°ã®å·¦å´(固定部)ã«ã¯ã€ã“ã®ã‚¿ã‚°ã§æŒ?®šã•れ㟠fixDisplay ã®ã‚«ãƒ©ãƒ?‚’ 143 * columnDisplay ã«è¨å®šã—ã¾ã™ã? 144 * Viewã‚¿ã‚°ã®å³å´ã«ã¯ã€fixDisplay ã®ã‚«ãƒ©ãƒ?‚’ noDisplay ã®ã‚«ãƒ©ãƒ?«è¨å®šã—ã¾ã™ã? 145 * æ—¢å˜ã?è¨å®šå?(noDisplay)ãŒã‚れã?ã€ãれã«è¿½è¨˜ã•れã¾ã™ã? 146 * 147 * @param clms 固定ã™ã‚‹ã‚«ãƒ©ãƒ?(カンマ区åˆ?‚Šæ–?—å?) 148 */ 149 public void setFixDisplay( final String clms ) { 150 fixDisplay = nval( getRequestParameter( clms ),fixDisplay ); 151 } 152 153 /** 154 * 固定ã™ã‚‹ã‚«ãƒ©ãƒ?ã‚’ã?CSVå½¢å¼?カンマ区åˆ?‚Šæ–?—å?)ã§å–å¾—ã—ã¾ã™ã? 155 * 156 * ã“れã¯ã€BODY部ã«è¨˜è¿°ã•れãŸã?viewã‚¿ã‚°ã‹ã‚‰ã‚¢ã‚¯ã‚»ã‚¹ã•れるメソãƒ?ƒ‰ã§ã™ã? 157 * è¨å®šã•れã¦ã?ªã??åˆã?ã€null ã§ã™ã? 158 * 159 * @return 固定ã™ã‚‹ã‚«ãƒ©ãƒ?(カンマ区åˆ?‚Šæ–?—å?) 160 */ 161 protected String getFixDisplay() { 162 return fixDisplay ; 163 } 164 165 /** 166 * BODY部㮠view 処ç??制御を行ã†ãŸã‚ã®ãƒ•ラグを返ã—ã¾ã™ã? 167 * 168 * å·¦å³åˆ?‰²ã‚’行ã†ã«ã¯ã€Viewタグを2回出力ã™ã‚‹å¿?¦ãŒã‚りã¾ã™ã? 169 * ã“ã“ã§ã¯ isFirstStep="true" ãŒï¼‘回目(å·¦å´:固定部)ã§ã€false ã? 170 * å³å´(å¯å¤‰éƒ¨)ã«ãªã‚‹ã‚ˆã?«ã€Viewå´ã§åˆ¶å¾¡ã—ã¾ã™ã? 171 * 172 * @return BODY部㮠view 処ç??制御(true:?‘回目 / false:?’回目) 173 */ 174 protected boolean isFirstStep() { 175 return firstStepFlag ; 176 } 177 178 /** 179 * ã“ã?オブジェクトã?æ–?—å?表ç¾ã‚’è¿”ã—ã¾ã™ã? 180 * 基本çš?«ãƒ?ƒãƒ?‚°ç›®çš?«ä½¿ç”¨ã—ã¾ã™ã? 181 * 182 * @return ã“ã?ã‚¯ãƒ©ã‚¹ã®æ–?—å?è¡¨ç¾ 183 */ 184 @Override 185 public String toString() { 186 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() ) 187 .println( "VERSION" ,VERSION ) 188 .println( "fixDisplay" ,fixDisplay ) 189 .println( "Other..." ,getAttributes().getAttribute() ) 190 .fixForm().toString() ; 191 } 192 }