org.zkoss.gmaps
Class MapModelList

java.lang.Object
  extended by org.zkoss.gmaps.AbstractMapModel
      extended by org.zkoss.gmaps.MapModelList
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.List, MapModel

public class MapModelList
extends AbstractMapModel
implements java.util.List, java.io.Serializable

This is the MapModel as a List to be used with Maps component such as Gmaps. Add or remove the contents of this model as a List would cause the associated Maps to change accordingly.

Since:
2.0_9
Author:
henrichen
See Also:
MapModel, MapModelSet, MapModelMap, Serialized Form

Field Summary
protected  java.util.List _list
           
 
Constructor Summary
MapModelList()
          Constructor.
MapModelList(java.util.Collection c)
          Constructor.
MapModelList(int initialCapacity)
          Constructor.
MapModelList(java.util.List list, boolean live)
          Constructor
MapModelList(java.lang.Object[] array)
          Constructor.
 
Method Summary
 void add(int index, java.lang.Object element)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(int index, java.util.Collection c)
           
 void clear()
          Clear all items of this model.
 boolean contains(java.lang.Object elem)
           
 boolean containsAll(java.util.Collection c)
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(int index)
           
 java.util.List getInnerList()
          Get the inner real List.
 java.util.Collection getItemsIn(double swlat, double swlng, double nelat, double nelng, double cenlat, double cenlng, int zoom)
          Returns the items in the specified bounds (south-west to north-east), center latitude, center longitude, and zoom level.
 int hashCode()
           
 int indexOf(java.lang.Object elem)
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int lastIndexOf(java.lang.Object elem)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 void removeRange(int fromIndex, int toIndex)
          Remove from fromIndex(inclusive) to toIndex(exclusive).
 boolean retainAll(java.util.Collection c)
           
 java.lang.Object set(int index, java.lang.Object element)
           
 int size()
           
 java.util.List subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class org.zkoss.gmaps.AbstractMapModel
addMapDataListener, fireEvent, removeMapDataListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_list

protected java.util.List _list
Constructor Detail

MapModelList

public MapModelList(java.util.List list,
                    boolean live)
Constructor

Parameters:
list - the list to represent
live - whether to have a 'live' ListModel on top of the specified list. If false, the content of the specified list is copied. If true, this object is a 'facade' of the specified list, i.e., when you add or remove items from this ListModelList, the inner "live" list would be changed accordingly. However, it is not a good idea to modify list if it is passed to this method with live is true, since Gmaps is not smart enough to handle it. Instead, modify it thru this object.

MapModelList

public MapModelList()
Constructor.


MapModelList

public MapModelList(java.util.Collection c)
Constructor. It mades a copy of the specified collection (i.e., not live).


MapModelList

public MapModelList(java.lang.Object[] array)
Constructor. It mades a copy of the specified array (i.e., not live).


MapModelList

public MapModelList(int initialCapacity)
Constructor.

Parameters:
initialCapacity - the initial capacity for this MapModelList.
Method Detail

removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Remove from fromIndex(inclusive) to toIndex(exclusive). If fromIndex equals toIndex, this methods do nothing.

Parameters:
fromIndex - the begin index (inclusive) to be removed.
toIndex - the end index (exclusive) to be removed.

getInnerList

public java.util.List getInnerList()
Get the inner real List.


clear

public void clear()
Description copied from interface: MapModel
Clear all items of this model.

Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List
Specified by:
clear in interface MapModel

getItemsIn

public java.util.Collection getItemsIn(double swlat,
                                       double swlng,
                                       double nelat,
                                       double nelng,
                                       double cenlat,
                                       double cenlng,
                                       int zoom)
Description copied from interface: MapModel
Returns the items in the specified bounds (south-west to north-east), center latitude, center longitude, and zoom level.

Specified by:
getItemsIn in interface MapModel
Parameters:
swlat - south-west latitude
swlng - south-west longitude
nelat - north-east latitude
nelng - north-east longitude
cenlat - center latitude
cenlng - center longitude
zoom - current zoom level
Returns:
the items in the specified bounds (south-west to north-east) center latitude, center longitude, and zoom level.

add

public void add(int index,
                java.lang.Object element)
Specified by:
add in interface java.util.List

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.List

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Specified by:
addAll in interface java.util.List

contains

public boolean contains(java.lang.Object elem)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.List

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.List

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.List
Overrides:
equals in class java.lang.Object

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.List
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

indexOf

public int indexOf(java.lang.Object elem)
Specified by:
indexOf in interface java.util.List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.List

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.List

lastIndexOf

public int lastIndexOf(java.lang.Object elem)
Specified by:
lastIndexOf in interface java.util.List

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List

listIterator

public java.util.ListIterator listIterator(int index)
Specified by:
listIterator in interface java.util.List

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.List

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.List

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.List

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Specified by:
set in interface java.util.List

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Specified by:
subList in interface java.util.List

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.