KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > lazydom > html > 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.xml.lazydom.html;
58 import org.enhydra.xml.lazydom.LazyElement;
59 import org.enhydra.xml.lazydom.LazyElementNoNS;
60 import org.w3c.dom.html.HTMLInputElement;
61
62
63 /**
64  * @version $Revision: 1.2 $ $Date: 2005/01/26 08:29:24 $
65  * @author <a HREF="mailto:arkin@exoffice.com">Assaf Arkin</a>
66  * @see org.w3c.dom.html.HTMLInputElement
67  * @see LazyElementNoNS
68  */

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

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