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