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.db;
017
018 import org.opengion.hayabusa.common.HybsSystem;
019 import org.opengion.fukurou.util.StringFormat;
020
021 /**
022 * 動的プルãƒ?‚¦ンなどで利用されるイベントカラãƒ??å�?¨®æƒ??を保持するための
023 * 管ç�?‚¯ラスですã?
024 *
025 * å†?®¹を置き換えるカラãƒ?子カラãƒ?の名前をキーに、イベントカラãƒ?親カラãƒ?ã‚??
026 * イベント発行時の処ç�?RL等を管ç�?�—ますã?
027 *
028 * これらã?æƒ??は、ColumnTagやSelectTag、ViewFormTagなどで登録され、その結果ã‚?
029 * JavaScriptのコードとして出力しますã?(common/eventColumn.jsp)
030 *
031 * ここで出力されたæƒ??をイベント発行時に、JavaScriptが参照しã?処ç�?RLに渡ã�?
032 * ことで、動çš?�ªé ?›®の入れ替えを実現してã�?�¾すã?
033 *
034 * @og.rev 5.1.7.0 (2010/06/01) 新規追åŠ?
035 *
036 * @version 4.0
037 * @author Hiroki Nakamura
038 * @since JDK5.0,
039 */
040 public class DBEventColumn {
041
042 private static final String EVENT_COLUMN_URL = HybsSystem.sys( "JSP" ) + "/" + HybsSystem.sys( "EVENT_COLUMN_URL" );
043
044 final String name; // å†?®¹を置き換えるカラãƒ?子カラãƒ?
045 final String evCol; // イベントカラãƒ?親カラãƒ??カンマ区åˆ?‚Š)
046 final String eventUrl; // イベント発行時の処ç�?RL
047 final String renderer; // 子カラãƒ??レンãƒ?ƒ©ー
048 final String editor; // 子カラãƒ??エãƒ?‚£ター
049 final String rendParam; // 子カラãƒ??表示パラメーター
050 final String editParam; // 子カラãƒ??編é›?ƒ‘ラメーター
051
052 /**
053 * 初期æƒ??を含んだ新規オブジェクトを作æ?しますã?
054 *
055 * @param name å†?®¹を置き換えるカラãƒ?子カラãƒ?
056 * @param evCol イベントカラãƒ?親カラãƒ??カンマ区åˆ?‚Š)
057 * @param eventUrl イベント発行時の処ç�?RL
058 * @param renderer 子カラãƒ??レンãƒ?ƒ©ー
059 * @param editor 子カラãƒ??エãƒ?‚£ター
060 * @param rendParam 子カラãƒ??表示パラメーター
061 * @param editParam 子カラãƒ??編é›?ƒ‘ラメーター
062 */
063 public DBEventColumn( final String name, final String evCol, final String eventUrl,
064 final String renderer, final String editor, final String rendParam, final String editParam ) {
065 this.name = name;
066 this.evCol = evCol;
067 // 5.1.9.0 (2010/08/01) 動的プルãƒ?‚¦ン不å?合対å¿?
068 this.eventUrl = ( eventUrl != null && eventUrl.length() > 0 ) ? eventUrl : EVENT_COLUMN_URL;
069 this.renderer = renderer;
070 this.editor = editor;
071 this.rendParam = rendParam;
072 this.editParam = editParam;
073 }
074
075 /**
076 * å†?®¹を置き換えるカラãƒ?子カラãƒ?を返しますã?
077 *
078 * @return å†?®¹を置き換えるカラãƒ?子カラãƒ?
079 */
080 public String getName() { return name; }
081
082 /**
083 * イベントカラãƒ?親カラãƒ??カンマ区åˆ?‚Š)を返しますã?
084 *
085 * @return イベントカラãƒ?親カラãƒ??カンマ区åˆ?‚Š)
086 */
087 public String getEventColumn() { return evCol; }
088
089 /**
090 * イベント発行時の処ç�?RLを返しますã?
091 *
092 * @og.rev 5.1.8.0 (2010/07/01) getEventUrl â‡?getEventURL に変更
093 *
094 * @return イベント発行時の処ç�?RL
095 */
096 // public String getEventUrl() { return eventUrl; }
097 public String getEventURL() { return eventUrl; }
098
099 /**
100 * 子カラãƒ??レンãƒ?ƒ©ーを返しますã?
101 *
102 * @return 子カラãƒ??レンãƒ?ƒ©ー
103 */
104 public String getRenderer() { return renderer; }
105
106 /**
107 * 子カラãƒ??エãƒ?‚£ターを返しますã?
108 *
109 * @return 子カラãƒ??エãƒ?‚£ター
110 */
111 public String getEditor() { return editor; }
112
113 /**
114 * 子カラãƒ??表示パラメーターを返しますã?
115 *
116 * @return 子カラãƒ??表示パラメーター
117 */
118 public String getRendParam() {
119 StringFormat sf = new StringFormat(
120 rendParam
121 ,"{@" + evCol.replace( ",", "}:{@" ) + "}"
122 ,name );
123 return sf.format();
124 }
125
126 /**
127 * 子カラãƒ??編é›?ƒ‘ラメーターを返しますã?
128 *
129 * @return 子カラãƒ??編é›?ƒ‘ラメーター
130 */
131 public String getEditParam() {
132 StringFormat sf = new StringFormat(
133 editParam
134 ,"{@" + evCol.replace( ",", "}:{@" ) + "}"
135 ,name );
136 return sf.format();
137 }
138 }