KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > apache > html > dom > HTMLInputElementImpl


1 /*
2  * The Apache Software License, Version 1.1
3  *
4  *
5  * Copyright (c) 1999,2000 The Apache Software Foundation. All rights
6  * reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Apache Software Foundation (http://www.apache.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Xerces" and "Apache Software Foundation" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact apache@apache.org.
31  *
32  * 5. Products derived from this software may not be called "Apache",
33  * nor may "Apache" appear in their name, without prior written
34  * permission of the Apache Software Foundation.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47  * SUCH DAMAGE.
48  * ====================================================================
49  *
50  * This software consists of voluntary contributions made by many
51  * individuals on behalf of the Apache Software Foundation and was
52  * originally based on software copyright (c) 1999, International
53  * Business Machines, Inc., http://www.apache.org. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  */

57 package org.enhydra.apache.html.dom;
58
59
60 import org.enhydra.apache.xerces.dom.ElementImpl;
61 import org.w3c.dom.html.HTMLInputElement;
62
63
64 /**
65  * @version $Revision: 1.2 $ $Date: 2005/01/26 08:28:44 $
66  * @author <a HREF="mailto:arkin@exoffice.com">Assaf Arkin</a>
67  * @see org.w3c.dom.html.HTMLInputElement
68  * @see ElementImpl
69  */

70 public class HTMLInputElementImpl
71     extends HTMLElementImpl
72     implements HTMLInputElement, HTMLFormControl
73 {
74     
75     
76     public String JavaDoc getDefaultValue()
77     {
78         // ! NOT FULLY IMPLEMENTED !
79
return getAttribute( "defaultValue" );
80     }
81     
82     
83     public void setDefaultValue( String JavaDoc defaultValue )
84     {
85         // ! NOT FULLY IMPLEMENTED !
86
setAttribute( "defaultValue", defaultValue );
87     }
88     
89     
90     public boolean getDefaultChecked()
91     {
92         // ! NOT FULLY IMPLEMENTED !
93
return getBinary( "defaultChecked" );
94     }
95     
96     
97     public void setDefaultChecked( boolean defaultChecked )
98     {
99         // ! NOT FULLY IMPLEMENTED !
100
setAttribute( "defaultChecked", defaultChecked );
101     }
102   
103     
104     public String JavaDoc getAccept()
105     {
106         return getAttribute( "accept" );
107     }
108     
109     
110     public void setAccept( String JavaDoc accept )
111     {
112         setAttribute( "accept", accept );
113     }
114     
115     
116     public String JavaDoc getAccessKey()
117     {
118         String JavaDoc accessKey;
119         
120         // Make sure that the access key is a single character.
121
accessKey = getAttribute( "accesskey" );
122         if ( accessKey != null && accessKey.length() > 1 )
123             accessKey = accessKey.substring( 0, 1 );
124         return accessKey;
125     }
126     
127     
128     public void setAccessKey( String JavaDoc accessKey )
129     {
130         // Make sure that the access key is a single character.
131
if ( accessKey != null && accessKey.length() > 1 )
132             accessKey = accessKey.substring( 0, 1 );
133         setAttribute( "accesskey", accessKey );
134     }
135     
136     
137     public String JavaDoc getAlign()
138     {
139         return capitalize( getAttribute( "align" ) );
140     }
141     
142     
143     public void setAlign( String JavaDoc align )
144     {
145         setAttribute( "align", align );
146     }
147     
148     
149     public String JavaDoc getAlt()
150     {
151         return getAttribute( "alt" );
152     }
153     
154     
155     public void setAlt( String JavaDoc alt )
156     {
157         setAttribute( "alt", alt );
158     }
159     
160     
161     public boolean getChecked()
162     {
163         return getBinary( "checked" );
164     }
165     
166     
167     public void setChecked( boolean checked )
168     {
169         setAttribute( "checked", checked );
170     }
171   
172     
173     public boolean getDisabled()
174     {
175         return getBinary( "disabled" );
176     }
177     
178     
179     public void setDisabled( boolean disabled )
180     {
181         setAttribute( "disabled", disabled );
182     }
183     
184     
185     public int getMaxLength()
186     {
187         return getInteger( getAttribute( "maxlength" ) );
188     }
189     
190     
191     public void setMaxLength( int maxLength )
192     {
193         setAttribute( "maxlength", String.valueOf( maxLength ) );
194     }
195     
196     
197     public String JavaDoc getName()
198     {
199         return getAttribute( "name" );
200     }
201     
202     
203     public void setName( String JavaDoc name )
204     {
205         setAttribute( "name", name );
206     }
207     
208     
209     public boolean getReadOnly()
210     {
211         return getBinary( "readonly" );
212     }
213     
214     
215     public void setReadOnly( boolean readOnly )
216     {
217         setAttribute( "readonly", readOnly );
218     }
219     
220     
221     public String JavaDoc getSize()
222     {
223         return getAttribute( "size" );
224     }
225     
226     
227     public void setSize( String JavaDoc size )
228     {
229         setAttribute( "size", size );
230     }
231     
232     
233     public String JavaDoc getSrc()
234     {
235         return getAttribute( "src" );
236     }
237     
238     
239     public void setSrc( String JavaDoc src )
240     {
241         setAttribute( "src", src );
242     }
243     
244     
245       public int getTabIndex()
246     {
247         try
248         {
249             return Integer.parseInt( getAttribute( "tabindex" ) );
250         }
251         catch ( NumberFormatException JavaDoc except )
252         {
253             return 0;
254         }
255     }
256     
257     
258     public void setTabIndex( int tabIndex )
259     {
260         setAttribute( "tabindex", String.valueOf( tabIndex ) );
261     }
262
263   
264     public String JavaDoc getType()
265     {
266         return getAttribute( "type" );
267     }
268     
269     
270     public String JavaDoc getUseMap()
271     {
272         return getAttribute( "useMap" );
273     }
274     
275     
276     public void setUseMap( String JavaDoc useMap )
277     {
278         setAttribute( "useMap", useMap );
279     }
280     
281     
282     public String JavaDoc getValue()
283     {
284         return getAttribute( "value" );
285     }
286     
287     
288     public void setValue( String JavaDoc value )
289     {
290         setAttribute( "value", value );
291     }
292     
293     
294     public void blur()
295     {
296         // No scripting in server-side DOM. This method is moot.
297
}
298     
299     
300     public void focus()
301     {
302         // No scripting in server-side DOM. This method is moot.
303
}
304     
305     
306     public void select()
307     {
308         // No scripting in server-side DOM. This method is moot.
309
}
310     
311     
312     public void click()
313     {
314         // No scripting in server-side DOM. This method is moot.
315
}
316
317   
318     /**
319      * Constructor requires owner document.
320      *
321      * @param owner The owner HTML document
322      */

323     public HTMLInputElementImpl( HTMLDocumentImpl owner, String JavaDoc name )
324     {
325         super( owner, name );
326     }
327
328
329 }
330
331
332
Popular Tags