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.db; 017 018import org.opengion.hayabusa.common.HybsSystem; 019import org.opengion.fukurou.util.StringFormat; 020 021/** 022 * 動的プルダウンなどで利用されるイベントカラムの各種情報を保持するための 023 * 管理クラスです。 024 * 025 * 内容を置き換えるカラム(子カラム)の名前をキーに、イベントカラム(親カラム)や、 026 * イベント発行時の処理URL等を管理します。 027 * 028 * これらの情報は、ColumnTagやSelectTag、ViewFormTagなどで登録され、その結果を 029 * JavaScriptのコードとして出力します。(common/eventColumn.jsp) 030 * 031 * ここで出力された情報をイベント発行時に、JavaScriptが参照し、処理URLに渡す 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 */ 040public 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; // イベント発行時の処理URL 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 イベント発行時の処理URL 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 * イベント発行時の処理URLを返します。 091 * 092 * @og.rev 5.1.8.0 (2010/07/01) getEventUrl ⇒ getEventURL に変更 093 * 094 * @return イベント発行時の処理URL 095 */ 096 public String getEventURL() { return eventUrl; } 097 098 /** 099 * 子カラムのレンデラーを返します。 100 * 101 * @return 子カラムのレンデラー 102 */ 103 public String getRenderer() { return renderer; } 104 105 /** 106 * 子カラムのエディターを返します。 107 * 108 * @return 子カラムのエディター 109 */ 110 public String getEditor() { return editor; } 111 112 /** 113 * 子カラムの表示パラメーターを返します。 114 * 115 * @return 子カラムの表示パラメーター 116 */ 117 public String getRendParam() { 118 StringFormat sf = new StringFormat( 119 rendParam 120 ,"{@" + evCol.replace( ",", "}:{@" ) + "}" 121 ,name ); 122 return sf.format(); 123 } 124 125 /** 126 * 子カラムの編集パラメーターを返します。 127 * 128 * @return 子カラムの編集パラメーター 129 */ 130 public String getEditParam() { 131 StringFormat sf = new StringFormat( 132 editParam 133 ,"{@" + evCol.replace( ",", "}:{@" ) + "}" 134 ,name ); 135 return sf.format(); 136 } 137}