org.zkoss.gmaps
Class MapModelSet

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

public class MapModelSet
extends AbstractMapModel
implements java.util.Set, java.io.Serializable

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

Since:
2.0_9
Author:
Henri Chen
See Also:
MapModel, MapModelList, MapModelMap, Serialized Form

Field Summary
protected  java.util.Set _set
           
 
Constructor Summary
MapModelSet()
          Constructor.
MapModelSet(java.util.Collection c)
          Constructor.
MapModelSet(int initialCapacity)
          Constructor.
MapModelSet(int initialCapacity, float loadFactor)
          Constructor.
MapModelSet(java.lang.Object[] array)
          Constructor.
MapModelSet(java.util.Set set, boolean live)
          Constructor
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(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.util.Set getInnerSet()
          Get the inner real set.
 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()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 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

_set

protected java.util.Set _set
Constructor Detail

MapModelSet

public MapModelSet(java.util.Set set,
                   boolean live)
Constructor

Parameters:
set - the set for initial entry in Set
live - whether to have a 'live' MapModel on top of the specified set. If false, the content of the specified set is copied. If true, this object is a 'facade' of the specified set, i.e., when you add or remove items from this MapModelSet, the inner "live" set would be changed accordingly. However, it is not a good idea to modify set if it is passed to this method with live is true, since Maps component is not smart enough to handle it. Instead, modify it thru this object.

MapModelSet

public MapModelSet()
Constructor.


MapModelSet

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


MapModelSet

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


MapModelSet

public MapModelSet(int initialCapacity)
Constructor.

Parameters:
initialCapacity - the initial capacity for this MapModelSet.

MapModelSet

public MapModelSet(int initialCapacity,
                   float loadFactor)
Constructor.

Parameters:
initialCapacity - the initial capacity for this MapModelSet.
loadFactor - the loadFactor to increase capacity of this MapModelSet.
Method Detail

getInnerSet

public java.util.Set getInnerSet()
Get the inner real set.


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 boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set

addAll

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

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.Set
Specified by:
clear in interface MapModel

contains

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

containsAll

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

equals

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

hashCode

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

isEmpty

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

toString

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

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.Set

remove

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

removeAll

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

retainAll

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

size

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

toArray

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

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.Set


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