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.fukurou.util.StringUtil;
019import org.opengion.hayabusa.db.AbstractRenderer;
020import org.opengion.hayabusa.db.CellRenderer;
021import org.opengion.hayabusa.db.DBColumn;
022
023/**
024 * NOTAG レンデラーは、LABEL レンデラーの値からタグ情報のみ削除するレンデラーです。
025 * ファイル出力対象で、データそのものにタグ情報を埋め込んでいる場合は、このレンデラーが使えます。
026 * 処理は、<xxxx ・・・>YYYY</xxxx>形式の場合、YYYY のみ出力します。
027 * <xxxx/> の様な、BODY要素を持たない場合は、ゼロ文字列になります。
028 * 
029 * Ver6からの逆移植です。
030 *
031 * このクラスは、不変オブジェクトとして、共有されます。
032 *
033 * @og.group データ表示
034 * 
035 * @og.rev 5.10.4.1 (2018/10/12) 新規追加
036 *
037 * @version  5.0
038 * @author   Kazuhiko Hasegawa
039 * @since    JDK5.0,
040 */
041public class Renderer_NOTAG extends AbstractRenderer {
042        /** このプログラムのVERSION文字列を設定します。   {@value} */
043        private static final String VERSION = "5.10.4.1 (2018/10/12)" ;
044
045        private static final CellRenderer DB_CELL = new Renderer_NOTAG() ;
046
047        /**
048         * デフォルトコンストラクター
049         *
050         */
051        public Renderer_NOTAG() { super(); }            // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。
052
053        /**
054         * 各オブジェクトから自分のインスタンスを返します。
055         * 自分自身をキャッシュするのか、新たに作成するのかは、各サブクラスの実装に
056         * まかされます。
057         *
058         * 
059         * @param       clm     DBColumnオブジェクト
060         *
061         * @return      CellRendererオブジェクト
062         * @og.rtnNotNull
063         */
064        public CellRenderer newInstance( final DBColumn clm ) {
065                return DB_CELL;
066        }
067
068        /**
069         * データ出力用の文字列を作成します。
070         * ファイル等に出力する形式を想定しますので、HTMLタグを含まない
071         * データを返します。
072         * 基本は、#getValue( String ) をそのまま返します。
073         *
074         *
075         * @param   value 入力値
076         *
077         * @return  データ出力用の文字列
078         * @og.rtnNotNull
079         * @see         #getValue( String )
080         */
081        @Override
082        public String getValue( final String value ) {
083                return StringUtil.tagCut( ( value == null ) ? "" : value );
084        }
085}