Source Code Cross Referenced for ImageTag.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » taglib » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » struts 1.3.8 » org.apache.struts.taglib.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ImageTag.java 471754 2006-11-06 14:55:09Z husted $
003:         *
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *  http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:        package org.apache.struts.taglib.html;
022:
023:        import org.apache.struts.Globals;
024:        import org.apache.struts.config.ModuleConfig;
025:        import org.apache.struts.taglib.TagUtils;
026:        import org.apache.struts.util.ModuleUtils;
027:
028:        import javax.servlet.http.HttpServletRequest;
029:        import javax.servlet.http.HttpServletResponse;
030:        import javax.servlet.jsp.JspException;
031:
032:        /**
033:         * Tag for input fields of type "image".
034:         *
035:         * @version $Rev: 471754 $ $Date: 2005-04-26 20:11:47 -0400 (Tue, 26 Apr 2005)
036:         *          $
037:         */
038:        public class ImageTag extends SubmitTag {
039:            // ------------------------------------------------------------- Properties
040:
041:            /**
042:             * The alignment for this image.
043:             */
044:            protected String align = null;
045:
046:            /**
047:             * The border size around the image.
048:             */
049:            protected String border = null;
050:
051:            /**
052:             * The module-relative URI of the image.
053:             */
054:            protected String page = null;
055:
056:            /**
057:             * The message resources key of the module-relative URI of the image.
058:             */
059:            protected String pageKey = null;
060:
061:            /**
062:             * The URL of this image.
063:             */
064:            protected String src = null;
065:
066:            /**
067:             * The message resources key for the URL of this image.
068:             */
069:            protected String srcKey = null;
070:
071:            /**
072:             * The module prefix (beginning with a slash) which will be used to find
073:             * the action for this link.
074:             */
075:            protected String module = null;
076:
077:            // --------------------------------------------------------- Constructor
078:            public ImageTag() {
079:                super ();
080:                property = "";
081:            }
082:
083:            /**
084:             * @deprecated Align attribute is deprecated in HTML 4.x.
085:             */
086:            public String getAlign() {
087:                return (this .align);
088:            }
089:
090:            /**
091:             * @deprecated Align attribute is deprecated in HTML 4.x.
092:             */
093:            public void setAlign(String align) {
094:                this .align = align;
095:            }
096:
097:            public String getBorder() {
098:                return (this .border);
099:            }
100:
101:            public void setBorder(String border) {
102:                this .border = border;
103:            }
104:
105:            public String getPage() {
106:                return (this .page);
107:            }
108:
109:            public void setPage(String page) {
110:                this .page = page;
111:            }
112:
113:            public String getPageKey() {
114:                return (this .pageKey);
115:            }
116:
117:            public void setPageKey(String pageKey) {
118:                this .pageKey = pageKey;
119:            }
120:
121:            public String getSrc() {
122:                return (this .src);
123:            }
124:
125:            public void setSrc(String src) {
126:                this .src = src;
127:            }
128:
129:            public String getSrcKey() {
130:                return (this .srcKey);
131:            }
132:
133:            public void setSrcKey(String srcKey) {
134:                this .srcKey = srcKey;
135:            }
136:
137:            public String getModule() {
138:                return (this .module);
139:            }
140:
141:            public void setModule(String module) {
142:                this .module = module;
143:            }
144:
145:            // --------------------------------------------------------- Protected Methods
146:
147:            /**
148:             * Render the opening element.
149:             *
150:             * @return The opening part of the element.
151:             */
152:            protected String getElementOpen() {
153:                return "<input type=\"image\"";
154:            }
155:
156:            /**
157:             * Render the button attributes
158:             *
159:             * @param results The StringBuffer that output will be appended to.
160:             */
161:            protected void prepareButtonAttributes(StringBuffer results)
162:                    throws JspException {
163:                String tmp = src();
164:
165:                if (tmp != null) {
166:                    HttpServletResponse response = (HttpServletResponse) pageContext
167:                            .getResponse();
168:
169:                    prepareAttribute(results, "src", response.encodeURL(tmp));
170:                }
171:
172:                prepareAttribute(results, "align", getAlign());
173:                prepareAttribute(results, "border", getBorder());
174:                prepareAttribute(results, "value", getValue());
175:                prepareAttribute(results, "accesskey", getAccesskey());
176:                prepareAttribute(results, "tabindex", getTabindex());
177:            }
178:
179:            /**
180:             * Release any acquired resources.
181:             */
182:            public void release() {
183:                super .release();
184:                page = null;
185:                pageKey = null;
186:                property = "";
187:                src = null;
188:                srcKey = null;
189:            }
190:
191:            // ------------------------------------------------------ Protected Methods
192:
193:            /**
194:             * Return the base source URL that will be rendered in the
195:             * <code>src</code> property for this generated element, or
196:             * <code>null</code> if there is no such URL.
197:             *
198:             * @throws JspException if an error occurs
199:             */
200:            protected String src() throws JspException {
201:                // Deal with a direct context-relative page that has been specified
202:                if (this .page != null) {
203:                    if ((this .src != null) || (this .srcKey != null)
204:                            || (this .pageKey != null)) {
205:                        JspException e = new JspException(messages
206:                                .getMessage("imgTag.src"));
207:
208:                        TagUtils.getInstance().saveException(pageContext, e);
209:                        throw e;
210:                    }
211:
212:                    HttpServletRequest request = (HttpServletRequest) pageContext
213:                            .getRequest();
214:
215:                    ModuleConfig config = ModuleUtils.getInstance()
216:                            .getModuleConfig(this .module, request,
217:                                    pageContext.getServletContext());
218:
219:                    String pageValue = this .page;
220:
221:                    if (config != null) {
222:                        pageValue = TagUtils.getInstance().pageURL(request,
223:                                this .page, config);
224:                    }
225:
226:                    return (request.getContextPath() + pageValue);
227:                }
228:
229:                // Deal with an indirect context-relative page that has been specified
230:                if (this .pageKey != null) {
231:                    if ((this .src != null) || (this .srcKey != null)) {
232:                        JspException e = new JspException(messages
233:                                .getMessage("imgTag.src"));
234:
235:                        TagUtils.getInstance().saveException(pageContext, e);
236:                        throw e;
237:                    }
238:
239:                    HttpServletRequest request = (HttpServletRequest) pageContext
240:                            .getRequest();
241:
242:                    ModuleConfig config = ModuleUtils.getInstance()
243:                            .getModuleConfig(this .module, request,
244:                                    pageContext.getServletContext());
245:
246:                    String pageValue = TagUtils.getInstance()
247:                            .message(pageContext, getBundle(), getLocale(),
248:                                    this .pageKey);
249:
250:                    if (config != null) {
251:                        pageValue = TagUtils.getInstance().pageURL(request,
252:                                pageValue, config);
253:                    }
254:
255:                    return (request.getContextPath() + pageValue);
256:                }
257:
258:                // Deal with an absolute source that has been specified
259:                if (this .src != null) {
260:                    if (this .srcKey != null) {
261:                        JspException e = new JspException(messages
262:                                .getMessage("imgTag.src"));
263:
264:                        TagUtils.getInstance().saveException(pageContext, e);
265:                        throw e;
266:                    }
267:
268:                    return (this .src);
269:                }
270:
271:                // Deal with an indirect source that has been specified
272:                if (this .srcKey == null) {
273:                    JspException e = new JspException(messages
274:                            .getMessage("imgTag.src"));
275:
276:                    TagUtils.getInstance().saveException(pageContext, e);
277:                    throw e;
278:                }
279:
280:                return TagUtils.getInstance().message(pageContext, getBundle(),
281:                        getLocale(), this.srcKey);
282:            }
283:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.