Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: gnu/xml/dom/html2/DomHTMLInputElement.java


1   /* DomHTMLInputElement.java -- 
2      Copyright (C) 2005 Free Software Foundation, Inc.
3   
4   This file is part of GNU Classpath.
5   
6   GNU Classpath is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10  
11  GNU Classpath is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  General Public License for more details.
15  
16  You should have received a copy of the GNU General Public License
17  along with GNU Classpath; see the file COPYING.  If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301 USA.
20  
21  Linking this library statically or dynamically with other modules is
22  making a combined work based on this library.  Thus, the terms and
23  conditions of the GNU General Public License cover the whole
24  combination.
25  
26  As a special exception, the copyright holders of this library give you
27  permission to link this library with independent modules to produce an
28  executable, regardless of the license terms of these independent
29  modules, and to copy and distribute the resulting executable under
30  terms of your choice, provided that you also meet, for each linked
31  independent module, the terms and conditions of the license of that
32  module.  An independent module is a module which is not derived from
33  or based on this library.  If you modify this library, you may extend
34  this exception to your version of the library, but you are not
35  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */
37  
38  package gnu.xml.dom.html2;
39  
40  import org.w3c.dom.html2.HTMLFormElement;
41  import org.w3c.dom.html2.HTMLInputElement;
42  
43  /**
44   * An HTML 'INPUT' element node.
45   *
46   * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
47   */
48  public class DomHTMLInputElement
49    extends DomHTMLElement
50    implements HTMLInputElement
51  {
52  
53    protected String value;
54    protected Boolean checked;
55  
56    protected DomHTMLInputElement(DomHTMLDocument owner, String namespaceURI,
57                                  String name)
58    {
59      super(owner, namespaceURI, name);
60    }
61  
62    public String getDefaultValue()
63    {
64      return getHTMLAttribute("value");
65    }
66  
67    public void setDefaultValue(String defaultValue)
68    {
69      setHTMLAttribute("value", defaultValue);
70    }
71    
72    public boolean getDefaultChecked()
73    {
74      return getBooleanHTMLAttribute("checked");
75    }
76  
77    public void setDefaultChecked(boolean defaultChecked)
78    {
79      setBooleanHTMLAttribute("checked", defaultChecked);
80    }
81  
82    public HTMLFormElement getForm()
83    {
84      return (HTMLFormElement) getParentElement("form");
85    }
86    
87    public String getAccept()
88    {
89      return getHTMLAttribute("accept");
90    }
91  
92    public void setAccept(String accept)
93    {
94      setHTMLAttribute("accept", accept);
95    }
96    
97    public String getAccessKey()
98    {
99      return getHTMLAttribute("accesskey");
100   }
101 
102   public void setAccessKey(String accessKey)
103   {
104     setHTMLAttribute("accesskey", accessKey);
105   }
106   
107   public String getAlign()
108   {
109     return getHTMLAttribute("align");
110   }
111 
112   public void setAlign(String align)
113   {
114     setHTMLAttribute("align", align);
115   }
116   
117   public String getAlt()
118   {
119     return getHTMLAttribute("alt");
120   }
121 
122   public void setAlt(String alt)
123   {
124     setHTMLAttribute("alt", alt);
125   }
126   
127   public boolean getChecked()
128   {
129     if (checked == null)
130       {
131         checked = Boolean.valueOf(getDefaultChecked());
132       }
133     return checked.booleanValue();
134   }
135 
136   public void setChecked(boolean checked)
137   {
138     this.checked = Boolean.valueOf(checked);
139   }
140   
141   public boolean getDisabled()
142   {
143     return getBooleanHTMLAttribute("disabled");
144   }
145 
146   public void setDisabled(boolean disabled)
147   {
148     setBooleanHTMLAttribute("disabled", disabled);
149   }
150   
151   public int getMaxLength()
152   {
153     return getIntHTMLAttribute("maxLength");
154   }
155 
156   public void setMaxLength(int maxLength)
157   {
158     setIntHTMLAttribute("maxLength", maxLength);
159   }
160   
161   public String getName()
162   {
163     return getHTMLAttribute("name");
164   }
165 
166   public void setName(String name)
167   {
168     setHTMLAttribute("name", name);
169   }
170   
171   public boolean getReadOnly()
172   {
173     return getBooleanHTMLAttribute("readonly");
174   }
175 
176   public void setReadOnly(boolean readOnly)
177   {
178     setBooleanHTMLAttribute("readonly", readOnly);
179   }
180   
181   public int getSize()
182   {
183     return getIntHTMLAttribute("size");
184   }
185 
186   public void setSize(int size)
187   {
188     setIntHTMLAttribute("size", size);
189   }
190   
191   public String getSrc()
192   {
193     return getHTMLAttribute("src");
194   }
195 
196   public void setSrc(String src)
197   {
198     setHTMLAttribute("src", src);
199   }
200   
201   public int getTabIndex()
202   {
203     return getIntHTMLAttribute("tabindex");
204   }
205 
206   public void setTabIndex(int tabIndex)
207   {
208     setIntHTMLAttribute("tabindex", tabIndex);
209   }
210   
211   public String getType()
212   {
213     return getHTMLAttribute("type");
214   }
215 
216   public void setType(String type)
217   {
218     setHTMLAttribute("type", type);
219   }
220   
221   public String getUseMap()
222   {
223     return getHTMLAttribute("usemap");
224   }
225 
226   public void setUseMap(String useMap)
227   {
228     setHTMLAttribute("usemap", useMap);
229   }
230   
231   public String getValue()
232   {
233     if (value == null)
234       {
235         value = getDefaultValue();
236       }
237     return value;
238   }
239 
240   public void setValue(String value)
241   {
242     this.value = value;
243   }
244 
245   public void blur()
246   {
247     dispatchUIEvent("blur");
248   }
249 
250   public void focus()
251   {
252     dispatchUIEvent("focus");
253   }
254 
255   public void select()
256   {
257     dispatchUIEvent("select");
258   }
259 
260   public void click()
261   {
262     dispatchUIEvent("click");
263   }
264   
265 }
266