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    }