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 = "5.7.3.0 (2014/02/07)" ;
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    }