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    }