KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom > html > HTMLInputElementImpl


1 /**
2  * org/ozone-db/xml/dom/html/HTMLInputElementImpl.java
3  *
4  * The contents of this file are subject to the OpenXML Public
5  * License Version 1.0; you may not use this file except in compliance
6  * with the License. You may obtain a copy of the License at
7  * http://www.openxml.org/license.html
8  *
9  * THIS SOFTWARE IS DISTRIBUTED ON AN "AS IS" BASIS WITHOUT WARRANTY
10  * OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE INITIAL DEVELOPER
11  * AND ALL CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES AS A
12  * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
13  * DERIVATIVES. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
14  * RIGHTS AND LIMITATIONS UNDER THE LICENSE.
15  *
16  * The Initial Developer of this code under the License is Assaf Arkin.
17  * Portions created by Assaf Arkin are Copyright (C) 1998, 1999.
18  * All Rights Reserved.
19  */

20
21
22 package org.ozoneDB.xml.dom.html;
23
24
25 import org.ozoneDB.xml.dom.ElementImpl;
26 import org.w3c.dom.html.HTMLInputElement;
27
28
29 /**
30  * @version $Revision: 1.2 $ $Date: 2003/11/20 23:18:42 $
31  * @author <a HREF="mailto:arkin@trendline.co.il">Assaf Arkin</a>
32  * @see org.w3c.dom.html.HTMLInputElement
33  * @see ElementImpl
34  */

35 public final class HTMLInputElementImpl extends HTMLElementImpl implements HTMLInputElement, HTMLFormControl {
36
37
38     public String JavaDoc getDefaultValue() {
39         // ! NOT FULLY IMPLEMENTED !
40
return getAttribute( "defaultValue" );
41     }
42
43
44     public void setDefaultValue( String JavaDoc defaultValue ) {
45         // ! NOT FULLY IMPLEMENTED !
46
setAttribute( "defaultValue", defaultValue );
47     }
48
49
50     public boolean getDefaultChecked() {
51         // ! NOT FULLY IMPLEMENTED !
52
return getAttribute( "defaultChecked" ) != null;
53     }
54
55
56     public void setDefaultChecked( boolean defaultChecked ) {
57         // ! NOT FULLY IMPLEMENTED !
58
setAttribute( "defaultChecked", defaultChecked ? "" : null );
59     }
60
61
62     public String JavaDoc getAccept() {
63         return getAttribute( "accept" );
64     }
65
66
67     public void setAccept( String JavaDoc accept ) {
68         setAttribute( "accept", accept );
69     }
70
71
72     public String JavaDoc getAccessKey() {
73         String JavaDoc accessKey;
74
75         // Make sure that the access key is a single character.
76
accessKey = getAttribute( "accesskey" );
77         if (accessKey != null && accessKey.length() > 1) {
78             accessKey = accessKey.substring( 0, 1 );
79         }
80         return accessKey;
81     }
82
83
84     public void setAccessKey( String JavaDoc accessKey ) {
85         // Make sure that the access key is a single character.
86
if (accessKey != null && accessKey.length() > 1) {
87             accessKey = accessKey.substring( 0, 1 );
88         }
89         setAttribute( "accesskey", accessKey );
90     }
91
92
93     public String JavaDoc getAlign() {
94         return capitalize( getAttribute( "align" ) );
95     }
96
97
98     public void setAlign( String JavaDoc align ) {
99         setAttribute( "align", align );
100     }
101
102
103     public String JavaDoc getAlt() {
104         return getAttribute( "alt" );
105     }
106
107
108     public void setAlt( String JavaDoc alt ) {
109         setAttribute( "alt", alt );
110     }
111
112
113     public boolean getChecked() {
114         return getAttribute( "checked" ) != null;
115     }
116
117
118     public void setChecked( boolean checked ) {
119         setAttribute( "checked", checked ? "" : null );
120     }
121
122
123     public boolean getDisabled() {
124         return getAttribute( "disabled" ) != null;
125     }
126
127
128     public void setDisabled( boolean disabled ) {
129         setAttribute( "disabled", disabled ? "" : null );
130     }
131
132
133     public int getMaxLength() {
134         return toInteger( getAttribute( "maxlength" ) );
135     }
136
137
138     public void setMaxLength( int maxLength ) {
139         setAttribute( "maxlength", String.valueOf( maxLength ) );
140     }
141
142
143     public String JavaDoc getName() {
144         return getAttribute( "name" );
145     }
146
147
148     public void setName( String JavaDoc name ) {
149         setAttribute( "name", name );
150     }
151
152
153     public boolean getReadOnly() {
154         return getAttribute( "readonly" ) != null;
155     }
156
157
158     public void setReadOnly( boolean readOnly ) {
159         setAttribute( "readonly", readOnly ? "" : null );
160     }
161
162
163     public String JavaDoc getSize() {
164         return getAttribute( "size" );
165     }
166
167
168     public void setSize( String JavaDoc size ) {
169         setAttribute( "size", size );
170     }
171
172
173     public String JavaDoc getSrc() {
174         return getAttribute( "src" );
175     }
176
177
178     public void setSrc( String JavaDoc src ) {
179         setAttribute( "src", src );
180     }
181
182
183     public int getTabIndex() {
184         try {
185             return Integer.parseInt( getAttribute( "tabindex" ) );
186         } catch (NumberFormatException JavaDoc except) {
187             return 0;
188         }
189     }
190
191
192     public void setTabIndex( int tabIndex ) {
193         setAttribute( "tabindex", String.valueOf( tabIndex ) );
194     }
195
196
197     public String JavaDoc getType() {
198         return getAttribute( "type" );
199     }
200
201
202     public String JavaDoc getUseMap() {
203         return getAttribute( "useMap" );
204     }
205
206
207     public void setUseMap( String JavaDoc useMap ) {
208         setAttribute( "useMap", useMap );
209     }
210
211
212     public String JavaDoc getValue() {
213         return getAttribute( "value" );
214     }
215
216
217     public void setValue( String JavaDoc value ) {
218         setAttribute( "value", value );
219     }
220
221
222     public void blur() {
223     // No scripting in server-side DOM. This method is moot.
224
}
225
226
227     public void focus() {
228     // No scripting in server-side DOM. This method is moot.
229
}
230
231
232     public void select() {
233     // No scripting in server-side DOM. This method is moot.
234
}
235
236
237     public void click() {
238     // No scripting in server-side DOM. This method is moot.
239
}
240
241
242     /**
243      * Constructor requires owner document.
244      *
245      * @param owner The owner HTML document
246      */

247     public HTMLInputElementImpl( HTMLDocumentImpl owner, String JavaDoc name ) {
248         super( owner, "INPUT" );
249     }
250
251
252 }
253
Popular Tags