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.plugin.column;
017    
018    import org.opengion.hayabusa.db.AbstractRenderer;
019    import org.opengion.hayabusa.db.CellRenderer;
020    import org.opengion.hayabusa.db.DBColumn;
021    import org.opengion.hayabusa.db.Selection;
022    import org.opengion.hayabusa.db.Selection_RADIO;
023    
024    /**
025     * RADIO レン?ーは、カラ????タをコードリソースに対応したラジオボタンの
026     * 代替えラベルで表示する場合に使用するクラスです?
027     *
028     *  カラ??表示に?な属?は, DBColumn オブジェク?より取り出します?
029     * こ?クラスは、DBColumn オブジェクト毎に?つ作?されます?
030     *
031     * @og.rev 3.5.1.0 (2003/10/03) 新規作?
032     * @og.group ??タ表示
033     *
034     * @version  4.0
035     * @author   Kazuhiko Hasegawa
036     * @since    JDK5.0,
037     */
038    public class Renderer_RADIO extends AbstractRenderer {
039            //* こ?プログラ??VERSION??を設定します?       {@value} */
040            private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
041    
042            private final Selection selection  ;
043    
044            /**
045             * ?ォルトコンストラクター?
046             * こ?コンストラクターで、基本オブジェクトを作?します?
047             *
048             */
049            public Renderer_RADIO() {
050                    selection  = null;
051            }
052    
053            /**
054             * ?ォルトコンストラクター?
055             *
056             * @og.rev 3.5.4.2 (2003/12/15) makeCodeSelection メソ??CodeSelectionクラスに変更?
057             * @og.rev 3.5.5.7 (2004/05/10) SelectionFactory を使用して、オブジェクト作?
058             * @og.rev 4.0.0.0 (2005/01/31) SelectionFactory ではなく?直接 Selection_RADIO を作??
059             *
060             * @param       clm     DBColumnオブジェク?
061             */
062            private Renderer_RADIO( final DBColumn clm ) {
063                    selection = new Selection_RADIO( clm.getCodeData() );   // 4.0.0 (2005/01/31)
064            }
065    
066            /**
067             * ?ブジェクトから???インスタンスを返します?
068             * 自??身をキャ?ュするのか?新たに作?するのか?、各サブクラスの実?
069             * まかされます?
070             *
071             * @param       clm     DBColumnオブジェク?
072             *
073             * @return      CellRendererオブジェク?
074             */
075            public CellRenderer newInstance( final DBColumn clm ) {
076                    return new Renderer_RADIO( clm );
077            }
078    
079            /**
080             * ??タの表示用??を返します?
081             *
082             * @param   value 入力?
083             *
084             * @return  ??タの表示用??
085             */
086            @Override
087            public String getValue( final String value ) {
088                    return "<pre class=\"RADIO\">" +
089                                    selection.getRadioLabel( value ) +
090                                    "</pre>" ;
091            }
092    }