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.hayabusa.common.HybsSystem; 023 import org.opengion.fukurou.util.TagBuffer; 024 025 /** 026 * カラãƒ??ãƒ??ã‚¿ã‚’ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã§ç·¨é›?™ã‚‹å?åˆã«ä½¿ç”¨ã™ã‚‹ã‚¨ãƒ?‚£ã‚¿ãƒ¼ã‚¯ãƒ©ã‚¹ã§ã™ã? 027 * 028 * 値ã¨ã—ã¦ã¯ã€?0" ã¨ã€?1" ã®ã¿ 有効ã§ã™ã?("0" ãŒOFF状態ã§ã€?1"ãŒON状態ã§ã™ã?) 029 * ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã¯ã€??常ãƒã‚§ãƒ?‚¯ãŒå?らãªã?¨ä½•ã‚‚é€ä¿¡ã•れã¾ã›ã‚“ã€?0"ã‹ã‚‰"1"ã¸ã® 030 * 状態変化ã¯ã€ãƒã‚§ãƒ?‚¯ã•れるãŸã‚リクエストå?ãŒé?ä¿¡ã•れã¾ã™ãŒã€?1"ã‹ã‚‰"0"ã®å ´åˆã?ã€? 031 * é€ä¿¡ã•れãªã?‚ºã€ãƒ‡ãƒ¼ã‚¿ã®ã‚¯ãƒªã‚¢ã‚’å–å¾—ã™ã‚‹ã“ã¨ãŒå?æ¥ã¾ã›ã‚“ã€? 032 * ã“ã?クラスã§ã¯ã€çŠ¶æ…‹ã«ã‹ã‹ã‚らãšã?hidden ã§ã€?0" ã‚’é?ä¿¡ã—ã¦ã?¾ã™ã?å—ä¿¡å´ã§ã¯ã€? 033 * 常ã«"0"ãŒãる為ã€ä½•ã‚‚ãƒã‚§ãƒ?‚¯ã•れãªã??åˆã?ã€?0"ãŒè¨å®šã•れãŸã“ã¨ã«ãªã‚Šã¾ã™ã? 034 * "1"ãŒè¨å®šã•れるã¨ã€?0"ã¨"1"ãŒä¸¡æ–¹(åŒã˜ã‚ーã§)å–å¾—ã•れã¾ã™ã?ãã?å ´åˆã?ã€?1"ã‚? 035 * 見ã¤ã‘ã‚‹ã“ã¨ã§ã€?1"ã‚’ã‚»ãƒ?ƒˆã•れãŸã“ã¨ãŒåˆ¤ã‚Šã¾ã™ã? 036 * 037 * ç·¨é›?ƒ‘ラメータã«"SEQ"ã¨è¨˜è¿°ã™ã‚‹ã“ã¨ã§æ£æ–¹å‘ã«ã—ã‹é¸ã¹ãªã?‚·ãƒ¼ã‚¯ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ã‚’実ç¾ã§ãã¾ã™ã? 038 * ã“れã«ã‚ˆã‚Šã€ã‚·ãƒ¼ã‚±ãƒ³ã‚¹ã«ã‚¹ãƒ??タスをé?ã«æŒ™ã’ã¦ã?よã†ãªã€ãƒã‚§ãƒ?‚¯ãƒœãƒƒã‚¯ã‚¹ 039 * を作æ?ã™ã‚‹ã“ã¨ãŒå?æ¥ã¾ã™ã?(é€?«æˆ»ã‚Œãªã?ƒ¡ãƒ‹ãƒ¥ãƒ¼) 040 * 041 * ã“ã?エãƒ?‚£ã‚¿ã¯eventColumnã«å¯¾å¿œã—ã¦ã?¾ã›ã‚“ã€? 042 * 043 * カラãƒ??表示ã«å¿?¦ãªå±žæ?ã¯, DBColumn オブジェクãƒ?よりå–り出ã—ã¾ã™ã? 044 * ã“ã?クラスã¯ã€DBColumn オブジェクト毎ã«?‘ã¤ä½œæ?ã•れã¾ã™ã? 045 * 046 * @og.rev 3.5.3.1 (2003/10/31) æ–°è¦ä½œæ? 047 * @og.group ãƒ??ã‚¿ç·¨é›? 048 * 049 * @version 4.0 050 * @author Kazuhiko Hasegawa 051 * @since JDK5.0, 052 */ 053 public class Editor_CHBOX extends AbstractEditor { 054 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 055 private static final String VERSION = "4.0.0.0 (2005/08/31)" ; 056 057 private final boolean seqFlag ; // 3.6.0.6 (2004/10/22) 058 private final String hidden0 ; // 3.6.0.6 (2004/10/22) 059 private final String hidden1 ; // 3.6.0.6 (2004/10/22) 060 061 /** 062 * ãƒ?ƒ•ォルトコンストラクターã€? 063 * ã“ã?コンストラクターã§ã€åŸºæœ¬ã‚ªãƒ–ジェクトを作æ?ã—ã¾ã™ã? 064 * 065 * @og.rev 3.6.0.6 (2004/10/22) シーケンスアクセス機è?(seqFlag)を追åŠ?—ã¾ã? 066 * @og.rev 3.6.0.6 (2004/10/22) 値ã?1"ã®å ´åˆã?ã€hiddenã§ "0" ã‚’å?ã™ã“ã¨ã§ã‚¯ãƒªã‚¢ã«å¯¾å¿? 067 */ 068 public Editor_CHBOX() { 069 // 4.3.4.4 (2009/01/01) 070 // super(); 071 seqFlag = false; // 3.6.0.6 (2004/10/22) 072 hidden0 = ""; 073 hidden1 = ""; 074 } 075 076 /** 077 * コンストラクターã€? 078 * 079 * @og.rev 3.5.6.0 (2004/06/18) XHTMLTag ã® å†?ƒ¨é…å? INPUT_KEY ã‚’éš è”½ã—ã¾ã™ã? 080 * @og.rev 3.6.0.6 (2004/10/22) シーケンスアクセス機è?(seqFlag)を追åŠ?—ã¾ã? 081 * @og.rev 3.6.0.6 (2004/10/22) 値ã?1"ã®å ´åˆã?ã€hiddenã§ "0" ã‚’å?ã™ã“ã¨ã§ã‚¯ãƒªã‚¢ã«å¯¾å¿? 082 * 083 * @param clm DBColumnオブジェクãƒ? 084 */ 085 private Editor_CHBOX( final DBColumn clm ) { 086 super( clm ); 087 seqFlag = "SEQ".equals( clm.getEditorParam() ); // 3.6.0.6 (2004/10/22) 088 String readonly = clm.isWritable() ? null : "readonly" ; 089 090 attributes.set( "type" ,"checkbox" ); 091 attributes.set( "readonly" ,readonly ); 092 093 tagBuffer.add( XHTMLTag.inputAttri( attributes ) ); 094 095 hidden0 = "<input type=\"hidden\" value=\"0\" name=\"" + name ; // 3.6.0.6 (2004/10/22) 096 hidden1 = "<input type=\"hidden\" value=\"1\" name=\"" + name ; // 3.6.0.6 (2004/10/22) 097 } 098 099 /** 100 * å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã—ã¾ã™ã? 101 * 自åˆ??身をã‚ャãƒ?‚·ãƒ¥ã™ã‚‹ã®ã‹ã?æ–°ãŸã«ä½œæ?ã™ã‚‹ã®ã‹ã?ã€å„サブクラスã®å®Ÿè£?« 102 * ã¾ã‹ã•れã¾ã™ã? 103 * 104 * @param clm DBColumnオブジェクãƒ? 105 * 106 * @return CellEditorオブジェクãƒ? 107 */ 108 public CellEditor newInstance( final DBColumn clm ) { 109 return new Editor_CHBOX( clm ); 110 } 111 112 /** 113 * ãƒ??ã‚¿ã®ç·¨é›?”¨æ–?—å?ã‚’è¿”ã—ã¾ã™ã? 114 * 115 * @og.rev 3.5.5.5 (2004/04/23) æ–°è¦ã« Attributes オブジェクトを作æ?ã™ã‚‹æ–¹å¼ã‚’æ¢ã‚ã¾ã™ã? 116 * @og.rev 3.6.0.6 (2004/10/22) シーケンスアクセス機è?(seqFlag)を追åŠ?—ã¾ã? 117 * @og.rev 3.6.0.6 (2004/10/22) 値ã?1"ã®å ´åˆã?ã€hiddenã§ "0" ã‚’å?ã™ã“ã¨ã§ã‚¯ãƒªã‚¢ã«å¯¾å¿? 118 * @og.rev 3.8.0.1 (2005/06/17) 値ã«ã‹ã‹ã‚らãšã?hiddenã§ "0" ã‚’å?ã™ã“ã¨ã§ã‚¯ãƒªã‚¢ã«å¯¾å¿? 119 * 120 * @param value 入力å? 121 * 122 * @return ãƒ??ã‚¿ã®ç·¨é›?”¨æ–?—å? 123 */ 124 @Override 125 public String getValue( final String value ) { 126 String hidden = hidden0 + "\" />" ; // ãƒã‚§ãƒ?‚¯ã‚’ã?ãšã—ãŸå?åˆã?処ç?? 127 128 TagBuffer tag = new TagBuffer( "input" ); 129 tag.add( "name" , name ); 130 tag.add( "value" , "1" ); 131 tag.add( tagBuffer.makeTag() ); 132 if( "1".equals( value ) ) { 133 tag.add( "checked" ,"checked" ); 134 // 3.6.0.6 (2004/10/22) disabled ã§ã¯å€¤ãŒé£›ã?ãªã??ã§ã€hidden ã§å‡ºåŠ›ã™ã‚‹ã? 135 if( seqFlag ) { 136 tag.add( "disabled" ,"disabled" ); 137 hidden = hidden1 + "\" />" ; // 書込ã¿ç¦æ¢ãªã®ã§ã€?1"ã‚’å?力ã—ã¦ãŠã 138 } 139 } 140 tag.add( optAttr ); // 3.5.5.8 (2004/05/20) 141 return tag.makeTag() + hidden; 142 } 143 144 /** 145 * name属æ?を変ãˆãŸã?ãƒ??タ表示/ç·¨é›?”¨ã®HTMLæ–?—å?を作æ?ã—ã¾ã™ã? 146 * ãƒ??ブル上ã? name 㫠行番å·ã‚’ä»˜åŠ ã—ã¦ã€åå‰_è¡Œç•ªå· ã§ç™»éŒ²ã™ã‚‹ã‚ーを作æ?ã? 147 * ãƒªã‚¯ã‚¨ã‚¹ãƒˆæƒ…å ±ã‚’ï¼‘ã¤æ¯Žã?フィールドã§å‡¦ç?§ãã¾ã™ã? 148 * 149 * @og.rev 3.5.5.0 (2004/03/12) åå‰ã¨è¡Œç•ªå·ã®åŒºåˆ?‚Šè¨˜å·("__")ã‚’ã?HybsSystem.JOINT_STRING ã«å¤‰æ›´ã€? 150 * @og.rev 3.5.5.5 (2004/04/23) æ–°è¦ã« Attributes オブジェクトを作æ?ã™ã‚‹æ–¹å¼ã‚’æ¢ã‚ã¾ã™ã? 151 * @og.rev 3.6.0.6 (2004/10/22) シーケンスアクセス機è?(seqFlag)を追åŠ?—ã¾ã? 152 * @og.rev 3.6.0.6 (2004/10/22) 値ã?1"ã®å ´åˆã?ã€hiddenã§ "0" ã‚’å?ã™ã“ã¨ã§ã‚¯ãƒªã‚¢ã«å¯¾å¿? 153 * @og.rev 3.8.0.1 (2005/06/17) 値ã«ã‹ã‹ã‚らãšã?hiddenã§ "0" ã‚’å?ã™ã“ã¨ã§ã‚¯ãƒªã‚¢ã«å¯¾å¿? 154 * 155 * @param row è¡Œç•ªå· 156 * @param value 値 157 * 158 * @return ãƒ??タ表示/ç·¨é›?”¨ã®æ–?—å? 159 */ 160 @Override 161 public String getValue( final int row,final String value ) { 162 String hidden = hidden0 + HybsSystem.JOINT_STRING + row + "\" />" ; 163 164 TagBuffer tag = new TagBuffer( "input" ); 165 tag.add( "name" , name + HybsSystem.JOINT_STRING + row ); 166 tag.add( "value" , "1" ); 167 tag.add( tagBuffer.makeTag() ); 168 if( "1".equals( value ) ) { 169 tag.add( "checked" ,"checked" ); 170 // 3.6.0.6 (2004/10/22) disabled ã§ã¯å€¤ãŒé£›ã?ãªã??ã§ã€hidden ã§å‡ºåŠ›ã™ã‚‹ã? 171 if( seqFlag ) { 172 tag.add( "disabled" ,"disabled" ); 173 hidden = hidden1 + HybsSystem.JOINT_STRING + row + "\" />" ; 174 } 175 } 176 tag.add( optAttr ); // 3.5.5.8 (2004/05/20) 177 178 return tag.makeTag( row,value ) + hidden; 179 } 180 }