1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25/*
26 * This file is available under and governed by the GNU General Public
27 * License version 2 only, as published by the Free Software Foundation.
28 * However, the following notice accompanied the original version of this
29 * file and, per its terms, should not be removed:
30 *
31 * Copyright (c) 2000 World Wide Web Consortium,
32 * (Massachusetts Institute of Technology, Institut National de
33 * Recherche en Informatique et en Automatique, Keio University). All
34 * Rights Reserved. This program is distributed under the W3C's Software
35 * Intellectual Property License. This program is distributed in the
36 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
37 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
38 * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
39 * details.
40 */
41
42package org.w3c.dom.html;
43
44import org.w3c.dom.DOMException;
45
46/**
47 *  The select element allows the selection of an option. The contained
48 * options can be directly accessed through the select element as a
49 * collection. See the  SELECT element definition in HTML 4.0.
50 * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
51 *
52 * @since 1.4, DOM Level 2
53 */
54public interface HTMLSelectElement extends HTMLElement {
55    /**
56     *  The type of this form control. This is the string "select-multiple"
57     * when the multiple attribute is <code>true</code> and the string
58     * "select-one" when <code>false</code> .
59     */
60    public String getType();
61
62    /**
63     *  The ordinal index of the selected option, starting from 0. The value
64     * -1 is returned if no element is selected. If multiple options are
65     * selected, the index of the first selected option is returned.
66     */
67    public int getSelectedIndex();
68    public void setSelectedIndex(int selectedIndex);
69
70    /**
71     *  The current form control value.
72     */
73    public String getValue();
74    public void setValue(String value);
75
76    /**
77     *  The number of options in this <code>SELECT</code> .
78     */
79    public int getLength();
80
81    /**
82     *  Returns the <code>FORM</code> element containing this control. Returns
83     * <code>null</code> if this control is not within the context of a form.
84     */
85    public HTMLFormElement getForm();
86
87    /**
88     *  The collection of <code>OPTION</code> elements contained by this
89     * element.
90     */
91    public HTMLCollection getOptions();
92
93    /**
94     *  The control is unavailable in this context. See the  disabled
95     * attribute definition in HTML 4.0.
96     */
97    public boolean getDisabled();
98    public void setDisabled(boolean disabled);
99
100    /**
101     *  If true, multiple <code>OPTION</code> elements may  be selected in
102     * this <code>SELECT</code> . See the  multiple attribute definition in
103     * HTML 4.0.
104     */
105    public boolean getMultiple();
106    public void setMultiple(boolean multiple);
107
108    /**
109     *  Form control or object name when submitted with a form. See the  name
110     * attribute definition in HTML 4.0.
111     */
112    public String getName();
113    public void setName(String name);
114
115    /**
116     *  Number of visible rows. See the  size attribute definition in HTML 4.0.
117     */
118    public int getSize();
119    public void setSize(int size);
120
121    /**
122     *  Index that represents the element's position in the tabbing order. See
123     * the  tabindex attribute definition in HTML 4.0.
124     */
125    public int getTabIndex();
126    public void setTabIndex(int tabIndex);
127
128    /**
129     *  Add a new element to the collection of <code>OPTION</code> elements
130     * for this <code>SELECT</code> . This method is the equivalent of the
131     * <code>appendChild</code> method of the <code>Node</code> interface if
132     * the <code>before</code> parameter is <code>null</code> . It is
133     * equivalent to the <code>insertBefore</code> method on the parent of
134     * <code>before</code> in all other cases.
135     * @param element  The element to add.
136     * @param before  The element to insert before, or <code>null</code> for
137     *   the tail of the list.
138     * @exception DOMException
139     *    NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
140     *   the <code>SELECT</code> element.
141     */
142    public void add(HTMLElement element,
143                    HTMLElement before)
144                    throws DOMException;
145
146    /**
147     *  Remove an element from the collection of <code>OPTION</code> elements
148     * for this <code>SELECT</code> . Does nothing if no element has the given
149     *  index.
150     * @param index  The index of the item to remove, starting from 0.
151     */
152    public void remove(int index);
153
154    /**
155     *  Removes keyboard focus from this element.
156     */
157    public void blur();
158
159    /**
160     *  Gives keyboard focus to this element.
161     */
162    public void focus();
163
164}
165