Source Code Cross Referenced for HtmlPasswordEdit.java in  » J2EE » Sofia » com » salmonllc » 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 » J2EE » Sofia » com.salmonllc.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.salmonllc.html;
002:
003:        /////////////////////////
004:        //$Archive: /SOFIA/SourceCode/com/salmonllc/html/HtmlPasswordEdit.java $
005:        //$Author: Dan $
006:        //$Revision: 22 $
007:        //$Modtime: 10/28/03 1:22p $
008:        /////////////////////////
009:
010:        import java.util.Hashtable;
011:
012:        import com.salmonllc.html.events.ValueChangedEvent;
013:        import com.salmonllc.properties.Props;
014:
015:        /**
016:         * This class is used for password style text input in a page.
017:         */
018:        public class HtmlPasswordEdit extends HtmlFormComponent {
019:            private String _fontTagStart;
020:            private String _fontTagEnd;
021:            private int _maxLength = 20;
022:            private int _size = 10;
023:            private Boolean _readOnly;
024:            private Integer _tabIndex;
025:            private String _accessKey;
026:
027:            /**
028:             * Constructs a new HTMLPasswordEdit component.
029:             * @param name The name of the component
030:             * @param p The page the component will be placed in.
031:             */
032:            public HtmlPasswordEdit(String name, com.salmonllc.html.HtmlPage p) {
033:                this (name, null, p);
034:            }
035:
036:            /**
037:             * Constructs a new HTMLPasswordEdit component.
038:             * @param name The name of the component
039:             * @param theme The theme to use for loading properties.
040:             * @param p The page the component will be placed in.
041:             */
042:            public HtmlPasswordEdit(String name, String theme,
043:                    com.salmonllc.html.HtmlPage p) {
044:                super (name, theme, p);
045:            }
046:
047:            public void generateHTML(java.io.PrintWriter p, int rowNo)
048:                    throws Exception {
049:                if (!_visible)
050:                    return;
051:
052:                String name = getFullName();
053:                if (rowNo > -1)
054:                    name += "_" + rowNo;
055:
056:                String tag = "<INPUT TYPE=\"PASSWORD\" NAME=\"" + name + "\"";
057:
058:                if (!getEnabled()) {
059:                    if (useDisabledAttribute())
060:                        tag += " DISABLED=\"true\"";
061:                    else {
062:                        String value = getValue(rowNo, true);
063:                        String out = "";
064:                        if (value == null)
065:                            value = "";
066:                        int n = value.length();
067:                        while (n-- > 0)
068:                            out += "*";
069:                        n = _size - value.length();
070:                        while (n-- > 0)
071:                            out += "&nbsp;";
072:                        if ((value.length() == 0) && (_size <= 0))
073:                            out = "&nbsp;";
074:                        if (_disabledFontStartTag != null)
075:                            p.print(_disabledFontStartTag + out
076:                                    + _disabledFontEndTag);
077:                        else
078:                            p.print(out);
079:                        return;
080:                    }
081:                }
082:
083:                if (_maxLength > -1)
084:                    tag += " MAXLENGTH=\"" + _maxLength + "\"";
085:
086:                if (_size > -1) {
087:                    int size = _size;
088:                    if (getPage().getBrowserType() == HtmlPage.BROWSER_NETSCAPE
089:                            && getPage().getBrowserVersion() == 4)
090:                        size = (int) (size * .60);
091:                    tag += " SIZE=\"" + size + "\"";
092:                }
093:
094:                String value = getValue(rowNo, true);
095:
096:                if (value != null)
097:                    tag += " VALUE=\"" + value + "\"";
098:
099:                if (_class != null)
100:                    tag += " class=\"" + _class + "\"";
101:
102:                if (_tabIndex != null)
103:                    tag += " tabindex=\"" + _tabIndex + "\"";
104:
105:                if (_accessKey != null)
106:                    tag += " accesskey=\"" + _accessKey + "\"";
107:
108:                if (_readOnly != null)
109:                    tag += " readonly=\"" + _readOnly + "\"";
110:
111:                tag += ">";
112:
113:                if (_fontTagStart != null)
114:                    tag = _fontTagStart + tag + _fontTagEnd;
115:
116:                p.println(tag);
117:                writeFocusScript(p, rowNo);
118:            }
119:
120:            /**
121:             * This method gets the end font tag for the component.
122:             */
123:            public String getFontEndTag() {
124:                return _fontTagEnd;
125:            }
126:
127:            /**
128:             * This method gets the start font tag for the component.
129:             */
130:            public String getFontStartTag() {
131:                return _fontTagStart;
132:            }
133:
134:            /**
135:             * This method gets the maximum length for the text in the component.
136:             */
137:            public int getMaxLength() {
138:                return _maxLength;
139:            }
140:
141:            /**
142:             * This method gets the display size for the component in characters.
143:             */
144:            public int getSize() {
145:                return _size;
146:            }
147:
148:            public boolean processParms(Hashtable parms, int rowNo)
149:                    throws Exception {
150:                if (!getEnabled())
151:                    return false;
152:                Object oldValue = _value;
153:
154:                String name = getFullName();
155:                if (rowNo > -1) {
156:                    name += "_" + rowNo;
157:                    if (_dsBuff != null)
158:                        oldValue = _dsBuff.getAny(rowNo, _dsColNo);
159:                } else {
160:                    if (_dsBuff != null)
161:                        oldValue = _dsBuff.getAny(_dsColNo);
162:                }
163:
164:                String val[] = (String[]) parms.get(name);
165:
166:                if (val != null) {
167:                    _value = val[0].trim();
168:                    if (_value.equals(""))
169:                        _value = null;
170:                } else
171:                    _value = null;
172:
173:                if (!valuesEqual(oldValue, _value)) {
174:                    String s = null;
175:                    if (oldValue != null)
176:                        s = oldValue.toString();
177:                    ValueChangedEvent e = new ValueChangedEvent(getPage(),
178:                            this , getName(), getFullName(), s, _value, rowNo,
179:                            _dsColNo, _dsBuff);
180:                    addEvent(e);
181:                }
182:
183:                return false;
184:
185:            }
186:
187:            /**
188:             * This method sets the end font tag for the component.
189:             */
190:            public void setFontEndTag(String value) {
191:                _fontTagEnd = value;
192:            }
193:
194:            /**
195:             * This method sets the start font tag for the component.
196:             */
197:            public void setFontStartTag(String value) {
198:                _fontTagStart = value;
199:            }
200:
201:            /**
202:             * This method sets the maximum length for the text in the component.
203:             */
204:            public void setMaxLength(int maxLength) {
205:                _maxLength = maxLength;
206:            }
207:
208:            /**
209:             * This method sets the display size for the component in characters.
210:             */
211:            public void setSize(int size) {
212:                _size = size;
213:            }
214:
215:            /**
216:             * This method sets the property theme for the component.
217:             * @param theme The theme to use.
218:             */
219:            public void setTheme(String theme) {
220:
221:                super .setTheme(theme);
222:                Props props = getPage().getPageProperties();
223:                _fontTagStart = props.getThemeProperty(theme,
224:                        Props.FONT_TEXT_EDIT + Props.TAG_START);
225:                _fontTagEnd = props.getThemeProperty(theme,
226:                        Props.FONT_TEXT_EDIT + Props.TAG_END);
227:
228:            }
229:
230:            /**
231:             * @returns the access key html attribute
232:             */
233:            public String getAccessKey() {
234:                return _accessKey;
235:            }
236:
237:            /**
238:             * @returns the read only html attribute
239:             */
240:            public boolean getReadOnly() {
241:                if (_readOnly == null)
242:                    return false;
243:                return _readOnly.booleanValue();
244:            }
245:
246:            /**
247:             * @returns the tab index html attribute
248:             */
249:            public int getTabIndex() {
250:                if (_tabIndex == null)
251:                    return -1;
252:                return _tabIndex.intValue();
253:            }
254:
255:            /**
256:             * @param sets the access key html attribute
257:             */
258:            public void setAccessKey(String string) {
259:                _accessKey = string;
260:            }
261:
262:            /**
263:             * @param sets the read only html attribute
264:             */
265:            public void setReadOnly(boolean val) {
266:                if (val == false)
267:                    _readOnly = null;
268:                else
269:                    _readOnly = Boolean.TRUE;
270:            }
271:
272:            /**
273:             * @param sets the tab index html attribute. You can also pass TAB_INDEX_DEFAULT to use the default tab index for the component or TAB_INDEX_NONE to keep this component from being tabbed to
274:             */
275:            public void setTabIndex(int val) {
276:                if (val == -1)
277:                    _tabIndex = null;
278:                else
279:                    _tabIndex = new Integer(val);
280:            }
281:
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.