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.hayabusa.common.HybsSystemException;
019import org.opengion.fukurou.util.StringUtil;
020import org.opengion.fukurou.util.TagBuffer;
021
022/**
023 * JavaScriptを利用してクライアント側でテーブルの左右分割します。
024 *
025 * iTable タグは、ガント全体の左右2分割表示したいカラム数を、fixedCols 属性に指定します。
026 * 通常の view タグの後に記述します。
027 *
028 * @og.formSample
029 * ●形式:<og:iTable  ... />
030 * ●body:なし
031 * ●前提:headタグで、adjustEvent="Table" を指定してください。
032 *
033 * ●Tag定義:
034 *   <og:iTable
035 *       fixedCols          【TAG】左右2分割で、固定したいカラム数(必須)
036 *       debug              【TAG】デバッグ情報を出力するかどうか[true/false]を指定します(初期値:false)
037 *   />
038 *
039 * ●使用例
040 *  <og:view
041 *      viewFormType = "HTMLTable"
042 *      command      = "{@command}"
043 *  />
044
045 *   <og:iTable
046 *       fixedCols  = "5"
047 *   />
048 *
049 * @og.rev 5.6.3.2 (2013/04/12) 新規作成
050 * @og.group 画面部品
051 *
052 * @version  5.0
053 * @author       Kazuhiko Hasegawa
054 * @since    JDK6.0,
055 */
056public class ViewITableTag extends CommonTagSupport {
057        //* このプログラムのVERSION文字列を設定します。   {@value} */
058        private static final String VERSION = "5.6.3.2 (2013/04/12)" ;
059
060        private static final long serialVersionUID = 563220130412L ;
061
062        private TagBuffer tag = new TagBuffer( "iTable" ) ;
063
064        /**
065         * Taglibの終了タグが見つかったときに処理する doEndTag() を オーバーライドします。
066         *
067         * @og.rev 5.8.1.0 (2014/11/07) HTML5対応。javaScriptで、BODYがないと入れ子になってしまう。
068         * @return      後続処理の指示
069         */
070        @Override
071        public int doEndTag() {
072                debugPrint();           // 4.0.0 (2005/02/28)
073
074                tag.setBody( "<!-- -->" );                // 5.8.1.0 (2014/11/07) HTML5対応。
075                jspPrint( tag.makeTag() );
076
077                return(EVAL_PAGE);              // ページの残りを評価する。
078        }
079
080        /**
081         * タグリブオブジェクトをリリースします。
082         * キャッシュされて再利用されるので、フィールドの初期設定を行います。
083         *
084         */
085        @Override
086        protected void release2() {
087                super.release2();
088                tag = new TagBuffer( "iTable" );
089        }
090
091        /**
092         * 【TAG】左右2分割で、固定したいカラム数を指定します(必須)。
093         *
094         * @og.tag
095         * 1段組でも2段組でも、固定したいカラム数を指定します。
096         *
097         * @param   fixedCols 固定したいカラム数
098         */
099        public void setFixedCols( final String fixedCols ) {
100                tag.add( "fixedCols",StringUtil.nval( getRequestParameter( fixedCols ),null ) );
101        }
102
103        /**
104         * タグの名称を、返します。
105         * 自分自身のクラス名より、自動的に取り出せないため、このメソッドをオーバーライドします。
106         *
107         * @return  タグの名称
108         */
109        @Override
110        protected String getTagName() {
111                return "iTable" ;
112        }
113
114        /**
115         * このオブジェクトの文字列表現を返します。
116         * 基本的にデバッグ目的に使用します。
117         *
118         * @return このクラスの文字列表現
119         */
120        @Override
121        public String toString() {
122                return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
123                                .println( "VERSION"             ,VERSION        )
124                                .println( "tag"                 ,tag.makeTag()  )
125                                .println( "Other..."    ,getAttributes().getAttribute() )
126                                .fixForm().toString() ;
127        }
128}