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 022 import org.opengion.hayabusa.resource.ResourceFactory; 023 import org.opengion.hayabusa.resource.ResourceManager; 024 025 /** 026 * DBLABEL レンãƒ?ƒ©ãƒ¼ã¯ã€å?をラベルリソースã®è¡¨ç¤ºãƒ©ãƒ™ãƒ«ã«å¤‰æ›ã™ã‚‹ã‚¯ãƒ©ã‚¹ã§ã™ã? 027 * 028 * DBMENU ã§åŒæ§˜ã?処ç?‚’記述ã§ãã¾ã™ãŒã€ãƒ©ãƒ™ãƒ«ãƒªã‚½ãƒ¼ã‚¹ ã«é™å®šã—ãŸä½¿ã?–¹ã‚? 029 * 想定ã—ã¦ã¾ã™ã? 030 * 031 * カラãƒ??表示ã«å¿?¦ãªå±žæ?ã¯, DBColumn オブジェクãƒ?よりå–り出ã—ã¾ã™ã? 032 * ã“ã?クラスã¯ã€DBColumn オブジェクト毎ã«?‘ã¤ä½œæ?ã•れã¾ã™ã? 033 * 034 * @og.rev 4.0.0.0 (2006/11/16) æ–°è¦ä½œæ? 035 * @og.group ãƒ??タ表示 036 * 037 * @version 4.0 038 * @author Kazuhiko Hasegawa 039 * @since JDK5.0, 040 */ 041 public class Renderer_DBLABEL extends AbstractRenderer { 042 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 043 private static final String VERSION = "4.0.0.0 (2006/11/16)" ; 044 045 private static final CellRenderer dbCell = new Renderer_DBLABEL() ; 046 047 private final ResourceManager resource ; 048 049 /** 050 * ãƒ?ƒ•ォルトコンストラクターã€? 051 * ã“ã?コンストラクターã§ã€åŸºæœ¬ã‚ªãƒ–ジェクトを作æ?ã—ã¾ã™ã? 052 * 053 */ 054 public Renderer_DBLABEL() { 055 resource = ResourceFactory.newInstance( "ja" ); // 日本語ã ã‘特別 056 } 057 058 /** 059 * ãƒ?ƒ•ォルトコンストラクターã€? 060 * 061 * @param clm DBColumnオブジェクãƒ? 062 */ 063 private Renderer_DBLABEL( final DBColumn clm ) { 064 String lang = clm.getLang(); 065 resource = ResourceFactory.newInstance( lang ); 066 } 067 068 /** 069 * å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã—ã¾ã™ã? 070 * 自åˆ??身をã‚ャãƒ?‚·ãƒ¥ã™ã‚‹ã®ã‹ã?æ–°ãŸã«ä½œæ?ã™ã‚‹ã®ã‹ã?ã€å„サブクラスã®å®Ÿè£?« 071 * ã¾ã‹ã•れã¾ã™ã? 072 * 073 * @param clm DBColumnオブジェクãƒ? 074 * 075 * @return CellRendererオブジェクãƒ? 076 */ 077 public CellRenderer newInstance( final DBColumn clm ) { 078 if( "ja".equalsIgnoreCase( clm.getLang() ) ) { 079 return dbCell ; 080 } 081 082 return new Renderer_DBLABEL( clm ); 083 } 084 085 /** 086 * ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨æ–?—å?ã‚’è¿”ã—ã¾ã™ã? 087 * 088 * @param value 入力å? 089 * 090 * @return ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨æ–?—å? 091 */ 092 @Override 093 public String getValue( final String value ) { 094 if( value == null || value.length() == 0 ) { return ""; } 095 096 return resource.getLabel( value ); 097 } 098 }