com.gargoylesoftware.htmlunit.javascript.host.html
Class HTMLSelectElement

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Node
              extended by com.gargoylesoftware.htmlunit.javascript.host.EventNode
                  extended by com.gargoylesoftware.htmlunit.javascript.host.Element
                      extended by com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
                          extended by com.gargoylesoftware.htmlunit.javascript.host.FormChild
                              extended by com.gargoylesoftware.htmlunit.javascript.host.FormField
                                  extended by com.gargoylesoftware.htmlunit.javascript.host.html.HTMLSelectElement
All Implemented Interfaces:
ScriptableWithFallbackGetter, Serializable, Cloneable, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class HTMLSelectElement
extends FormField

The JavaScript object for HtmlSelect.

Version:
$Revision: 7582 $
Author:
Mike Bowler, David K. Taylor, Marc Guillemot, Chris Erskine, Ahmed Ashour
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNode
 
Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
BEHAVIOR_ID_CLIENT_CAPS, BEHAVIOR_ID_DOWNLOAD, BEHAVIOR_ID_HOMEPAGE
 
Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
HTMLSelectElement()
          Creates an instance.
 
Method Summary
protected  void add_FF(HTMLOptionElement newOptionObject, Object beforeOptionObject)
          Adds a new item to the list (optionally) before the specified item in Firefox way.
protected  void add_IE(HTMLOptionElement newOptionObject, Object index)
          Adds a new item to the list (optionally) at the specified index in IE way.
 void add(HTMLOptionElement newOptionObject, Object arg2)
          Adds a new item to the list (optionally) before the specified item.
protected  void addBefore(HTMLOptionElement newOptionObject, HtmlOption beforeOption)
          Adds the option (and create the associated DOM node if needed) before the specified one or at the end if the specified one in null.
 Object appendChild(Object childObject)
          Adds a DOM node to the node.
 Object get(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
          Returns the specified indexed property.
 int getLength()
          Returns the value of the "length" property.
 boolean getMultiple()
          Returns true if the multiple attribute is set.
 HTMLOptionsCollection getOptions()
          Returns the value of the "options" property.
 int getSelectedIndex()
          Returns the value of the "selectedIndex" property.
 int getSize()
          Returns the size attribute.
 String getType()
          Returns the type of this input.
 String getValue()
          Returns the actual value of the selected Option.
 void initialize()
          Initialize the object.
 Object insertBeforeImpl(Object[] args)
          Add a DOM node as a child to this node before the referenced node.
 HTMLOptionElement item(int index)
          Gets the item at the specified index.
 void put(int index, net.sourceforge.htmlunit.corejs.javascript.Scriptable start, Object newValue)
          Sets the index property.
 void remove(int index)
          Removes option at the specified index.
 void setLength(int newLength)
          Removes options by reducing the "length" property.
 void setMultiple(boolean multiple)
          Sets or clears the multiple attribute.
 void setSelectedIndex(int index)
          Sets the value of the "selectedIndex" property.
 void setSize(String size)
          Sets the size attribute.
 void setValue(String newValue)
          Selects the option with the specified value.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.FormField
getDisabled, getName, getOnchange, setDisabled, setDomNode, setName, setOnchange
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.FormChild
getForm
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement
addBehavior, addComponentRequest, blur, clearAttributes, clearComponentRequest, click, compareVersions, contains, createEventHandler, createTextRange, dispatchEvent, doComponentRequest, doScroll, fixAttributeName, focus, get, getAccessKey, getAlign, getAll, getAttribute, getAttributeNode, getAttributeNodeNS, getAvailHeight, getAvailWidth, getBoundingClientRect, getBoxObject, getBufferDepth, getCh, getChildren, getChOff, getClassList, getClassName_js, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getColorDepth, getComponentVersion, getConnectionType, getCookieEnabled, getCpuClass, getCurrentStyle, getDir, getDocument, getDomNodeOrDie, getDomNodeOrNull, getElementsByClassName, getFilters, getHeight, getId, getInnerHTML, getInnerText, getJavaEnabled, getLang, getLanguage, getLocalName, getNamespaceURI, getNodeName, getOffsetHeight, getOffsetLeft, getOffsetParent_js, getOffsetTop, getOffsetWidth, getOuterHTML, getParentElement, getParentHTMLElement, getPlatform, getPosX, getPosY, getPrefix, getRuntimeStyle, getScopeName, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getSpellcheck, getStyle, getSystemLanguage, getTabIndex, getTagName, getTagUrn, getTitle, getUniqueID, getUserLanguage, getVAlign, getWidth, getWidthOrHeight, getWithFallback, hasAttribute, insertAdjacentElement, insertAdjacentHTML, isAncestorOfEventTarget, isAttributeName, isComponentInstalled, isHomePage, mergeAttributes, navigateHomePage, parseHtmlSnippet, querySelector, querySelectorAll, readAttributes, removeAttributeNode, removeBehavior, removeExpression, removeNode, scrollIntoView, setAccessKey, setActive, setAlign, setAttribute, setAttributeNode, setCh, setChOff, setClassName, setColorAttribute, setDir, setExpression, setHomePage, setId, setInnerHTML, setInnerText, setLang, setLanguage, setOuterHTML, setScrollLeft, setScrollTop, setSpellcheck, setTabIndex, setTagUrn, setTextContent, setTitle, setVAlign, setWidthOrHeight, startDownload, toString
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Element
createAttributesObject, getAttributeNS, getAttributes, getBaseURI, getChildElementCount, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getLastElementChild, getNextElementSibling, getPreviousElementSibling, getText, hasAttributeNS, removeAttribute, removeAttributeNS, selectNodes, selectSingleNode, setAttributeNS, setDefaults
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode
fireEvent, getOnblur, getOnclick, getOncontextmenu, getOndblclick, getOnerror, getOnfocus, getOnfocusin, getOnfocusout, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnpropertychange, getOnresize, setOnblur, setOnclick, setOncontextmenu, setOndblclick, setOnerror, setOnfocus, setOnfocusin, setOnfocusout, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnpropertychange, setOnresize
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
addEventListener, attachEvent, cloneNode, compareDocumentPosition, detachEvent, executeEvent, fireEvent, fireEvent, getChildNodes, getEventHandler, getEventHandlerProp, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getTextContent, getXml, hasChildNodes, hasEventHandlers, insertBefore, isSameNode, normalize, removeChild, removeEventListener, replaceChild, setEventHandler, setEventHandlerProp, setNodeValue
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype, size
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
delete, delete, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, setParentScope, setPrototype
 

Constructor Detail

HTMLSelectElement

public HTMLSelectElement()
Creates an instance.

Method Detail

initialize

public void initialize()
Initialize the object.


remove

public void remove(int index)
Removes option at the specified index.

Parameters:
index - the index of the item to remove

add

public void add(HTMLOptionElement newOptionObject,
                Object arg2)
Adds a new item to the list (optionally) before the specified item.

Parameters:
newOptionObject - the DomNode to insert
arg2 - for Firefox: the DomNode to insert the previous element before (null if at end), for Internet Explorer: the index where the element should be placed (optional).

appendChild

public Object appendChild(Object childObject)
Adds a DOM node to the node.

Overrides:
appendChild in class Node
Parameters:
childObject - the node to add to this node
Returns:
the newly added child node

insertBeforeImpl

public Object insertBeforeImpl(Object[] args)
Add a DOM node as a child to this node before the referenced node. If the referenced node is null, append to the end.

Overrides:
insertBeforeImpl in class Node
Parameters:
args - the arguments
Returns:
the newly added child node

item

public HTMLOptionElement item(int index)
Gets the item at the specified index.

Parameters:
index - the position of the option to retrieve
Returns:
the option

add_IE

protected void add_IE(HTMLOptionElement newOptionObject,
                      Object index)
Adds a new item to the list (optionally) at the specified index in IE way.

Parameters:
newOptionObject - the DomNode to insert
index - (optional) the index where the node should be inserted

add_FF

protected void add_FF(HTMLOptionElement newOptionObject,
                      Object beforeOptionObject)
Adds a new item to the list (optionally) before the specified item in Firefox way.

Parameters:
newOptionObject - the DomNode to insert
beforeOptionObject - the DomNode to insert the previous element before (null if at end)

addBefore

protected void addBefore(HTMLOptionElement newOptionObject,
                         HtmlOption beforeOption)
Adds the option (and create the associated DOM node if needed) before the specified one or at the end if the specified one in null.

Parameters:
newOptionObject - the new option to add
beforeOption - the option that should be after the option to add

getType

public String getType()
Returns the type of this input.

Overrides:
getType in class FormField
Returns:
the type

getOptions

public HTMLOptionsCollection getOptions()
Returns the value of the "options" property.

Returns:
the options property

getSelectedIndex

public int getSelectedIndex()
Returns the value of the "selectedIndex" property.

Returns:
the selectedIndex property

setSelectedIndex

public void setSelectedIndex(int index)
Sets the value of the "selectedIndex" property.

Parameters:
index - the new value

getValue

public String getValue()
Returns the actual value of the selected Option.

Overrides:
getValue in class FormField
Returns:
the value

getLength

public int getLength()
Returns the value of the "length" property.

Returns:
the length property

setLength

public void setLength(int newLength)
Removes options by reducing the "length" property.

Parameters:
newLength - the new length property value

get

public Object get(int index,
                  net.sourceforge.htmlunit.corejs.javascript.Scriptable start)
Returns the specified indexed property.

Specified by:
get in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
Overrides:
get in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
Parameters:
index - the index of the property
start - the scriptable object that was originally queried for this property
Returns:
the property

put

public void put(int index,
                net.sourceforge.htmlunit.corejs.javascript.Scriptable start,
                Object newValue)
Sets the index property.

Specified by:
put in interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
Overrides:
put in class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
Parameters:
index - the index
start - the scriptable object that was originally invoked for this property
newValue - the new value

setValue

public void setValue(String newValue)
Selects the option with the specified value.

Overrides:
setValue in class FormField
Parameters:
newValue - the value of the option to select

getSize

public int getSize()
Returns the size attribute.

Returns:
the size attribute

setSize

public void setSize(String size)
Sets the size attribute.

Parameters:
size - the size attribute

getMultiple

public boolean getMultiple()
Returns true if the multiple attribute is set.

Returns:
true if the multiple attribute is set

setMultiple

public void setMultiple(boolean multiple)
Sets or clears the multiple attribute.

Parameters:
multiple - true to set the multiple attribute, false to clear it


Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.