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.hayabusa.taglib;
017    
018    import org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.fukurou.util.XHTMLTag;
020    
021    /**
022     * æŒ?®šã?位置に画像を配置するHTML拡張タグですã?
023     *
024     * @og.formSample
025     * ●形式ï¼?lt;og:img src="?¥?¥?¥" alt="?¥?¥?¥"; />
026     * ●body?šなã�?
027     *
028     * ●Tag定義??
029     *   <og:img
030     *       name               【HTML】名前をæŒ?®šしまã�?
031     *       src              ○ã?HTML】表示させる画像ã?URLを指定しまã�?å¿??)ã€?
032     *       alt              ○ã?HTML】画像が表示されなã�??合ã?代わりに表示させるテキストをæŒ?®šしまã�?å¿??)ã€?
033     *       longdesc           【HTML】画像部åˆ?�«つã�?�¦の詳しいæƒ??があるURL(longdesc)を指定しまã�?
034     *       width              【HTML】横å¹?‚’ピクセル数またã???�§æŒ?®šしまã�?
035     *       height             【HTML】縦å¹?‚’ピクセル数またã???�§æŒ?®šしまã�?
036     *       usemap             【HTML】クライアントサイドクリãƒ?‚«ブルを指定しまã�?
037     *       ismap              【HTML】サーバã?サイドクリãƒ?‚«ブルを指定しまã�?
038     *       clazz              【HTML】要ç´?�«対して class 属æ?を設定しまã�?
039     *       id                 【HTML】要ç´?�«対して固有ã?名前(id)をつける場合に設定しまã�?
040     *       title              【HTML】要ç´?�«対する補足çš?ƒ…報(title)を設定しまã�?
041     *       style              【HTML】この要ç´?�«対して適用させるスタイルシーãƒ?style)を設定しまã�?
042     *       lang               【HTML】要ç´??å†?®¹と他ã?属æ?値のè¨?ª?lang,xml:lang)を指定しまã�?
043     *       dir                【HTML】文字表記ã?方å�?dir)を指定しまã�?
044     *       onClick            【HTML】JavaScriptのイベンãƒ?onClick を設定しまã�?ä¾?onClick="renew('query.jsp','QUERY');")
045     *       onBlur             【HTML】JavaScriptのイベンãƒ?onBlur を設定しまã�?ä¾?onBlur="this.value=value.toUpperCase();")
046     *       onFocus            【HTML】JavaScriptのイベンãƒ?onFocus を設定しまã�?
047     *       ondblClick         【HTML】JavaScriptのイベンãƒ?ondblClick を設定しまã�?
048     *       onMouseDown        【HTML】JavaScriptのイベンãƒ?onMouseDown を設定しまã�?
049     *       onMouseUp          【HTML】JavaScriptのイベンãƒ?onMouseUp を設定しまã�?
050     *       onMouseMove        【HTML】JavaScriptのイベンãƒ?onMouseMove を設定しまã�?
051     *       onMouseOut         【HTML】JavaScriptのイベンãƒ?onMouseOut を設定しまã�?
052     *       onMouseOver        【HTML】JavaScriptのイベンãƒ?onMouseOver を設定しまã�?
053     *       roles              【TAG】ロールをセãƒ?ƒˆしまã�?
054     *       debug              【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
055     *   />
056     *
057     * ●使用ä¾?
058     *    <og:img src="{@URL}" alt="sample" />
059     *
060     *        src  : 表示させる画像ã?URL(å¿??)
061     *        alt  : 画像が表示されなã�??合ã?代わりに表示させるテキスãƒ?å¿??)
062     *
063     * @og.group 画面部å“?
064     *
065     * @version  4.0
066     * @author   Kohei Naruse
067     * @since    JDK5.0,
068     */
069    public class ImageTag extends HTMLTagSupport {
070            //* こã?プログラãƒ??VERSIONæ–?­—å?を設定しますã?       {@value} */
071            private static final String VERSION = "4.0.0.0 (2005/01/31)" ;
072    
073            private static final long serialVersionUID = 400020050131L ;
074    
075            /**
076             * æŒ?®š位置に画像を配置するためのイメージタグを作æ?しますã?
077             *
078             * @return  イメージタグ
079             */
080            @Override
081            protected String makeTag() {
082                    StringBuilder rtn = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
083    
084                    rtn.append(XHTMLTag.img(getAttributes()));
085    
086                    return rtn.toString();
087            }
088    
089            /**
090             * 【HTML】名前をæŒ?®šしますã?
091             *
092             * @og.tag 名前を指定しますã?
093             *
094             * @param   name 名前
095             */
096            public void setName( final String name ) {
097                    set( "name",getRequestParameter( name ) );
098            }
099    
100            /**
101             * 【HTML】表示させる画像ã?URLを指定しますã?
102             *
103             * @og.tag 表示させる画像ã?URLを指定しますã?
104             *
105             * @param   src 画像ã?URL
106             */
107            public void setSrc( final String src ) {
108                    set( "src",getRequestParameter( src ) );
109            }
110    
111            /**
112             * 【HTML】画像が表示されなã�??合ã?代わりに表示させるテキストをæŒ?®šしますã?
113             *
114             * @og.tag 画像が表示されなã�??合ã?代わりに表示させるテキストをæŒ?®šしますã?
115             *
116             * @param   alt 代替えテキスãƒ?
117             */
118            public void setAlt( final String alt ) {
119                    set( "alt",getRequestParameter( alt ) );
120            }
121    
122            /**
123             * 【HTML】画像部åˆ?�«つã�?�¦の詳しいæƒ??があるURL(longdesc)を指定しますã?
124             *
125             * @og.tag longdescを指定しますã?
126             *
127             * @param   longdesc 詳しいæƒ??があるURL
128             */
129            public void setLongdesc( final String longdesc ) {
130                    set( "longdesc",getRequestParameter( longdesc ) );
131            }
132    
133            /**
134             * 【HTML】横å¹?‚’ピクセル数またã???�§æŒ?®šしますã?
135             *
136             * @og.tag 横å¹?‚’æŒ?®šしますã?
137             *
138             * @param   width 横å¹?ピクセル数またã???
139             */
140            public void setWidth( final String width ) {
141                    set( "width",getRequestParameter( width ) );
142            }
143    
144            /**
145             * 【HTML】縦å¹?‚’ピクセル数またã???�§æŒ?®šしますã?
146             *
147             * @og.tag 縦å¹?‚’æŒ?®šしますã?
148             *
149             * @param   height 縦å¹?ピクセル数またã???
150             */
151            public void setHeight( final String height ) {
152                    set( "height",getRequestParameter( height ) );
153            }
154    
155            /**
156             * 【HTML】クライアントサイドクリãƒ?‚«ブルを指定しますã?
157             *
158             * @og.tag クライアントサイドクリãƒ?‚«ブルを指定しますã?
159             *
160             * @param   usemap クライアントサイドクリãƒ?‚«ブル
161             */
162            public void setUsemap( final String usemap ) {
163                    set( "usemap",getRequestParameter( usemap ) );
164            }
165    
166            /**
167             * 【HTML】サーバã?サイドクリãƒ?‚«ブルを指定しますã?
168             *
169             * @og.tag サーバã?サイドクリãƒ?‚«ブルを指定しますã?
170             *
171             * @param   ismap クライアントサイドクリãƒ?‚«ブル
172             */
173            public void setIsmap( final String ismap ) {
174                    set( "ismap",getRequestParameter( ismap ) );
175            }
176    
177            /**
178             * タグの名称をã?返しますã?
179             * 自åˆ??身のクラス名よりã?自動的に取り出せなã�?�Ÿめã?こã?メソãƒ?ƒ‰をオーバã?ライドしますã?
180             *
181             * @og.rev 4.0.0.0 (2005/01/31) 新規追åŠ?
182             *
183             * @return  タグの名称
184             */
185            @Override
186            protected String getTagName() {
187                    return "img" ;
188            }
189    }