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.StringUtil; 022 023 /** 024 * 特定ã?HTMLã‚¿ã‚°ã®ã‚¨ã‚¹ã‚±ãƒ¼ãƒ—æ–‡å—ã‚’å…??ã‚¿ã‚°ã«æˆ»ã—ã¦è¡¨ç¤ºã™ã‚‹ã‚¯ãƒ©ã‚¹ã§ã™ã? 025 * 026 * HTMLレンãƒ?ƒ©ãƒ¼ã§ã€HTMLã‚¿ã‚°('<' ã‚?'>')ã?'&lt;' ã‚?'&gt;' ã«)å¤‰æ› 027 * ã•れã¾ã™ãŒã€ã“ã® FILTERã§ã¯ã€ç‰¹å®šã?å¤‰æ›æ¸ˆã¿ã‚¿ã‚°ã‚’å?ã®HTMLã«æˆ»ã™å?ç?‚’行ã„ã¾ã™ã? 028 * ç¾æ™‚点ã§ã¯ã€?lt;u> , </u> , <br /> ã®?“種類ã§ã™ã? 029 * ã“れã¯ã€å¸³ç¥¨ã‚·ã‚¹ãƒ?ƒ ã§ã€ãƒ‡ãƒ¼ã‚¿ã«å«ã¾ã‚Œã‚‹HTMLを変æ›ã—ãªã?¨ã€HTMLã®ãƒ¬ã‚¤ã‚¢ã‚¦ãƒˆãŒ 030 * 崩れる為ã€?.7.0.1 (2005/01/31) ã§ã€å¸³ç¥¨ãƒ??ã‚¿ã®HTMLエスケープå?ç?‚’å°Žå?ã—ã¾ã—ãŸã€? 031 * ã“ã?時点ã§ã€ã‚»ãƒ«å†??改行を表ã?<br> ã‚‚ã?エスケープã•れる為ã€?.7.1.1 (2005/05/31)ã«ã¦ 032 * <br>ã®ã¿ã€ãã®ã¾ã¾å…?«æˆ»ã™å?ç?Œå…¥ã£ã¦ã?¾ã™ã? 033 * 今回ã¯ã€æŒ‡å®šã?ãƒ??ã‚¿ã«ä¸‹ç·šã‚’引ã <u> ã‚¿ã‚°ã¨ã€ä»Šå¾Œã‚‚ã“ã?よã†ãªå¤‰æ›å¯¾è±¡ãŒç¾ã‚Œã‚‹ 034 * å¯èƒ½æ€§ã‚’è?æ…®ã—ã¦ã€æ—¢å˜ã?レンãƒ?ƒ©ãƒ¼ã«å®Ÿè£?—ã¾ã—ãŸã€? 035 * ç¾çжã®å¸³ç¥¨ã‚·ã‚¹ãƒ?ƒ ã§ã¯ã€ã‚¨ãƒ³ã‚¸ãƒ³ã®ãƒ¬ãƒ³ãƒ?ƒ©ãƒ¼çµŒç”±ã§å¤‰æ›ã•れã€HTMLå¯ã•れã¦ã?‚‹ãŸã‚ã€? 036 * カラãƒ?ƒªã‚½ãƒ¼ã‚¹(シスãƒ?ƒ IDãŒGE)ã«é€?¤‰æ›ã—ãŸã?‚«ãƒ©ãƒ?‚’ã“ã? FILTER レンãƒ?ƒ©ãƒ¼ã§ 037 * 登録ã™ã‚Œã°ã€å?ã«æˆ»ã™ã“ã¨ãŒå¯èƒ½ã«ãªã‚Šã¾ã™ã? 038 * 039 * クãƒã‚¹ã‚µã‚¤ãƒˆã‚¹ã‚¯ãƒªãƒ—ティングå•題ã«å¯¾å¿œã™ã‚‹ãƒ•ィールドã«å¯¾ã—㦠040 * 定義ã™ã‚‹ã“ã¨ã«ã‚ˆã‚Šã€ã‚¨ã‚¹ã‚±ãƒ¼ãƒ—å?ç?‚’行ã„ã¾ã™ã? 041 * 042 * ã“ã?クラスã¯ã€ä¸å¤‰ã‚ªãƒ–ジェクトã¨ã—ã¦ã€å?有ã•れã¾ã™ã? 043 * 044 * @og.rev 3.8.1.1 (2005/11/21) æ–°è¦è¿½åŠ? 045 * @og.group ãƒ??タ表示 046 * 047 * @version 4.0 048 * @author Kazuhiko Hasegawa 049 * @since JDK5.0, 050 */ 051 public class Renderer_FILTER extends AbstractRenderer { 052 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 053 private static final String VERSION = "4.0.0.0 (2005/08/31)" ; 054 055 private static final CellRenderer dbCell = new Renderer_FILTER(); 056 private static final String[] KEYS = new String[] { "<u>" ,"</u>","<br/>" }; 057 private static final String[] VALS = new String[] { "<u>" ,"</u>" ,"<br/>" }; 058 059 /** 060 * å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã—ã¾ã™ã? 061 * 自åˆ??身をã‚ャãƒ?‚·ãƒ¥ã™ã‚‹ã®ã‹ã?æ–°ãŸã«ä½œæ?ã™ã‚‹ã®ã‹ã?ã€å„サブクラスã®å®Ÿè£?« 062 * ã¾ã‹ã•れã¾ã™ã? 063 * 064 * @param clm DBColumnオブジェクãƒ? 065 * 066 * @return CellRendererオブジェクãƒ? 067 */ 068 public CellRenderer newInstance( final DBColumn clm ) { 069 return dbCell; 070 } 071 072 /** 073 * ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨æ–?—å?ã‚’è¿”ã—ã¾ã™ã? 074 * 075 * @param value 入力å? 076 * 077 * @return ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨æ–?—å? 078 */ 079 @Override 080 public String getValue( final String value ) { 081 String val = ( value == null ) ? "" : value; 082 083 for( int i=0; i<KEYS.length; i++ ) { 084 val = StringUtil.replace( val,KEYS[i],VALS[i] ); 085 } 086 087 return val; 088 } 089 }