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.XHTMLTag; 023 import org.opengion.fukurou.util.TagBuffer; 024 025 /** 026 * YMD エ?ターは、カラ????タを日?年/?日)編?る?合に使用するクラスです? 027 * YMD3はカレン??のポップア??ボタンが付属するタイプです? 028 * YMD2と異なり?ポップア??をmodalDialogで立ち上げる?ではなく?JavaScriptで作?します???TML5対応? 029 * 030 * 031 * こ?エ?タはeventColumnに対応して?せん? 032 * 033 * カラ??表示に?な属?は, DBColumn オブジェク?より取り出します? 034 * こ?クラスは、DBColumn オブジェクト毎に?つ作?されます? 035 * 036 * @og.rev 5.8.9.0 (2015/08/08) 新規作? 037 * @og.group ??タ編? 038 * 039 * @version 4.0 040 * @author Takahashi Masakazu 041 * @since JDK5.0, 042 */ 043 public class Editor_YMD3 extends AbstractEditor { 044 //* こ?プログラ??VERSION??を設定します? {@value} */ 045 private static final String VERSION = "5.6.5.2 (2013/06/21)" ; 046 047 private static final String CAL1 = "<img src=\"../image/calendar.gif\" alt=\"Calendar\" class=\"calPic\" targetId=\""; 048 private static final String CAL2 = "\" />"; 049 050 /** 051 * ?ォルトコンストラクター? 052 * こ?コンストラクターで、基本オブジェクトを作?します? 053 * 054 */ 055 public Editor_YMD3() { 056 // 4.3.4.4 (2009/01/01) 057 // super(); 058 } 059 060 /** 061 * コンストラクター? 062 * 063 * @param clm DBColumnオブジェク? 064 */ 065 private Editor_YMD3( final DBColumn clm ) { 066 super( clm ); 067 tagBuffer.add( XHTMLTag.inputAttri( attributes ) ); 068 } 069 070 /** 071 * ?ブジェクトから???インスタンスを返します? 072 * 自??身をキャ?ュするのか?新たに作?するのか?、各サブクラスの実? 073 * まかされます? 074 * 075 * @param clm DBColumnオブジェク? 076 * 077 * @return CellEditorオブジェク? 078 */ 079 public CellEditor newInstance( final DBColumn clm ) { 080 return new Editor_YMD3( clm ); 081 } 082 083 /** 084 * ??タの編???を返します? 085 * 086 * @og.rev 4.3.7.2 (2009/06/15) 属?でidが?力される場合?、idを?力しな? 087 * 088 * @param value 入力? 089 * 090 * @return ??タの編??? 091 */ 092 @Override 093 public String getValue( final String value ) { 094 String id; 095 096 TagBuffer tag = new TagBuffer( "input" ); 097 tag.add( "name" , name ); 098 if( attributes.get( "id" ) == null || attributes.get( "id" ).length() == 0 ) { // 4.3.7.2 (2009/06/15) 099 id = name; 100 tag.add( "id" , name ); 101 } 102 else{ 103 id = attributes.get( "id" ); 104 } 105 tag.add( "value" , value ); 106 tag.add( "size" , size1 ); 107 tag.add( tagBuffer.makeTag() ); 108 tag.add( optAttr ); // 3.5.5.8 (2004/05/20) 109 110 return tag.makeTag() + CAL1 + id + CAL2 ; 111 } 112 113 /** 114 * name属?を変えた???タ表示/編?のHTML??を作?します? 115 * ??ブル上? name に 行番号を付加して、名前_行番号 で登録するキーを作?? 116 * リクエスト情報を1つ毎?フィールドで処?きます? 117 * 118 * @og.rev 4.3.7.2 (2009/06/15) 属?でidが?力される場合?、idを?力しな? 119 * 120 * @param row 行番号 121 * @param value 入力? 122 * 123 * @return ??タ表示/編?の?? 124 */ 125 @Override 126 public String getValue( final int row,final String value ) { 127 TagBuffer tag = new TagBuffer( "input" ); 128 String name2 = name + HybsSystem.JOINT_STRING + row ; 129 tag.add( "name" , name2); 130 if( attributes.get( "id" ) == null || attributes.get( "id" ).length() == 0 ) { // 4.3.7.2 (2009/06/15) 131 tag.add( "id" , name2); 132 } 133 tag.add( "value" , value ); 134 tag.add( "size" , size2 ); 135 tag.add( tagBuffer.makeTag() ); 136 tag.add( optAttr ); // 3.5.5.8 (2004/05/20) 137 138 return tag.makeTag( row,value ) + CAL1 + name2 + CAL2 ; 139 } 140 }