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.plugin.column;
017
018import org.opengion.hayabusa.db.CellEditor;
019import org.opengion.hayabusa.db.DBColumn;
020import org.opengion.fukurou.util.StringUtil;
021
022/**
023 * HTMLAREA エディターは、カラムのデータをテキストエリアで編集し、
024 * HTML文字をエスケープして登録する場合に使用するクラスです。
025 *
026 * エスケープする以外はTEXTAREAと同様です
027 *
028 * @og.rev 5.5.8.0 (2012/11/01) 新規作成
029 * @og.rev 6.4.4.2 (2016/04/01) Editor_TEXTAREA を継承するように変更。
030 * @og.group データ編集
031 *
032 * @version  5.0
033 * @author   Takahashi Masakazu
034 * @since    JDK5.0,
035 */
036public class Editor_HTMLAREA extends Editor_TEXTAREA {
037        /** このプログラムのVERSION文字列を設定します。   {@value} */
038        private static final String VERSION = "6.4.4.2 (2016/04/01)" ;
039
040        // 6.4.4.2 (2016/04/01) Editor_TEXTAREA を継承するように変更。
041
042        /**
043         * デフォルトコンストラクター。
044         * このコンストラクターで、基本オブジェクトを作成します。
045         *
046         */
047        public Editor_HTMLAREA() { super(); }           // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。
048
049        /**
050         * コンストラクター。
051         *
052         * @og.rev 6.4.4.2 (2016/04/01) Editor_TEXTAREA を継承するように変更。
053         *
054         * @param       clm     DBColumnオブジェクト
055         */
056        private Editor_HTMLAREA( final DBColumn clm ) {
057                super( clm );
058        }
059
060        /**
061         * 各オブジェクトから自分のインスタンスを返します。
062         * 自分自身をキャッシュするのか、新たに作成するのかは、各サブクラスの実装に
063         * まかされます。
064         *
065         * @param       clm     DBColumnオブジェクト
066         *
067         * @return      CellEditorオブジェクト
068         * @og.rtnNotNull
069         */
070        @Override
071        public CellEditor newInstance( final DBColumn clm ) {
072                return new Editor_HTMLAREA( clm );
073        }
074
075        /**
076         * データの編集用文字列を返します。
077         *
078         * @og.rev 6.4.4.2 (2016/04/01) Editor_TEXTAREA を継承するように変更。
079         *
080         * @param   value 入力値
081         *
082         * @return  データの編集用文字列
083         * @og.rtnNotNull
084         */
085        @Override
086        public String getValue( final String value ) {
087                return super.getValue( StringUtil.htmlFilter(value) );
088
089        }
090
091        /**
092         * name属性を変えた、データ表示/編集用のHTML文字列を作成します。
093         * テーブル上の name に 行番号を付加して、名前_行番号 で登録するキーを作成し,
094         * リクエスト情報を1つ毎のフィールドで処理できます。
095         *
096         * @og.rev 3.1.0.0 (2003/03/20) 名前と行番号の区切り記号を "^" から "__" に変更。
097         * @og.rev 3.5.5.0 (2004/03/12) 名前と行番号の区切り記号("__")を、HybsSystem.JOINT_STRING  に変更。
098         * @og.rev 4.3.7.2 (2009/06/15) 属性でidが出力される場合は、idを出力しない
099         * @og.rev 5.1.2.0 (2010/01/01) 先頭の'_'による書き込み制御を行わない。(他のクラスとの実装の共通化)
100         * @og.rev 5.1.7.0 (2010/06/01) 動的プルダウン実装見直し
101         * @og.rev 6.4.4.2 (2016/04/01) Editor_TEXTAREA を継承するように変更。
102         *
103         * @param   row   行番号
104         * @param   value 入力値
105         *
106         * @return  データ表示/編集用の文字列
107         * @og.rtnNotNull
108         */
109        @Override
110        public String getValue( final int row,final String value ) {
111                return super.getValue( row , StringUtil.htmlFilter(value) );
112
113        }
114}