Source Code Cross Referenced for InputTag.java in  » Portal » stringbeans-3.5 » com » nabhinc » portlet » mvcportlet » taglib » 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 » Portal » stringbeans 3.5 » com.nabhinc.portlet.mvcportlet.taglib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (C) Copyright 2004 Nabh Information Systems, Inc.
003:         *
004:         * All copyright notices regarding Nabh's products MUST remain
005:         * intact in the scripts and in the outputted HTML.
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1 
009:         * of the License, or (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         *
020:         */
021:        package com.nabhinc.portlet.mvcportlet.taglib;
022:
023:        import java.io.IOException;
024:
025:        import javax.portlet.RenderRequest;
026:        import javax.servlet.jsp.JspException;
027:        import javax.servlet.jsp.JspWriter;
028:
029:        /**
030:         * Input element tag.
031:         *
032:         * @author Padmanabh Dabke
033:         * (c) 2004 Nabh Information Systems, Inc. All Rights Reserved.
034:         */
035:        public class InputTag extends BaseTag {
036:            private int itSize = -1;
037:            private int itMaxlength = -1;
038:            private String itScript = null;
039:            private String itType = "text";
040:            private String itValue = null;
041:            private String itAccept = null;
042:            private String itSrc = null;
043:            private String itAlign = null;
044:            private boolean itChecked = false;
045:
046:            public void release() {
047:                super .release();
048:                itSize = -1;
049:                itMaxlength = -1;
050:                itScript = null;
051:                // Do NOT reset itType since the type is set by the subclasses and
052:                // should be the same when the object gets recycled.
053:                //itType = "text";
054:                itValue = null;
055:                itAccept = null;
056:                itSrc = null;
057:                itAlign = null;
058:                itChecked = false;
059:
060:            }
061:
062:            /**
063:             * The "redisplay contents" flag (used only on <code>password</code>).
064:             */
065:            protected boolean itRedisplay = true;
066:
067:            /**
068:             * Returns the value of the input tag.
069:             * @return
070:             */
071:            public String getValue() {
072:                return itValue;
073:            }
074:
075:            public void setValue(String val) {
076:                itValue = val;
077:            }
078:
079:            /**
080:             * Returns type of input tag. Default type is <code>text</code>
081:             * @return
082:             */
083:            public String getType() {
084:                return itType;
085:            }
086:
087:            /**
088:             * Sets the input's type. Default is <code>text</code>
089:             * @param type The type of the input, i.e. checkbox, radio, hidden, etc.
090:             */
091:            public void setType(String type) {
092:                itType = type;
093:            }
094:
095:            /**
096:             * @return Returns the maxlength allowed for the tag.
097:             */
098:            public int getMaxlength() {
099:                return itMaxlength;
100:            }
101:
102:            /**
103:             * @param maxlength The maximum length to set.
104:             */
105:            public void setMaxlength(int maxLength) {
106:                this .itMaxlength = maxLength;
107:            }
108:
109:            /**
110:             * @return Returns the script.
111:             */
112:            public String getScript() {
113:                return itScript;
114:            }
115:
116:            /**
117:             * @param script The script to set.
118:             */
119:            public void setScript(String script) {
120:                this .itScript = script;
121:            }
122:
123:            /**
124:             * @return Returns the size.
125:             */
126:            public int getSize() {
127:                return itSize;
128:            }
129:
130:            /**
131:             * @param size The size to set.
132:             */
133:            public void setSize(int size) {
134:                this .itSize = size;
135:            }
136:
137:            public boolean getRedisplay() {
138:                return itRedisplay;
139:            }
140:
141:            public void setRedisplay(boolean val) {
142:                itRedisplay = val;
143:            }
144:
145:            public String getAccept() {
146:                return itAccept;
147:            }
148:
149:            public void setAccept(String ac) {
150:                itAccept = ac;
151:            }
152:
153:            public String getSrc() {
154:                return itSrc;
155:            }
156:
157:            public void setSrc(String src) {
158:                itSrc = src;
159:            }
160:
161:            public String getAlign() {
162:                return itAlign;
163:            }
164:
165:            public void setAlign(String al) {
166:                itAlign = al;
167:            }
168:
169:            public boolean getChecked() {
170:                return itChecked;
171:            }
172:
173:            public void setChecked(boolean checked) {
174:                this .itChecked = checked;
175:            }
176:
177:            public int doStartTag() throws JspException {
178:
179:                try {
180:                    RenderRequest request = (RenderRequest) pageContext
181:                            .getRequest().getAttribute("javax.portlet.request");
182:                    JspWriter out = pageContext.getOut();
183:
184:                    // Hidden tag should not be emmitted if the field value is null
185:                    String fieldValue = itValue == null ? getParamValue(request)
186:                            : itValue;
187:                    if (itType.equals("hidden") && fieldValue == null)
188:                        return SKIP_BODY;
189:
190:                    out.print("<input type=\"");
191:                    out.print(itType);
192:                    out.print("\" name=\"");
193:                    out.print(getName());
194:                    out.print("\" ");
195:
196:                    if (itSize > 0) {
197:                        out.print("size=\"");
198:                        out.print(itSize);
199:                        out.print("\" ");
200:                    }
201:
202:                    if (itMaxlength > 0) {
203:                        out.print("maxlength=\"");
204:                        out.print(itMaxlength);
205:                        out.print("\" ");
206:                    }
207:
208:                    if (btAccesskey != null) {
209:                        out.print(" accesskey=\"");
210:                        out.print(btAccesskey);
211:                        out.print("\"");
212:                    }
213:                    if (itAccept != null) {
214:                        out.print(" accept=\"");
215:                        out.print(itAccept);
216:                        out.print("\"");
217:                    }
218:
219:                    if (itSrc != null) {
220:                        out.print(" src=\"");
221:                        out.print(itSrc);
222:                        out.print("\"");
223:                    }
224:
225:                    if (itAlign != null) {
226:                        out.print(" align=\"");
227:                        out.print(itAlign);
228:                        out.print("\"");
229:                    }
230:
231:                    if (itChecked) {
232:                        out.print(" checked=\"checked\" ");
233:                    }
234:
235:                    out.print(prepareEventHandlers());
236:                    out.print(prepareStyles());
237:
238:                    doStartTagHelper(request, out);
239:                    if (itScript != null) {
240:                        out.print(itScript);
241:                        out.print(" ");
242:                    }
243:
244:                    out.print("/>");
245:                } catch (JspException ex) {
246:                    error("Error in rendering InputTag.", ex);
247:                    throw ex;
248:                } catch (Exception ex) {
249:                    error("Error in rendering InputTag.", ex);
250:                    throw new JspException(ex);
251:                }
252:
253:                return SKIP_BODY;
254:            }
255:
256:            public void doStartTagHelper(RenderRequest request, JspWriter out)
257:                    throws JspException, IOException {
258:                String fieldValue = itValue == null ? getParamValue(request)
259:                        : itValue;
260:                if (fieldValue != null) {
261:                    out.print(" value=\"");
262:                    out.print(fieldValue);
263:                    out.print("\" ");
264:                }
265:
266:            }
267:
268:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.