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.html;
017
018 /**
019 * 【å»?¢】タブ表示を行う場合ã?å�?‚¿ブに対応するデータを管ç�?�—ますã?
020 *
021 * タブ表示には、text , id , body のé ?›®を持ってã�?�¾すã?
022 * こã?タブ表示には、tabstrip.htc と multipage.htc の?’つの JavaScript がå¿?¦�ですã?
023 * text は、tabstrip の tab に表示するæ–?—å?を指定しますã?
024 * id は、multipage の pageview の id を指定しますã?
025 * body は、multipage の pageview の BODY 部に記述する タブã?å†?®¹ですã?
026 * タブとタブã?間には、tabseparator が挿入されますã?これは、タブ間の大きさを指定しますã?
027 * ä¸?•ªæœ?¾Œã? tabseparator は、タブã?配置方æ³?縦か横)に応じて変更されますã?
028 * horizontal の場合ã?、widt ã‚?100% に、vertical の場合ã?、height ã‚?100% に設定しますã?
029 * 設定方法ã?、tabseparator の defaultstyle 属æ?に style 属æ?の形å¼?width:100%)でæŒ?®šしますã?
030 *
031 * @og.rev 3.5.6.5 (2004/08/09) 新規作æ?
032 * @og.group 画面表示
033 *
034 * @version 4.0
035 * @author Kazuhiko Hasegawa
036 * @since JDK5.0,
037 */
038 public class TabData {
039 private final String text ;
040 private final String name ; // 3.5.6.6 (2004/08/23) id から name へ変更
041 private final String body ;
042 private final String style ; // 3.8.6.1 (2006/10/24)
043 private final boolean openFlag ;
044
045 /**
046 * コンストラクター
047 *
048 * @og.rev 3.8.6.1 (2006/10/20) action属æ?を追åŠ?
049 *
050 * @param text タブã?ãƒ?‚スãƒ?
051 * @param name multipage の pageview の id を指定しますã?
052 * @param body multipage の pageview の BODY 部に記述するタブã?å†?®¹を指定しますã?
053 * @param openFlag タブが選択されてã�?‚‹かどã�?�‹
054 * @param style タブにæŒ?®šするスタイルシート属æ?を設定しますã?
055 */
056 public TabData( final String text,final String name,final String body,
057 final boolean openFlag,final String style ) {
058 this.text = text;
059 this.name = name;
060 this.body = body;
061 this.openFlag = openFlag;
062 this.style = style;
063 }
064
065 /**
066 * tab のタグを作æ?して返しますã?
067 *
068 * 引数の style がã?null でなければ、defaultStyle と selectedStyle に設定しますã?
069 * またã?タブ単独に直接æŒ?®šされてã�?‚‹場合ã?、そちらが優先されますã?
070 *
071 * @param inStyle 外部よりæŒ?®šされるスタイル
072 *
073 * @return tabのタグ
074 */
075 public String getTab( final String inStyle ) {
076 return "<ts:tab " + getStyleString( style,inStyle ) + " text=\"" + text + "\" />" ;
077 }
078
079 /**
080 * pageview のタグを作æ?して返しますã?
081 * タブã?å†?®¹を表示するタグを作æ?しますã?
082 *
083 * @return pageviewのタグ
084 *
085 */
086 public String getTabBody() {
087 return "<mp:pageview id=\"" + name + "\">" + body + "</mp:pageview>" ;
088 }
089
090 /**
091 * タブが選択されてã�?‚‹かどã�?�‹(true:選æŠ?false:通常)を取得しますã?
092 *
093 * タブが選択されるかどã�?�‹は、tabTag の term,termList がæ?立するかã€?
094 * tabTableTag で、selectedIndex æŒ?®šされるかですã?
095 *
096 * @og.rev 3.8.6.1 (2006/10/24) 新規追åŠ?
097 *
098 * @return タブが選択されてã�?‚‹かどã�?�‹(true:選æŠ?false:通常)
099 */
100 public boolean isOpen() {
101 return openFlag ;
102 }
103
104 /**
105 * defaultStyle と selectedStyle を指定しã�?style属æ?を作æ?しますã?
106 *
107 * style属æ? は、このタブ構築時にæŒ?®šされたスタイル(defStyle)が優先されますã?
108 * これã�?null の場合ã?、外部よりæŒ?®šされるスタイル(inStyle)を適用しますã?
109 * それã‚?null の場合ã?、ゼロæ–?—å?を返しますã?
110 *
111 * @param defStyle こã?タブ構築時にæŒ?®šされたスタイル(優å…?
112 * @param inStyle 外部よりæŒ?®šされるスタイル
113 *
114 * @return styleのタグ
115 */
116 private String getStyleString( final String defStyle, final String inStyle ) {
117 String tmp = ( defStyle != null ) ? defStyle : inStyle ;
118
119 String rtn = "";
120 if( tmp != null ) {
121 rtn = "defaultStyle=\"" + tmp + "\" selectedStyle=\"" + tmp + "\"";
122 }
123
124 return rtn ;
125 }
126 }