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.common.HybsSystem; 019 import org.opengion.hayabusa.db.AbstractEditor; 020 import org.opengion.hayabusa.db.CellEditor; 021 import org.opengion.hayabusa.db.DBColumn; 022 import org.opengion.fukurou.util.TagBuffer; 023 import org.opengion.fukurou.util.XHTMLTag; 024 025 /** 026 * COLOR エãƒ?‚£ã‚¿ãƒ¼ã¯ã€ã‚«ãƒ©ãƒ??ãƒ??タをカラーピッカーã§é¸æŠžã™ã‚‹å?åˆã«ä½¿ç”¨ã™ã‚‹ã‚¯ãƒ©ã‚¹ã§ã™ã? 027 * 値ã¯#FFFFFFã®ã‚ˆã†ã«#付ã7æ¡ã§å…¥ã‚Šã¾ã™ã? 028 * 029 * カラãƒ??表示ã«å¿?¦ãªå±žæ?ã¯, DBColumn オブジェクãƒ?よりå–り出ã—ã¾ã™ã? 030 * ã“ã?クラスã¯ã€DBColumn オブジェクト毎ã«?‘ã¤ä½œæ?ã•れã¾ã™ã? 031 * 032 * @og.group ãƒ??ã‚¿ç·¨é›? 033 * 034 * @og.rev 5.5.4.0 (2012/07/02) æ–°è¦ä½œæ? 035 * 036 * @version 4.0 037 * @author Kazuhiko Hasegawa 038 * @since JDK5.0, 039 */ 040 public class Editor_COLOR extends AbstractEditor { 041 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */ 042 private static final String VERSION = "5.5.4.0 (2012/07/02)" ; 043 044 /** 045 * ãƒ?ƒ•ォルトコンストラクターã€? 046 * ã“ã?コンストラクターã§ã€åŸºæœ¬ã‚ªãƒ–ジェクトを作æ?ã—ã¾ã™ã? 047 * 048 * @og.rev 3.1.1.1 (2003/04/03) å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã™ãƒ•ァクトリメソãƒ?ƒ‰ã‚’追åŠ?? 049 * 050 */ 051 public Editor_COLOR() { 052 // 4.3.4.4 (2009/01/01) 053 // super(); 054 } 055 056 /** 057 * コンストラクターã€? 058 * 059 * @param clm DBColumnオブジェクãƒ? 060 */ 061 private Editor_COLOR( final DBColumn clm ) { 062 super( clm ); 063 attributes.add( "class" ,"colorPicker" ); 064 attributes.add( "readonly" ,"readonly" ); 065 tagBuffer.add( XHTMLTag.inputAttri( attributes ) ); 066 } 067 068 /** 069 * å?‚ªãƒ–ジェクトã‹ã‚‰è?åˆ??インスタンスを返ã—ã¾ã™ã? 070 * 自åˆ??身をã‚ャãƒ?‚·ãƒ¥ã™ã‚‹ã®ã‹ã?æ–°ãŸã«ä½œæ?ã™ã‚‹ã®ã‹ã?ã€å„サブクラスã®å®Ÿè£?« 071 * ã¾ã‹ã•れã¾ã™ã? 072 * 073 * @param clm DBColumnオブジェクãƒ? 074 * 075 * @return CellEditorオブジェクãƒ? 076 */ 077 public CellEditor newInstance( final DBColumn clm ) { 078 return new Editor_COLOR( clm ); 079 } 080 081 /** 082 * ãƒ??ã‚¿ã®ç·¨é›?”¨æ–?—å?ã‚’è¿”ã—ã¾ã™ã?(色付ã) 083 * 084 * @param value 入力å? 085 * 086 * @return ãƒ??ã‚¿ã®ç·¨é›?”¨æ–?—å? 087 */ 088 @Override 089 public String getValue( final String value ) { 090 091 TagBuffer tag = new TagBuffer( "input" ); 092 tag.add( "name" , name ); 093 if( attributes.get( "id" ) == null || attributes.get( "id" ).length() == 0 ) { 094 tag.add( "id" , name ); 095 } 096 tag.add( "value" , value ); 097 tag.add( "size" , size1 ); 098 tag.add( "style" , "background-color:"+value+"; color:"+value+";" ); 099 tag.add( tagBuffer.makeTag() ); 100 tag.add( optAttr ); 101 102 return tag.makeTag(); 103 } 104 105 /** 106 * name属æ?を変ãˆãŸã?ãƒ??タ表示/ç·¨é›?”¨ã®HTMLæ–?—å?を作æ?ã—ã¾ã™ã?(色付ã) 107 * ãƒ??ブル上ã? name 㫠行番å·ã‚’ä»˜åŠ ã—ã¦ã€åå‰_è¡Œç•ªå· ã§ç™»éŒ²ã™ã‚‹ã‚ーを作æ?ã? 108 * ãƒªã‚¯ã‚¨ã‚¹ãƒˆæƒ…å ±ã‚’ï¼‘ã¤æ¯Žã?フィールドã§å‡¦ç?§ãã¾ã™ã? 109 * 110 * @param row è¡Œç•ªå· 111 * @param value 入力å? 112 * 113 * @return ãƒ??タ表示/ç·¨é›?”¨ã®æ–?—å? 114 */ 115 @Override 116 public String getValue( final int row,final String value ) { 117 TagBuffer tag = new TagBuffer( "input" ); 118 String newName = name + HybsSystem.JOINT_STRING + row; 119 tag.add( "name" , newName ); 120 if( attributes.get( "id" ) == null || attributes.get( "id" ).length() == 0 ) { 121 tag.add( "id" , newName ); 122 } 123 tag.add( "value" , value ); 124 tag.add( "size" , size2 ); 125 tag.add( "style" , "background-color:"+value+"; color:"+value+";" ); 126 tag.add( tagBuffer.makeTag() ); 127 tag.add( optAttr ); 128 129 return tag.makeTag( row,value ); 130 } 131 }