Follow us on GitHub

com.google.gwt.maps.client.mvc
Class MVCArray<T extends JavaScriptObject>

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.maps.client.mvc.MVCObject<T>
          extended by com.google.gwt.maps.client.mvc.MVCArray<T>

public class MVCArray<T extends JavaScriptObject>
extends MVCObject<T>

This class extends MVCObject.

See MVCArray API Doc


Constructor Summary
protected MVCArray()
          This class extends MVCObject.
 
Method Summary
 HandlerRegistration addInsertAtHandler(InsertAtMapHandler handler)
          This event is fired when insertAt() is called.
 HandlerRegistration addRemoveAtHandler(RemoveAtMapHandler handler)
          This event is fired when removeAt() is called.
 HandlerRegistration addSetAtHandler(SetAtMapHandler handler)
          This event is fired when setAt() is called.
 void clear()
          Removes all elements from the array.
 void forEach(MVCArrayCallback<T> callback)
          Iterate over each element, calling the provided callback.
 T get(int index)
          Get an element at the specified index.
 JsArray<T> getArray()
          Returns a reference to the underlying Array.
 int getLength()
          Returns the number of elements in this array.
 void insertAt(int index, T element)
          Inserts an element at the specified index.
static
<T extends JavaScriptObject>
MVCArray<T>
newInstance()
          A mutable MVC Array.
static
<T extends JavaScriptObject>
MVCArray<T>
newInstance(JsArray<T> array)
          A mutable MVC Array.
static
<T extends JavaScriptObject>
MVCArray<T>
newInstance(T... array)
          A mutable MVC Array.
 T pop()
          Removes the last element of the array and returns that element.
 int push(T element)
          Adds one element to the end of the array and returns the new length of the array.
 T removeAt(int index)
          Removes an element from the specified index.
 void setAt(int index, T element)
          Sets an element at the specified index.
 
Methods inherited from class com.google.gwt.maps.client.mvc.MVCObject
bindTo, bindTo, bindTo, changed, createInstanceOfMVCObject, get, notify, set, setValues, unbind, unbindAll
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MVCArray

protected MVCArray()
This class extends MVCObject. use newInstance();

Method Detail

newInstance

public static final <T extends JavaScriptObject> MVCArray<T> newInstance()
A mutable MVC Array.


newInstance

public static final <T extends JavaScriptObject> MVCArray<T> newInstance(JsArray<T> array)
A mutable MVC Array.

Parameters:
array -

newInstance

public static final <T extends JavaScriptObject> MVCArray<T> newInstance(T... array)
A mutable MVC Array.

Parameters:
array - one ore more objects (like T[] or T)

clear

public final void clear()
Removes all elements from the array.


forEach

public final void forEach(MVCArrayCallback<T> callback)
Iterate over each element, calling the provided callback. The callback is called for each element like: callback(element, index).

Parameters:
callback -

getArray

public final JsArray<T> getArray()
Returns a reference to the underlying Array. Warning: if the Array is mutated, no events will be fired by this object.


get

public final T get(int index)
Get an element at the specified index.

Parameters:
index -

getLength

public final int getLength()
Returns the number of elements in this array.


insertAt

public final void insertAt(int index,
                           T element)
Inserts an element at the specified index.

Parameters:
index -
element -

pop

public final T pop()
Removes the last element of the array and returns that element.

Returns:
the element that was popped

push

public final int push(T element)
Adds one element to the end of the array and returns the new length of the array.

Parameters:
element -
Returns:
length of array

removeAt

public final T removeAt(int index)
Removes an element from the specified index.

Parameters:
index -

setAt

public final void setAt(int index,
                        T element)
Sets an element at the specified index.

Parameters:
index -
element -

addInsertAtHandler

public final HandlerRegistration addInsertAtHandler(InsertAtMapHandler handler)
This event is fired when insertAt() is called. The event passes the index that was passed to insertAt().

Parameters:
handler -

addRemoveAtHandler

public final HandlerRegistration addRemoveAtHandler(RemoveAtMapHandler handler)
This event is fired when removeAt() is called. The event passes the index that was passed to removeAt() and the element that was removed from the array.

Parameters:
handler -

addSetAtHandler

public final HandlerRegistration addSetAtHandler(SetAtMapHandler handler)
This event is fired when setAt() is called. The event passes the index that was passed to setAt() and the element that was previously in the array at that index.

Parameters:
handler -


Follow us on GitHub

Copyright © 2011-2012 Gone Vertical LLC. All Rights Reserved.