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.fukurou.util.StringFormat; 022 023 /** 024 * FORM レンãƒ?ƒ©ãƒ¼ã¯ã€è¡¨ç¤ºãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã§æŒ?®šã•れ㟠FORM を表示ã™ã‚‹ã‚¯ãƒ©ã‚¹ã§ã€? 025 * å…??Value ã‚’ã?$1 ã¨ã—ã¦ã€ä½¿ç”¨å¯èƒ½ã§ã™ã? 026 * (コãƒãƒ³ã§åŒºåˆ?‚‰ã‚ŒãŸå€¤ã®è¡¨ç¤ºã®ã‚³ãƒ³ãƒˆãƒãƒ¼ãƒ«ã‚’行ã†ãƒ¬ãƒ³ãƒ?ƒ©ãƒ¼ã§ã? 027 * 028 * カラãƒ??表示ã«å¿?¦ãªå±žæ?ã¯, DBColumn オブジェクãƒ?よりå–り出ã—ã¾ã™ã? 029 * ã“ã?クラスã¯ã€DBColumn オブジェクト毎ã«?‘ã¤ä½œæ?ã•れã¾ã™ã? 030 * 031 * @og.rev 2.1.1.1 (2002/11/15) FORM レンãƒ?ƒ©ãƒ¼ã‚’æ–°è¦è¿½åŠ?—ã¾ã—ãŸã€? 032 * @og.rev 5.4.2.6 (2012/01/19) ã‚³ãƒ¡ãƒ³ãƒˆä¿®æ£ 033 * @og.group ãƒ??タ表示 034 * 035 * @version 4.0 036 * @author Kazuhiko Hasegawa 037 * @since JDK5.0, 038 */ 039 public class Renderer_FORM extends AbstractRenderer { 040 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 041 private static final String VERSION = "5.4.2.6 (2012/01/19)" ; 042 043 private final String form ; 044 private final String name ; 045 046 /** 047 * ãƒ?ƒ•ォルトコンストラクターã€? 048 * ã“ã?コンストラクターã§ã€åŸºæœ¬ã‚ªãƒ–ジェクトを作æ?ã—ã¾ã™ã? 049 * 050 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ?? 051 * 052 */ 053 public Renderer_FORM() { 054 form = null; 055 name = null; // 4.3.4.0 (2008/12/01) 056 } 057 058 /** 059 * ãƒ?ƒ•ォルトコンストラクターã€? 060 * 061 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ?? 062 * @og.rev 3.4.0.0 (2003/09/01) 表示パラメータã€ç·¨é›?ƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã€æ–‡å—パラメータã®è¿½åŠ?? 063 * @og.rev 3.8.8.2 (2007/01/26) StringFormat ã® $0 対応ã? 064 * 065 * @param clm DBColumnオブジェクãƒ? 066 */ 067 private Renderer_FORM( final DBColumn clm ) { 068 String tmp = clm.getRendererParam(); 069 if( tmp == null || tmp.length() == 0 ) { tmp = "$0"; } // 3.8.8.2 (2007/01/26) 070 form = tmp ; 071 name = clm.getName(); // 4.3.4.0 (2008/12/01) 072 } 073 074 /** 075 * å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã—ã¾ã™ã? 076 * 自åˆ??身をã‚ャãƒ?‚·ãƒ¥ã™ã‚‹ã®ã‹ã?æ–°ãŸã«ä½œæ?ã™ã‚‹ã®ã‹ã?ã€å„サブクラスã®å®Ÿè£?« 077 * ã¾ã‹ã•れã¾ã™ã? 078 * 079 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ?? 080 * @og.rev 3.1.2.1 (2003/04/10) synchronized ã‚’ã?削除ã—ã¾ã™ã? 081 * 082 * @param clm DBColumnオブジェクãƒ? 083 * 084 * @return CellRendererオブジェクãƒ? 085 */ 086 public CellRenderer newInstance( final DBColumn clm ) { 087 return new Renderer_FORM( clm ); 088 } 089 090 /** 091 * ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨æ–?—å?ã‚’è¿”ã—ã¾ã™ã? 092 * 093 * ã“ã“ã§ã¯ã€AAA:BBB:CCC:DDD ã¨ã?†å€¤ã‚’ã?$1,$2,$3,$4 ã«å‰²ã‚Šå½“ã¦ãªãŠã—ã¦ã€? 094 * QUERYを実行ã—ã¾ã™ã?ã¾ãŸã?$1 ã¯ã€æœ¬æ¥ã®å€¤ã¨ã—ã¦ã€ãƒ¡ãƒ‹ãƒ¥ãƒ¼ã®åˆæœŸå€¤è¨å®šç‰ã« 095 * 使用ã—ã¾ã™ã?上記ã?例ã§ã¯ã€AAA ãŒå?ã§ã€ãれ以é™ã?ã€å¼•æ•°ã«ãªã‚Šã¾ã™ã? 096 * ã•らã«ã€å?ã®æ–?—å?"AAA:BBB:CCC:DDD"ã¯ã€?0 ã«å‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¾ã™ã?割り当ã¦ãŒãªã? 097 * 変数ã¯ã€?"(ã‚¼ãƒæ–?—å?)ã¨ã—ã¦ã€æ‰±ã‚れã¾ã™ã? 098 * 099 * @og.rev 3.4.0.2 (2003/09/05) AAA:BBB:CCC:DDD ã¨ã?†å€¤ã‚’ã?$1,$2,$3,$4 ã«å‰²ã‚Šå½“ã¦ã¾ã™ã? 100 * @og.rev 4.3.4.0 (2008/12/01) $Cã®ã‚«ãƒ©ãƒ?ç½®æ›ãˆã‚’追åŠ? 101 * 102 * @param value 入力å? 103 * 104 * @return ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨æ–?—å? 105 */ 106 @Override 107 public String getValue( final String value ) { 108 // StringFormat format = new StringFormat( form,value ); 109 StringFormat format = new StringFormat( form, value, name ); // 4.3.4.0 (2008/12/01) 110 return format.format(); 111 } 112 }