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.html;
017
018import org.opengion.hayabusa.common.HybsSystem;
019
020/**
021 * VViewForm オブジェクトを取得する為に使用する,ファクトリクラスです。
022 *
023 *  ViewForm オブジェクト の識別ID を元に、ViewFormFactory.newInstance( String id )
024 * メソッドで,ViewForm オブジェクトを取得します。
025 * ViewFormFactory.close( ViewForm viewForm ) メソッドで,内部的に ViewFormFactory に
026 * オブジェクトを戻す事によって,ViewForm オブジェクトのプーリングを行なっています。
027 *
028 * 実装とマッピングの関係から,識別ID は、ViewFormFactory で static 定義します
029 * 大前提として、ユーザー共通で使用することを考えており,ユーザー個別にプール
030 * する必要があるならば, HttpSession オブジェクトに登録すべきです。
031 *
032 * @og.group 画面表示
033 *
034 * @version  4.0
035 * @author   Kazuhiko Hasegawa
036 * @since    JDK5.0,
037 */
038public final class ViewFormFactory {
039        /** newInstance() 時のデフォルトクラス {@value} */
040        public static final String DEFAULT  = "HTMLTable" ;
041
042        /**
043         *  デフォルトコンストラクターをprivateにして、
044         *  オブジェクトの生成をさせないようにする。
045         *
046         */
047        private ViewFormFactory() {
048        }
049
050        /**
051         * ViewForm オブジェクトを取得します。
052         * 遅い初期化を行なう事により,実際に必要となるまで ViewForm オブジェクトは
053         * 作成しません。
054         *
055         * @og.rev 3.5.4.2 (2003/12/15) ViewForm のサブクラス名変更。
056         * @og.rev 3.5.6.0 (2004/06/18) 各種プラグイン関連付け設定を、システムパラメータ に記述します。
057         * @og.rev 3.5.6.2 (2004/07/05) setID メソッド名がまぎらわしい為、変更します。
058         * @og.rev 4.0.0.0 (2005/01/31) キーの指定を、ViewForm. から、ViewForm_ に変更します。
059         * @og.rev 6.0.4.0 (2014/11/28) NullPointerException が発生するので、事前にチェックします。
060         * @og.rev 6.4.3.3 (2016/03/04) HybsSystem.newInstance(String,String) への置き換え。
061         *
062         * @param   id 接続先ID
063         *
064         * @return  ViewFormオブジェクト
065         */
066        public static ViewForm newInstance( final String id ) {
067                final String type = ( id == null ) ? DEFAULT : id ;
068
069                final ViewForm vf = HybsSystem.newInstance( "ViewForm_" , type );       // 3.5.5.3 (2004/04/09)
070
071                vf.setId( type );       // 3.5.6.2 (2004/07/05)
072
073                return vf;
074        }
075}