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 org.opengion.hayabusa.common.HybsSystemException;
020 import org.opengion.fukurou.util.StringUtil;
021 import org.opengion.fukurou.util.TagBuffer;
022
023 /**
024 * é…置図?座å¸è¡¨ã‚’表ã™ç‰¹æ®Šç³»ã®ãƒ“ューã§ã™ã?
025 *
026 * itd ã‚¿ã‚°ã¯ã€ã‚¬ãƒ³ãƒˆã?ãƒ?ƒ€ãƒ¼éƒ¨ã® TDã‚¿ã‚°ã®ç¹°è¿”ã—ã«ä½¿ç”¨ã•れã¾ã™ã?
027 * ã“ã?ç¹°è¿”ã—ã¯ã€ganttParam ã‚¿ã‚°ã® minDuration ã§æŒ?®šã•れãŸé–“éš”ã§è¡Œã‚れã¾ã™ã?
028 * (例ãˆã°ã€?.5 を指定ã™ã‚Œã?ã€åŠæ—¥å˜ä½ã§å‡¦ç?•れã¾ã™ã?)
029 * itd ã‚¿ã‚°ã® colspan 属æ?を指定ã—ãŸå?åˆã?ã€itd 自身ãŒã?td ã‚¿ã‚°ã« colspan ã‚?
030 * 追åŠ?™ã‚‹ã¨å…±ã«ã€ç¹°è¿”ã—自身をã?ãã?æŒ?®šæ•°ã?‘ã«æŠ‘åˆ¶ã—ã¾ã™ã?
031 * 具体的ã«ã¯ã€colspan="2" ã¨ã™ã‚‹ã¨ã€?¼’回ã«ä¸?›žã—ã‹ã€itd ã‚¿ã‚°ãŒå‘¼ã³å‡ºã•れãªã?
032 * ãªã‚Šã¾ã™ã?
033 *
034 * @og.formSample
035 * â—å½¢å¼ï¼?lt;og:iMatrix ... />
036 * â—body?šãªã?
037 * â—å‰æï¼šheadã‚¿ã‚°ã§ã€adjustEvent="Matrix" を指定ã—ã¦ãã ã•ã„ã€?
038 *
039 * â—Tag定義??
040 * <og:iMatrix
041 * mode ã€TAG】[Layout:レイアウト編é›?Value:è¨å®šå?ã®ç·¨é›?(åˆæœŸå€¤:Layout)
042 * countPro ã€TAG】データノã?ドã?属æ?æ•°( è¡? åˆ? åç§°, 値, 色, ç·¨é›?¯å¦, スãƒ??タス )(åˆæœŸå€¤:7)
043 * (SQLæ–??カラãƒ?•°(éžè¡¨ç¤ºé ?›®ã‚’除ã?)
044 * inputWidth ã€TAG】編é›?™‚ã®å…¥åŠ›æ¬?¹?px)(åˆæœŸå€¤:50px)
045 * cellWidth ã€TAG】セルå¹?px) (åˆæœŸå€¤:75px)
046 * cellHeight ã€TAG】セル高ã•(px) (åˆæœŸå€¤:30px)
047 * showStatus ã€TAG】スãƒ??タスã®å‡ºåŠ›ã‚’è¡Œã†ã‹ã©ã?‹[[true:表示ã™ã‚‹/false:表示ã—ãªã„]](åˆæœŸå€¤:false)
048 * countStatus ã€TAG】スãƒ??タスã®ç¨®é¡žæ•°??:会è°ã€?:æ¥å®¢ã€?:出張ã€?:外å?ã€?:休暇ã€?:ä»–ï¼?åˆæœŸå€¤:6)
049 * writable ã€TAG】画é¢ç·¨é›?ƒ•ラグを[true:å¯/false:ä¸å¯](åˆæœŸå€¤:false)
050 * editColor ã€TAG】セル背景色ã®ç·¨é›?¯å¦[true:ç·¨é›?¯/false:ç·¨é›?¸å¯](åˆæœŸå€¤:false)
051 * separator ã€TAG】セルåç§°ã¨è¨å®šå?ã®é–“ã?区åˆ?‚Šæ–??åˆæœŸå€¤:":")
052 * paramVal ã€TAG】セルã®è¨å®šå?ã¯ãƒ‘ラメータより渡ã?åˆæœŸå€¤:"")
053 * paramColor ã€TAG】セルã®èƒŒæ™¯è‰²ã¯ãƒ‘ラメータより渡ã?åˆæœŸå€¤:"")
054 * notEditBgColor ã€TAG】編é›?¸å¯ã®ã‚»ãƒ«ã®èƒŒæ™¯è‰²(åˆæœŸå€¤:gray)
055 * debug ã€TAG】デãƒãƒƒã‚°æƒ??ã‚’å?力ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)
056 * />
057 *
058 * â—使用ä¾?
059 * Select æ–??ã€è¡? åˆ? åç§°, 値, 色, ç·¨é›?¯å¦, スãƒ??タス ã®é ?§æ¤œç´¢ã—ã¾ã™ã?
060 * <og:query >
061 * select 行番å·,列番å·,セルåç§°,セルè¨å®šå?,セル背景色,セルã®ç·¨é›?¯å¦,セルã®ã‚¹ãƒ??タス
062 * from レイアウトテーブル
063 * where ãƒã‚±ãƒ¼ã‚·ãƒ§ãƒ³ID = 'XXXX'
064 * order by 行番å·,列番å·
065 * </og:query>
066 *
067 * viewã‚¿ã‚°ã«ã‚ˆã‚‹HTML出åŠ?ã¯ã€ã“ã®é€šã‚Šã«ã—ã¦ãã ã•ã„ã€?
068 * <og:view
069 * viewFormType = "HTMLDynamic"
070 * useScrollBar = "false"
071 * useHilightRow = "false"
072 * noMessage = "true"
073 * pageSize = "0"
074 * />
075 *
076 * <og:iMatrix
077 * mode = "Layout/Value"
078 * countPro = "7"
079 * inputWidth = "80px"
080 * cellWidth = "100px"
081 * cellHeight = "30px"
082 * showStatus = "true/false"
083 * countStatus = "6"
084 * writable = "true/false"
085 * editColor = "true/false"
086 * separator = ":"
087 * paramVal = "{@XXX}"
088 * paramColor = "{@XXX}"
089 * notEditBgColor = "#XXXXXX"
090 * />
091 *
092 * @og.rev 5.6.3.2 (2013/04/12) æ–°è¦ä½œæ?
093 * @og.group ç”»é¢éƒ¨å“?
094 *
095 * @version 5.0
096 * @author Kazuhiko Hasegawa
097 * @since JDK6.0,
098 */
099 public class ViewIMatrixTag extends CommonTagSupport {
100 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */
101 private static final String VERSION = "5.6.3.2 (2013/04/12)" ;
102
103 private static final long serialVersionUID = 563220130412L ;
104
105 /** mode å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?モードリスãƒ? */
106 private static final String[] MODE_LIST = new String[] { "Layout" , "Value" };
107
108 private TagBuffer tag = new TagBuffer( "iMatrix" ) ;
109
110 /**
111 * Taglibã®çµ‚äº?‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doEndTag() ã‚?オーãƒã?ライドã—ã¾ã™ã?
112 *
113 * @og.rev 5.8.1.0 (2014/11/07) HTML5対応ã?javaScriptã§ã€BODYãŒãªã?¨å…¥ã‚Œåã«ãªã£ã¦ã—ã¾ã??
114 * @return 後続å?ç??æŒ?¤º
115 */
116 @Override
117 public int doEndTag() {
118 debugPrint(); // 4.0.0 (2005/02/28)
119
120 tag.setBody( "<!-- -->" ); // 5.8.1.0 (2014/11/07) HTML5対応ã?
121 jspPrint( tag.makeTag() );
122
123 return(EVAL_PAGE); // ペã?ã‚¸ã®æ®‹ã‚Šã‚’評価ã™ã‚‹ã€?
124 }
125
126 /**
127 * タグリブオブジェクトをリリースã—ã¾ã™ã?
128 * ã‚ャãƒ?‚·ãƒ¥ã•れã¦å†åˆ©ç”¨ã•れるã?ã§ã€ãƒ•ィールドã?åˆæœŸè¨å®šã‚’行ã„ã¾ã™ã?
129 *
130 */
131 @Override
132 protected void release2() {
133 super.release2();
134 tag = new TagBuffer( "iMatrix" );
135 }
136
137 /**
138 * ã€TAG】é?置図?座å¸è¡¨ã®ç·¨é›?ƒ¢ãƒ¼ãƒ?Layout:レイアウト編é›?Value:è¨å®šå?ã®ç·¨é›?を指定ã—ã¾ã?åˆæœŸå€¤:Layout)ã€?
139 *
140 * @og.tag
141 * mode ã¯ã€Layout:レイアウト編é›?‚’行ã†ã®ã‹ã?Value:è¨å®šå?ã®ç·¨é›?‚’行ã†ã‹ã‚’æŒ?®šã—ã¾ã™ã?
142 * Layout:レイアウト編é›?CELLNAMEã¨FGCELLEDITã®å€¤ã‚’ç·¨é›?—ã¾ã™ã?)
143 * Value :è¨å®šå?ã®ç·¨é›?VALUEã¨COLORã®å€¤ã‚’ç·¨é›?—ã¾ã™ã?)
144 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€Layout:レイアウト編é›?ã§ã™ã?
145 *
146 * @param mode ç·¨é›?ƒ¢ãƒ¼ãƒ?Layout:レイアウト編é›?Value:è¨å®šå?ã®ç·¨é›?
147 */
148 public void setMode( final String mode ) {
149 String tmpMode = StringUtil.nval( getRequestParameter( mode ),null );
150
151 if( !check( tmpMode, MODE_LIST ) ) {
152 String errMsg = "æŒ?®šã?モーãƒ?mode)ã¯æŒ?®šã§ãã¾ã›ã‚“。モード指定エラー"
153 + HybsSystem.CR
154 + "mode=[" + tmpMode + "] "
155 + HybsSystem.CR
156 + StringUtil.array2csv( MODE_LIST ) ;
157 throw new HybsSystemException( errMsg );
158 }
159
160 tag.add( "mode",tmpMode );
161 }
162
163 /**
164 * ã€TAG】データノã?ドã?属æ?æ•°( è¡? åˆ? åç§°, 値, 色, ç·¨é›?¯å¦, スãƒ??タス )を指定ã—ã¾ã?åˆæœŸå€¤:7)ã€?
165 *
166 * @og.tag
167 * SQLæ–??カラãƒ?•°(éžè¡¨ç¤ºé ?›®ã‚’除ã?を指定ã—ã¾ã™ã?
168 * SQLæ–??ã€å?é ã‹ã‚‰ã€ã?è¡? åˆ? åç§°, 値, 色, ç·¨é›?¯å¦, スãƒ??タスã€ã?é ?«æ¤œç´¢ã™ã‚‹å¿?¦ãŒã‚りã¾ã™ã?
169 * ã“れ以外ã«ã€è¡¨ç¤ºé ?›®ã«ãªã‚‹ã‚«ãƒ©ãƒ?‚’æŒ?®šã™ã‚‹å?åˆã«ã€è¡¨ç¤ºã‚«ãƒ©ãƒ?•°ã‚’è¨å®šã—ã¾ã™ã?
170 * å¿?¦å?ã?‘?ˆè¡? åˆ? åç§°, 値, 色, ç·¨é›?¯å¦, スãƒ??タス?‰ã?å ´åˆã?ã€?7" を指定ã—ã¾ã™ã?
171 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?7" ã§ã™ã?
172 *
173 * @param countPro ãƒ??タノã?ドã?属æ?æ•°
174 */
175 public void setCountPro( final String countPro ) {
176 tag.add( "countPro",StringUtil.nval( getRequestParameter( countPro ),null ) );
177 }
178
179 /**
180 * ã€TAG】編é›?™‚ã®å…¥åŠ›æ¬?¹?px)を指定ã—ã¾ã?åˆæœŸå€¤:50px)ã€?
181 *
182 * @og.tag
183 * ç·¨é›?™‚ã®å…¥åŠ›æ¬?¹?px)を指定ã—ã¾ã™ã?
184 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?50px" ã§ã™ã?
185 *
186 * @param inputWidth ç·¨é›?™‚ã®å…¥åŠ›æ¬?¹?px)
187 */
188 public void setInputWidth( final String inputWidth ) {
189 tag.add( "inputWidth",StringUtil.nval( getRequestParameter( inputWidth ),null ) );
190 }
191
192 /**
193 * ã€TAG】セルå¹?px)を指定ã—ã¾ã?åˆæœŸå€¤:75px)ã€?
194 *
195 * @og.tag
196 * セルå¹?px)を指定ã—ã¾ã™ã?
197 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?75px" ã§ã™ã?
198 *
199 * @param cellWidth セル�px)
200 */
201 public void setCellWidth( final String cellWidth ) {
202 tag.add( "cellWidth",StringUtil.nval( getRequestParameter( cellWidth ),null ) );
203 }
204
205 /**
206 * ã€TAG】セル高ã•(px)を指定ã—ã¾ã?åˆæœŸå€¤:30px)ã€?
207 *
208 * @og.tag
209 * セル高ã•(px)を指定ã—ã¾ã™ã?
210 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?30px" ã§ã™ã?
211 *
212 * @param cellHeight セル高ã•(px)
213 */
214 public void setCellHeight( final String cellHeight ) {
215 tag.add( "cellHeight",StringUtil.nval( getRequestParameter( cellHeight ),null ) );
216 }
217
218 /**
219 * ã€TAG】スãƒ??タスã®å‡ºåŠ›ã‚’è¡Œã†ã‹ã©ã?‹[true:表示ã™ã‚‹/false:表示ã—ãªã„]を指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
220 *
221 * @og.tag
222 * スãƒ??タスã®å‡ºåŠ›ã‚’è¡Œã†å ´åˆã?ã€?./image/status_番å·.png イメージを画é¢ã«è¡¨ç¤ºã—ã¾ã™ã?
223 * 番å·ãŒã?スãƒ??タス番å·ã«ãªã‚Šã¾ã™ã?
224 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€false:表示ã—ãªã?ã§ã™ã?
225 *
226 * @param showStatus スãƒ??タスã®å‡ºåŠ›å¯å¦[true/false]
227 */
228 public void setShowStatus( final String showStatus ) {
229 tag.add( "showStatus",StringUtil.nval( getRequestParameter( showStatus ),null ) );
230 }
231
232 /**
233 * ã€TAG】スãƒ??タスã®ç¨®é¡žæ•°??:会è°ã€?:æ¥å®¢ã€?:出張ã€?:外å?ã€?:休暇ã€?:他)をæŒ?®šã—ã¾ã?åˆæœŸå€¤:6)ã€?
234 *
235 * @og.tag
236 * スãƒ??タスã®ç¨®é¡žæ•°??:会è°ã€?:æ¥å®¢ã€?:出張ã€?:外å?ã€?:休暇ã€?:他)ã?ã€ç·¨é›??ãƒ??ã‚¢ãƒ??ã®ä½œæ?ã«ä½¿ã?¾ã™ã?
237 * 上記ã?å ´åˆã??–種類ã«ãªã‚‹ãŸã‚ã?countStatus="6" ã¨ã—ã¾ã™ã?
238 * å†?ƒ¨çš?«ã¯ã€status_0.png ãŒã‚りã¾ã™ã?
239 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?6" ã§ã™ã?
240 *
241 * @param countStatus スãƒ??タスã®ç¨®é¡žæ•°
242 */
243 public void setCountStatus( final String countStatus ) {
244 tag.add( "countStatus",StringUtil.nval( getRequestParameter( countStatus ),null ) );
245 }
246
247 /**
248 * ã€TAG】画é¢ç·¨é›?‚’許å¯ã™ã‚‹ã‹ã©ã?‹[true:å¯/false:ä¸å¯]を指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
249 *
250 * @og.tag
251 * true:ç”»é¢ç·¨é›?¯/false:ç”»é¢ç·¨é›?¸å¯ã‚’指定ã—ã¾ã™ã?
252 * ã“ã“ã§ã¯ã€mode=[Layout/Value] ã«é–¢ä¿‚ãªãã?false ã«ã™ã‚‹ã¨ç·¨é›?¸å¯ã«ãªã‚Šã¾ã™ã?
253 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€false:ç·¨é›?¸å¯ ã§ã™ã?
254 *
255 * @param writable ç”»é¢ç·¨é›?¯å¦[true/false]
256 */
257 public void setWritable( final String writable ) {
258 tag.add( "writable",StringUtil.nval( getRequestParameter( writable ),null ) );
259 }
260
261 /**
262 * ã€TAG】セル背景色ã®ç·¨é›?¯å¦[true:ç·¨é›?¯/false:ç·¨é›?¸å¯]を指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
263 *
264 * @og.tag
265 * セル背景色ã®ç·¨é›?¯å¦[true:ç·¨é›?¯/false:ç·¨é›?¸å¯]を指定ã—ã¾ã™ã?
266 * ã“れã¯ã€mode="Value" ã§ã€writable="true" ã®å ´åˆã?ã¿æœ‰åйã§ã™ã?
267 * false ã«ã™ã‚‹ã¨ã€COLOR属æ?ã®ç·¨é›?Œã§ããªããªã‚Šã¾ã™ã?
268 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€false:ç·¨é›?¸å¯ ã§ã™ã?
269 *
270 * @param editColor セル背景色ã®ç·¨é›?¯å¦[true/false]
271 */
272 public void setEditColor( final String editColor ) {
273 tag.add( "editColor",StringUtil.nval( getRequestParameter( editColor ),null ) );
274 }
275
276 /**
277 * ã€TAG】セルåç§°ã¨è¨å®šå?ã®é–“ã?区åˆ?‚Šæ–?—ã‚’æŒ?®šã—ã¾ã?åˆæœŸå€¤:":")ã€?
278 *
279 * @og.tag
280 * ç”»é¢ä¸Šã«ã¯ã€ã‚»ãƒ«åç§°(CELLNAME)ã¨è¨å®šå?(VALUE)ãŒè¡¨ç¤ºã•れã¾ã™ã?ãã?時ã?ã€åŒºåˆ?‚Šæ–?—ã‚’æŒ?®šã—ã¾ã™ã?
281 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?:" ã§ã™ã?
282 *
283 * @param separator 区åˆ?‚Šæ–??
284 */
285 public void setSeparator( final String separator ) {
286 tag.add( "separator",StringUtil.nval( getRequestParameter( separator ),null ) );
287 }
288
289 /**
290 * ã€TAG】セルã®è¨å®šå?(VALUE)を指定ã—ã¾ã?åˆæœŸå€¤:"")ã€?
291 *
292 * @og.tag
293 * セルã®è¨å®šå?(VALUE)を指定ã—ã¾ã™ã?
294 *
295 * @param paramVal セルã®è¨å®šå?
296 */
297 public void setParamVal( final String paramVal ) {
298 tag.add( "paramVal",StringUtil.nval( getRequestParameter( paramVal ),null ) );
299 }
300
301 /**
302 * ã€TAG】セルã®èƒŒæ™¯è‰²(COLOR)を指定ã—ã¾ã?åˆæœŸå€¤:"")ã€?
303 *
304 * @og.tag
305 * セルã®èƒŒæ™¯è‰²ã‚’指定ã—ã¾ã™ã?
306 *
307 * @param paramColor セルã®èƒŒæ™¯è‰²
308 */
309 public void setParamColor( final String paramColor ) {
310 tag.add( "paramColor",StringUtil.nval( getRequestParameter( paramColor ),null ) );
311 }
312
313 /**
314 * ã€TAG】編é›?¸å¯ã®ã‚»ãƒ«ã®èƒŒæ™¯è‰²ã‚’指定ã—ã¾ã?åˆæœŸå€¤:gray)ã€?
315 *
316 * @og.tag
317 * ç·¨é›?¸å¯ã®ã‚»ãƒ«ã®èƒŒæ™¯è‰²ã‚’指定ã—ã¾ã™ã?
318 * (adjustMatrix.jsã®)åˆæœŸå€¤ã¯ã€?gray" ã§ã™ã?
319 *
320 * @param notEditBgColor ç·¨é›?¸å¯ã®ã‚»ãƒ«ã®èƒŒæ™¯è‰²
321 */
322 public void setNotEditBgColor( final String notEditBgColor ) {
323 tag.add( "notEditBgColor",StringUtil.nval( getRequestParameter( notEditBgColor ),null ) );
324 }
325
326 /**
327 * ã‚¿ã‚°ã®åç§°ã‚’ã?è¿”ã—ã¾ã™ã?
328 * 自åˆ??身ã®ã‚¯ãƒ©ã‚¹åよりã?自動的ã«å–り出ã›ãªã?Ÿã‚ã?ã“ã?メソãƒ?ƒ‰ã‚’オーãƒã?ライドã—ã¾ã™ã?
329 *
330 * @return ã‚¿ã‚°ã®åç§°
331 */
332 @Override
333 protected String getTagName() {
334 return "iMatrix" ;
335 }
336
337 /**
338 * ã“ã?オブジェクトã?æ–?—å?表ç¾ã‚’è¿”ã—ã¾ã™ã?
339 * 基本çš?«ãƒ?ƒãƒ?‚°ç›®çš?«ä½¿ç”¨ã—ã¾ã™ã?
340 *
341 * @return ã“ã?ã‚¯ãƒ©ã‚¹ã®æ–?—å?表ç¾
342 */
343 @Override
344 public String toString() {
345 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
346 .println( "VERSION" ,VERSION )
347 .println( "tag" ,tag.makeTag() )
348 .println( "Other..." ,getAttributes().getAttribute() )
349 .fixForm().toString() ;
350 }
351 }