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 */
016package org.opengion.hayabusa.taglib;
017
018import org.opengion.fukurou.util.TagBuffer;
019import org.opengion.fukurou.util.ToString;                                              // 6.1.1.0 (2015/01/17)
020
021import static org.opengion.fukurou.util.StringUtil.nval ;               // 6.1.0.0 (2014/12/26)
022
023/**
024 * 積上ガント(内部積上方式)でガント全体(ページ全体一つ設定)の指定を行います。
025 *
026 * iTask タグは、積上ガントのうち、内部積上方式の場合に使用します。
027 * 内部積上げとは、フレームワーク側で積上げ計算を行う方式の事です。
028 * 処理速度は増しますが、積上ガント(JavaScript版)は、積上と通常ガントの混在が
029 * 可能ですが、こちらは、積上のみの表示になります。
030 * それぞれの使い分けを考慮してください。
031 * このタグは、viewFormType = "HTMLStackedGanttTable" 、innerStack="true" を指定した view の後に記述します。
032 *
033 * @og.formSample
034 * ●形式:<og:iTask  ... />
035 * ●body:なし
036 * ●前提:headタグで、adjustEvent="Task" を指定してください。
037 *
038 * ●Tag定義:
039 *   <og:iTask
040 *       fixedCols        ○【TAG】左右2分割で、固定したいカラム数(必須)
041 *       debug              【TAG】デバッグ情報を出力するかどうか[true/false]を指定します(初期値:false)
042 *   />
043 *
044 * ●使用例
045 *   <og:view
046 *       viewFormType = "HTMLStackedGanttTable"
047 *       command      = "{@command}"
048 *       writable     = "false"
049 *       useScrollBar = "false"
050 *       useParam     = "true"
051 *       numberType   = "none"
052 *   >
053 *     <!-- stackParamでstackColumnsを指定しなかった場合はcustomTableとほぼ同じ処理となる -->
054 *     <og:stackParam
055 *         stackColumns = "NOORDER"
056 *         innerStack   = "true"
057 *         costColumns  = "COSTCLM,DYJYU,DYNOKI"
058 *         stackHoliday = "{@stackHoliday}"
059 *         capacityColumn = "CAPACITY"
060 *     />
061 *     <og:thead rowspan="2">
062 *       <tr>
063 *           <td>[NOORDER]</td>
064 *           <td rowspan="2" class="gantt zoom{@SZOOM}" style="text-align:left;background-image: url('../image/stackBG{@SZOOM}.gif');" >
065 *               <div style="position:relative;left:0px;z-index:101; " height="100%" width="100%" >
066 *                   <og:stackHeader
067 *                       startDate   = "{@MIN_DATE}"
068 *                       endDate     = "{@MAX_DATE}"
069 *                       zoom        = "{@SZOOM}"
070 *                       calDB       = "GE13"
071 *                       arg1        = "A"
072 *                   />
073 *               </div>
074 *           </td>
075 *       </tr>
076 *     </og:thead>
077 *     <og:tbody rowspan="2">
078 *       <tr>
079 *         <td>[NOORDER]</td>
080 *       </tr>
081 *     </og:tbody>
082 *   </og:view>
083 *
084 *   <og:iTask
085 *       fixedCols  = "4"
086 *   />
087 *  
088 *   @og.rev 5.6.3.2 (2013/04/12) 新規作成
089 * @og.group 画面部品
090 *
091 * @version  5.0
092 * @author       Kazuhiko Hasegawa
093 * @since    JDK6.0,
094 */
095public class ViewITaskTag extends CommonTagSupport {
096        /** このプログラムのVERSION文字列を設定します。   {@value} */
097        private static final String VERSION = "6.4.2.0 (2016/01/29)" ;
098        private static final long serialVersionUID = 642020160129L ;
099
100        private transient TagBuffer tag = new TagBuffer( "iTask" ).addBody( "<!-- -->" );               // 6.1.1.0 (2015/01/17) TagBufferの連結記述
101
102        /**
103         * デフォルトコンストラクター
104         *
105         * @og.rev 6.4.2.0 (2016/01/29) PMD refactoring. Each class should declare at least one constructor.
106         */
107        public ViewITaskTag() { super(); }              // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。
108
109        /**
110         * Taglibの終了タグが見つかったときに処理する doEndTag() を オーバーライドします。
111         *
112         * @og.rev 6.0.2.5 (2014/10/31) HTML5対応。javaScriptで、BODYがないと入れ子になってしまう。
113         *
114         * @return      後続処理の指示
115         */
116        @Override
117        public int doEndTag() {
118                debugPrint();           // 4.0.0 (2005/02/28)
119
120                // 6.1.1.0 (2015/01/17) TagBufferの連結記述
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( "iTask" ).addBody( "<!-- -->" );           // 6.1.1.0 (2015/01/17) TagBufferの連結記述
135        }
136
137        /**
138         * 【TAG】左右2分割で、固定したいカラム数を指定します。
139         *
140         * @og.tag
141         * 1段組でも2段組でも、固定したいカラム数を指定します。
142         *
143         * @param   fixedCols 固定したいカラム数
144         */
145        public void setFixedCols( final String fixedCols ) {
146                tag.add( "fixedCols",nval( getRequestParameter( fixedCols ),null ) );
147        }
148
149        /**
150         * タグの名称を、返します。
151         * 自分自身のクラス名より、自動的に取り出せないため、このメソッドをオーバーライドします。
152         *
153         * @return  タグの名称
154         * @og.rtnNotNull
155         */
156        @Override
157        protected String getTagName() {
158                return "iTask" ;
159        }
160
161        /**
162         * このオブジェクトの文字列表現を返します。
163         * 基本的にデバッグ目的に使用します。
164         *
165         * @return このクラスの文字列表現
166         * @og.rtnNotNull
167         */
168        @Override
169        public String toString() {
170                return ToString.title( this.getClass().getName() )
171                                .println( "VERSION"             ,VERSION        )
172                                .println( "tag"                 ,tag.makeTag()  )
173                                .println( "Other..."    ,getAttributes().getAttribute() )
174                                .fixForm().toString() ;
175        }
176}