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.HybsSystemException;
019    import org.opengion.hayabusa.html.TableFormatter;
020    
021    /**
022     * ガントチャー?タスク配置?用の繰り返しタグのフォーマットに使用します?
023     *
024     * itd タグは、ガント??ー部の TDタグの繰返しに使用されます?
025     * こ?繰返しは、ganttParam タグの minDuration で?された間隔で行われます?
026     * (例えば?.5 を指定すれ?、半日単位で処?れます?)
027     * itd タグの colspan 属?を指定した?合?、itd 自身が?td タグに colspan ?
028     * 追?ると共に、繰返し自身を?そ??数?に抑制します?
029     * 具体的には、colspan="2" とすると?回に?しか、itd タグが呼び出されな?
030     * なります?
031     *
032     * @og.formSample
033     * ●形式?lt;og:itd> ... Body ... </og:itd>
034     * ●body?あ?EVAL_BODY_BUFFERED:BODYを評価し?{@XXXX} を解析しま?
035     *
036     * ●Tag定義??
037     *   <og:itd
038     *       debug              【TAG】デバッグ??を?力するかど?[true/false]を指定しま?初期値:false)
039     *   >   ... Body ...
040     *   </og:itd>
041     *
042     * ●使用?
043     *    <og:thead rowspan="1">
044     *      <tr>
045     *        <og:itd>M/d</og:itd>
046     *      </tr>
047     *    </og:thead>
048     *    <og:tbody rowspan="1" >
049     *      <tr>
050     *        <og:itd>
051     *          <span class="cGntBar[!FGTASK]"
052     *                title="[NMMCN]
[NMKT]"
053     *                val1 ="[GVZOOM]"
054     *                val2 ="[CDJGS]"
055     *                val3 ="[WC]"
056     *                val4 ="[NOMCN]"
057     *                val5 ="[CDKT]"
058     *                val6 ="[FGTASK]"
059     *                val7 ="[DYSTART]"
060     *                val8 ="[DYDELAY]"
061     *                val9 ="[DURATION]" > </span>
062     *        </og:itd>
063     *      </tr>
064     *    </og:tbody>
065     *
066     * @og.rev 3.5.4.8 (2004/02/23) 新規作?
067     * @og.group 画面部?
068     *
069     * @version  4.0
070     * @author       Kazuhiko Hasegawa
071     * @since    JDK5.0,
072     */
073    public class ItdTag extends CommonTagSupport {
074            //* こ?プログラ??VERSION??を設定します?       {@value} */
075            private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
076    
077            private static final long serialVersionUID = 400020050831L ;
078    
079            private String itdBody = null;
080    
081            /**
082             * Taglibの開始タグが見つかったときに処??doStartTag() ?オーバ?ライドします?
083             *
084             * @return      後続????( EVAL_BODY_BUFFERED )
085             */
086            @Override
087            public int doStartTag() {
088                    return( EVAL_BODY_BUFFERED );   // Body を評価する? extends BodyTagSupport ?
089            }
090    
091            /**
092             * Taglibのタグ本体を処??doAfterBody() ?オーバ?ライドします?
093             *
094             * @return      後続????(SKIP_BODY)
095             */
096            @Override
097            public int doAfterBody() {
098                    itdBody = getBodyString();
099    
100                    return(SKIP_BODY);                              // Body を評価しな?
101            }
102    
103            /**
104             * Taglibの終?グが見つかったときに処??doEndTag() ?オーバ?ライドします?
105             *
106             * @return      後続????
107             */
108            @Override
109            public int doEndTag() {
110                    debugPrint();           // 4.0.0 (2005/02/28)
111                    TFormatTag tFormat = (TFormatTag)findAncestorWithClass( this, TFormatTag.class );
112                    if( tFormat != null ) {
113                            tFormat.setItdBody( itdBody );
114                            jspPrint( TableFormatter.HYBS_ITD_MARKER );
115                    }
116                    else {
117                            String errMsg = "<b>こ?タグは、TheadTag か?TBodyTagの??(要?に記述してください?/b>";
118                            throw new HybsSystemException( errMsg );
119                    }
120    
121                    return(EVAL_PAGE);              // ペ?ジの残りを評価する?
122            }
123    
124            /**
125             * タグリブオブジェクトをリリースします?
126             * キャ?ュされて再利用される?で、フィールド?初期設定を行います?
127             *
128             */
129            @Override
130            protected void release2() {
131                    super.release2();
132                    itdBody = null;
133            }
134    
135            /**
136             * こ?オブジェクト???表現を返します?
137             * 基本???目?使用します?
138             *
139             * @return こ?クラスの??表現
140             */
141            @Override
142            public String toString() {
143                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
144                                    .println( "VERSION"             ,VERSION        )
145                                    .println( "itdBody"             ,itdBody        )
146                                    .println( "Other..."    ,getAttributes().getAttribute() )
147                                    .fixForm().toString() ;
148            }
149    }