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