KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > w3c > dom > html2 > HTMLSelectElement


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21 /*
22  * Copyright (c) 2003 World Wide Web Consortium,
23  * (Massachusetts Institute of Technology, Institut National de
24  * Recherche en Informatique et en Automatique, Keio University). All
25  * Rights Reserved. This program is distributed under the W3C's Software
26  * Intellectual Property License. This program is distributed in the
27  * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
28  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
29  * PURPOSE.
30  * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
31  */

32
33 package org.w3c.dom.html2;
34
35 import org.w3c.dom.DOMException JavaDoc;
36
37 /**
38  * The select element allows the selection of an option. The contained options
39  * can be directly accessed through the select element as a collection. See
40  * the SELECT element definition in HTML 4.01.
41  * <p>See also the <a HREF='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>Document Object Model (DOM) Level 2 HTML Specification</a>.
42  */

43 public interface HTMLSelectElement extends HTMLElement {
44     /**
45      * The type of this form control. This is the string "select-multiple"
46      * when the multiple attribute is <code>true</code> and the string
47      * "select-one" when <code>false</code>.
48      */

49     public String JavaDoc getType();
50
51     /**
52      * The ordinal index of the selected option, starting from 0. The value -1
53      * is returned if no element is selected. If multiple options are
54      * selected, the index of the first selected option is returned.
55      */

56     public int getSelectedIndex();
57     /**
58      * The ordinal index of the selected option, starting from 0. The value -1
59      * is returned if no element is selected. If multiple options are
60      * selected, the index of the first selected option is returned.
61      */

62     public void setSelectedIndex(int selectedIndex);
63
64     /**
65      * The current form control value (i.e. the value of the currently
66      * selected option), if multiple options are selected this is the value
67      * of the first selected option.
68      */

69     public String JavaDoc getValue();
70     /**
71      * The current form control value (i.e. the value of the currently
72      * selected option), if multiple options are selected this is the value
73      * of the first selected option.
74      */

75     public void setValue(String JavaDoc value);
76
77     /**
78      * The number of options in this <code>SELECT</code>.
79      * @version DOM Level 2
80      */

81     public int getLength();
82     /**
83      * The number of options in this <code>SELECT</code>.
84      * @exception DOMException
85      * NOT_SUPPORTED_ERR: if setting the length is not allowed by the
86      * implementation.
87      * @version DOM Level 2
88      */

89     public void setLength(int length)
90                       throws DOMException JavaDoc;
91
92     /**
93      * Returns the <code>FORM</code> element containing this control. Returns
94      * <code>null</code> if this control is not within the context of a
95      * form.
96      */

97     public HTMLFormElement getForm();
98
99     /**
100      * The collection of <code>OPTION</code> elements contained by this
101      * element.
102      * @version DOM Level 2
103      */

104     public HTMLOptionsCollection getOptions();
105
106     /**
107      * The control is unavailable in this context. See the disabled attribute
108      * definition in HTML 4.01.
109      */

110     public boolean getDisabled();
111     /**
112      * The control is unavailable in this context. See the disabled attribute
113      * definition in HTML 4.01.
114      */

115     public void setDisabled(boolean disabled);
116
117     /**
118      * If true, multiple <code>OPTION</code> elements may be selected in this
119      * <code>SELECT</code>. See the multiple attribute definition in HTML
120      * 4.01.
121      */

122     public boolean getMultiple();
123     /**
124      * If true, multiple <code>OPTION</code> elements may be selected in this
125      * <code>SELECT</code>. See the multiple attribute definition in HTML
126      * 4.01.
127      */

128     public void setMultiple(boolean multiple);
129
130     /**
131      * Form control or object name when submitted with a form. See the name
132      * attribute definition in HTML 4.01.
133      */

134     public String JavaDoc getName();
135     /**
136      * Form control or object name when submitted with a form. See the name
137      * attribute definition in HTML 4.01.
138      */

139     public void setName(String JavaDoc name);
140
141     /**
142      * Number of visible rows. See the size attribute definition in HTML 4.01.
143      */

144     public int getSize();
145     /**
146      * Number of visible rows. See the size attribute definition in HTML 4.01.
147      */

148     public void setSize(int size);
149
150     /**
151      * Index that represents the element's position in the tabbing order. See
152      * the tabindex attribute definition in HTML 4.01.
153      */

154     public int getTabIndex();
155     /**
156      * Index that represents the element's position in the tabbing order. See
157      * the tabindex attribute definition in HTML 4.01.
158      */

159     public void setTabIndex(int tabIndex);
160
161     /**
162      * Add a new element to the collection of <code>OPTION</code> elements for
163      * this <code>SELECT</code>. This method is the equivalent of the
164      * <code>appendChild</code> method of the <code>Node</code> interface if
165      * the <code>before</code> parameter is <code>null</code>. It is
166      * equivalent to the <code>insertBefore</code> method on the parent of
167      * <code>before</code> in all other cases. This method may have no
168      * effect if the new element is not an <code>OPTION</code> or an
169      * <code>OPTGROUP</code>.
170      * @param element The element to add.
171      * @param before The element to insert before, or <code>null</code> for
172      * the tail of the list.
173      * @exception DOMException
174      * NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
175      * the <code>SELECT</code> element.
176      */

177     public void add(HTMLElement element,
178                     HTMLElement before)
179                     throws DOMException JavaDoc;
180
181     /**
182      * Remove an element from the collection of <code>OPTION</code> elements
183      * for this <code>SELECT</code>. Does nothing if no element has the
184      * given index.
185      * @param index The index of the item to remove, starting from 0.
186      */

187     public void remove(int index);
188
189     /**
190      * Removes keyboard focus from this element.
191      */

192     public void blur();
193
194     /**
195      * Gives keyboard focus to this element.
196      */

197     public void focus();
198
199 }
200
Popular Tags