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.AbstractEditor;
019 import org.opengion.hayabusa.db.CellEditor;
020 import org.opengion.hayabusa.db.DBColumn;
021 import org.opengion.fukurou.util.XHTMLTag;
022 import org.opengion.fukurou.util.StringUtil;
023
024 /**
025 * HTMLã‚¿ã‚°ã‚’å«ã‚?ƒ‡ãƒ¼ã‚¿ã‚’ç·¨é›?™ã‚‹å?åˆã«ä½¿ç”¨ã™ã‚‹ã‚¨ãƒ?‚£ã‚¿ãƒ¼ã‚¯ãƒ©ã‚¹ã§ã™ã?
026 *
027 * ãƒ??タベã?スã«å¯¾ã—ã¦ã€åŠ å·¥ãªã—データを登録ã—ã¦ã?¾ã™ã?HTMLã‚¿ã‚°ã‚?
028 * å«ã‚?ƒ‡ãƒ¼ã‚¿ã¯ã€DBTypeã®ãƒã‚§ãƒ?‚¯ã«ã‚ˆã‚Šã€??常ã¯ç™»éŒ²ã§ãã¾ã›ã‚“ã€?
029 * ã“れã¯ã€ã‚¯ãƒã‚¹ã‚µã‚¤ãƒˆã‚¹ã‚¯ãƒªãƒ—ティング対ç–ã?為ã§ã™ã?DBTypeを指定ã™ã‚?
030 * ã“ã¨ã§ã€HTMLã‚¿ã‚°ã®ç™»éŒ²ãŒå¯èƒ½ã«ãªã‚Šã¾ã™ã?
031 * ã—ã‹ã—ã?エンジンã§ã¯ã€æ¤œç´¢æ™‚å?ç?‚’優先ã•ã›ã‚‹ç‚ºã€æ¤œç´¢æ™‚ã«ã¯åŠ?·¥ã—ã¦
032 * ã?¾ã›ã‚“。ã¤ã¾ã‚Šã?HTMLã‚¿ã‚°ã‚’å«ã‚?ƒ‡ãƒ¼ã‚¿ã‚’ãã®ã¾ã¾è¡¨ç¤ºã•ã›ã‚‹ã¨ã€HTMLã®
033 * コードã¨è§£é‡ˆã•れã?レイアウトãŒå´©ã‚Œã‚‹ã“ã¨ã«ãªã‚Šã¾ã™ã?
034 * HTMLエãƒ?‚£ã‚¿ãƒ¼ã¯ã€ãƒ‡ãƒ¼ã‚¿ã®HTMLタグをエスケープã™ã‚‹ã“ã¨ã§ã€è¡¨ç¤ºä¸Šã?ã€?
035 * HTMLコードãŒãã?ã¾ã¾è¡¨ç¤º/ç·¨é›?§ãる状態ã«ã—ã¾ã™ã?
036 *
037 * カラãƒ??表示ã«å¿?¦ãªå±žæ?ã¯, DBColumn オブジェクãƒ?よりå–り出ã—ã¾ã™ã?
038 * ã“ã?クラスã¯ã€DBColumn オブジェクト毎ã«?‘ã¤ä½œæ?ã•れã¾ã™ã?
039 *
040 * @og.rev 2.1.1.1 (2002/11/15) HTML エãƒ?‚£ã‚¿ãƒ¼ã‚’æ–°è¦è¿½åŠ?—ã¾ã—ãŸã€?
041 * @og.group �?タ編�
042 *
043 * @version 4.0
044 * @author Kazuhiko Hasegawa
045 * @since JDK5.0,
046 */
047 public class Editor_HTML extends AbstractEditor {
048 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */
049 private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
050
051 /**
052 * ãƒ?ƒ•ォルトコンストラクターã€?
053 * ã“ã?コンストラクターã§ã€åŸºæœ¬ã‚ªãƒ–ジェクトを作æ?ã—ã¾ã™ã?
054 *
055 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ??
056 *
057 */
058 public Editor_HTML() {
059 // 4.3.4.4 (2009/01/01)
060 // super();
061 }
062
063 /**
064 * コンストラクター�
065 *
066 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ??
067 * @og.rev 3.5.6.0 (2004/06/18) XHTMLTag ã® å†?ƒ¨é…å? INPUT_KEY ã‚’éš è”½ã—ã¾ã™ã?
068 *
069 * @param clm DBColumnオブジェク�
070 */
071 private Editor_HTML( final DBColumn clm ) {
072 super( clm );
073 tagBuffer.add( XHTMLTag.inputAttri( attributes ) );
074 }
075
076 /**
077 * å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã—ã¾ã™ã?
078 * 自åˆ??身をã‚ャãƒ?‚·ãƒ¥ã™ã‚‹ã®ã‹ã?æ–°ãŸã«ä½œæ?ã™ã‚‹ã®ã‹ã?ã€å„サブクラスã®å®Ÿè£?«
079 * ã¾ã‹ã•れã¾ã™ã?
080 *
081 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ??
082 * @og.rev 3.1.2.1 (2003/04/10) synchronized ã‚’ã?削除ã—ã¾ã™ã?
083 *
084 * @param clm DBColumnオブジェク�
085 *
086 * @return CellEditorオブジェク�
087 */
088 public CellEditor newInstance( final DBColumn clm ) {
089 return new Editor_HTML( clm );
090 }
091
092 /**
093 * ãƒ??ã‚¿ã®ç·¨é›?”¨æ–?—å?ã‚’è¿”ã—ã¾ã™ã?
094 *
095 * @param value 入力å?
096 *
097 * @return ãƒ??ã‚¿ã®ç·¨é›?”¨æ–?—å?
098 */
099 @Override
100 public String getValue( final String value ) {
101 return super.getValue( StringUtil.htmlFilter( value ) );
102 }
103
104 /**
105 * name属æ?を変ãˆãŸã?ãƒ??タ表示/ç·¨é›?”¨ã®HTMLæ–?—å?を作æ?ã—ã¾ã™ã?
106 * ãƒ??ブル上ã? name 㫠行番å·ã‚’ä»˜åŠ ã—ã¦ã€åå‰_è¡Œç•ªå· ã§ç™»éŒ²ã™ã‚‹ã‚ーを作æ?ã?
107 * ãƒªã‚¯ã‚¨ã‚¹ãƒˆæƒ…å ±ã‚’ï¼‘ã¤æ¯Žã?フィールドã§å‡¦ç?§ãã¾ã™ã?
108 *
109 * @og.rev 2.0.0.3 (2002/09/26) optionAttributes 属æ?ã« "$i" を使ã?¨ãã?行数ã«ç½®ãæ›ã‚‹æ©Ÿè?を追åŠ??
110 *
111 * @param row 行番å·
112 * @param value 入力å?
113 *
114 * @return ãƒ??タ表示/ç·¨é›?”¨ã®æ–?—å?
115 */
116 @Override
117 public String getValue( final int row,final String value ) {
118 return super.getValue( row, StringUtil.htmlFilter( value ) );
119 }
120 }