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