java.lang.Object
com.dlsc.gmapsfx.javascript.JavascriptObject
com.dlsc.gmapsfx.javascript.object.MVCArray
public class MVCArray extends JavascriptObject
This javascript object current takes JavascriptObjects as parameters, but
returns JSObjects, as it doesn't know what has been placed within it.
- Author:
- Geoff Capper
-
Field Summary
Fields inherited from class com.dlsc.gmapsfx.javascript.JavascriptObject
jsObject, objectCounter, peerRegistry, runtime, variableName -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidclear()Removes all elements from the array.voidforEach(String func)Iterates over the elements within the array, calling the supplied function for each member.JSObjectgetArray()Returns a JSObject representing the underlying array.JSObjectgetAt(int idx)Returns the item at the specified index in the array.intgetLength()Gets the length of the array.voidinsertAt(int idx, JavascriptObject elem)Inserts the supplied element at the specified index in the array.JSObjectpop()Removes and returns the last element of the arrayintpush(JavascriptObject obj)Adds the supplied element onto the end of the array, then returns the length of the array.voidremoveAt(int idx)Removes and discards the item at the specified index.voidsetAt(int idx, JavascriptObject obj)Sets the supplied object at the supplied index.Methods inherited from class com.dlsc.gmapsfx.javascript.JavascriptObject
checkBoolean, checkInteger, checkUndefined, getJSObject, getNextVariableName, getProperty, getProperty, getVariableName, invokeJavascript, invokeJavascript, invokeJavascriptReturnValue, invokeJavascriptReturnValue, isMemberDefined, setProperty, setProperty, setProperty
-
Constructor Details
-
Method Details
-
clear
public void clear()Removes all elements from the array. -
forEach
Iterates over the elements within the array, calling the supplied function for each member. The parameters to the callback function are: func(element, index)- Parameters:
func-
-
getArray
Returns a JSObject representing the underlying array. Not entirely sure how useful this would be for people.- Returns:
-
getAt
Returns the item at the specified index in the array.- Parameters:
idx- The index of the item to be returned.- Returns:
- The object at the specified index.
-
getLength
public int getLength()Gets the length of the array.- Returns:
-
insertAt
Inserts the supplied element at the specified index in the array.- Parameters:
idx- The index at which to insert the item.elem- The item to be inserted.
-
pop
Removes and returns the last element of the array- Returns:
-
push
Adds the supplied element onto the end of the array, then returns the length of the array.- Parameters:
obj- The Javascript object to be added to the array.- Returns:
- The length of the array after the addition.
-
removeAt
public void removeAt(int idx)Removes and discards the item at the specified index.- Parameters:
idx- The index of the object to be removed.
-
setAt
Sets the supplied object at the supplied index.- Parameters:
idx- The index at which the item should be set.obj- The object to be set at the supplied index.
-