|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.javascript.ScriptableObject
com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
com.gargoylesoftware.htmlunit.javascript.HTMLOptionsCollection
public class HTMLOptionsCollection
This is the array returned by the "options" property of Select.
Field Summary |
---|
Fields inherited from class org.mozilla.javascript.ScriptableObject |
---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
Fields inherited from interface org.mozilla.javascript.Scriptable |
---|
NOT_FOUND |
Constructor Summary | |
---|---|
HTMLOptionsCollection()
Create an instance. |
|
HTMLOptionsCollection(SimpleScriptable parentScope)
Create an instance |
Method Summary | |
---|---|
java.lang.Object |
get(int index,
org.mozilla.javascript.Scriptable start)
Return the object at the specified index. |
java.lang.Object |
getWithFallback(java.lang.String name)
If IE is emulated, this method delegates the call to the parent select. |
void |
initialize(HtmlSelect select)
Initialize this object |
void |
jsxFunction_add(java.lang.Object newOptionObject,
java.lang.Object newIndex)
Add a new item to the option collection Implementation Note: The specification for the JavaScript add() method actually calls for the optional newIndex parameter to be an integer. |
java.lang.Object |
jsxFunction_item(int index)
Return the object at the specified index. |
int |
jsxGet_length()
Return the number of elements in this array |
void |
jsxSet_length(int newLength)
Change the number of options: removes options if the new length is less than the current one else add new empty options to reach the new length. |
void |
put(int index,
org.mozilla.javascript.Scriptable start,
java.lang.Object newValue)
Set the index property |
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable |
---|
get, getBooleanArg, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getHtmlElementOrDie, getHtmlElementOrNull, getIntArg, getObjectArg, getStringArg, makeScriptableFor, setDomNode, setHtmlElement |
Methods inherited from class org.mozilla.javascript.ScriptableObject |
---|
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mozilla.javascript.Scriptable |
---|
delete, delete, get, getClassName, getDefaultValue, getIds, getParentScope, getPrototype, has, has, hasInstance, put, setParentScope, setPrototype |
Constructor Detail |
---|
public HTMLOptionsCollection()
public HTMLOptionsCollection(SimpleScriptable parentScope)
parentScope
- parent scopeMethod Detail |
---|
public java.lang.Object get(int index, org.mozilla.javascript.Scriptable start)
Return the object at the specified index.
get
in interface org.mozilla.javascript.Scriptable
get
in class org.mozilla.javascript.ScriptableObject
index
- The indexstart
- The object that get is being called on.
public java.lang.Object getWithFallback(java.lang.String name)
getWithFallback
in interface ScriptableWithFallbackGetter
name
- The name of the object to return.
public void initialize(HtmlSelect select)
select
- The HtmlSelect that this object will retrieve elements from.public void jsxFunction_add(java.lang.Object newOptionObject, java.lang.Object newIndex)
Implementation Note: The specification for the JavaScript add() method actually calls for the optional newIndex parameter to be an integer. However, the newIndex parameter is specified as an Object here rather than an int because of the way Rhino and HtmlUnit process optional parameters for the JavaScript method calls. If the newIndex parameter were specified as an int, then the Undefined value for an integer is specified as NaN (Not A Number, which is a Double value), but Rhino translates this value into 0 (perhaps correctly?) when converting NaN into an int. As a result, when the newIndex parameter is not specified, it is impossible to make a distinction between a caller of the form add(someObject) and add (someObject, 0). Since the behavior of these two call forms is different, the newIndex parameter is specified as an Object. If the newIndex parameter is not specified by the actual JavaScript code being run, then newIndex is of type org.mozilla.javascript.Undefined. If the newIndex parameter is specified, then it should be of type java.lang.Number and can be converted into an integer value.
This method will call the put(int, org.mozilla.javascript.Scriptable, java.lang.Object)
method for actually adding the element to the
collection.
According to the Microsoft DHTML reference page for the JavaScript add() method of the options collection, the index parameter is specified as follows:
newOptionObject
- The DomNode to insert in the collectionnewIndex
- An optional parameter which specifies the index position in the
collection where the element is placed. If no value is given, the method places
the element at the end of the collection.put(int, org.mozilla.javascript.Scriptable, java.lang.Object)
public java.lang.Object jsxFunction_item(int index)
Return the object at the specified index.
index
- The index
public int jsxGet_length()
Return the number of elements in this array
public void jsxSet_length(int newLength)
newLength
- The new length property valuepublic void put(int index, org.mozilla.javascript.Scriptable start, java.lang.Object newValue)
put
in interface org.mozilla.javascript.Scriptable
put
in class org.mozilla.javascript.ScriptableObject
index
- The indexstart
- The scriptable object that was originally invoked for this propertynewValue
- The new value
|
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |