|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zul.AbstractListModel<Map.Entry<K,V>>
org.zkoss.zul.ListModelMap<K,V>
public class ListModelMap<K,V>
This is the ListModel as a Map to be used with Listbox.
Add or remove the contents of this model as a List would cause the associated Listbox to change accordingly.
ListModel,
ListModelList,
ListModelMap,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected Map<K,V> |
_map
|
| Fields inherited from class org.zkoss.zul.AbstractListModel |
|---|
_selection |
| Constructor Summary | |
|---|---|
ListModelMap()
Constructor. |
|
ListModelMap(int initialCapacity)
Constructor. |
|
ListModelMap(int initialCapacity,
float loadFactor)
Constructor. |
|
ListModelMap(Map<? extends K,? extends V> map)
Constructor. |
|
ListModelMap(Map<K,V> map,
boolean live)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addSelection(Map.Entry<K,V> obj)
Deprecated. As of release 6.0.0, replaced with AbstractListModel.addToSelection(E). |
void |
clear()
|
Object |
clone()
|
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
boolean |
equals(Object o)
|
protected void |
fireSelectionEvent(Map.Entry<K,V> e)
Selectable's implementor use only. |
V |
get(Object key)
|
Map.Entry<K,V> |
getElementAt(int j)
Returns the entry (Map.Entry) at the specified index. |
Map<K,V> |
getInnerMap()
Get the inner real Map. |
int |
getSize()
Returns the length of the list. |
String |
getSortDirection(Comparator<Map.Entry<K,V>> cmpr)
Returns the sort direction of this model for the given comparator. |
int |
hashCode()
|
int |
indexOf(Object o)
Returns the index of the specified object based on the entry (Map.Entry). |
int |
indexOfKey(Object o)
Returns the index of the specified object based on the key. |
boolean |
isEmpty()
|
Set<K> |
keySet()
|
V |
put(K key,
V o)
|
void |
putAll(Map<? extends K,? extends V> c)
|
protected void |
readSelection(ObjectInputStream s)
Reads back AbstractListModel._selection. |
V |
remove(Object key)
|
void |
removeSelection(Object obj)
Deprecated. As of release 6.0.0, replaced with AbstractListModel.removeFromSelection(java.lang.Object). |
int |
size()
|
void |
sort(Comparator<Map.Entry<K,V>> cmpr,
boolean ascending)
Sorts the data. |
String |
toString()
|
Collection<V> |
values()
|
protected void |
writeSelection(ObjectOutputStream s)
Writes AbstractListModel._selection. |
| Methods inherited from class org.zkoss.zul.AbstractListModel |
|---|
addListDataListener, addToSelection, clearSelection, fireEvent, getSelection, isMultiple, isSelected, isSelectionEmpty, newEmptySelection, removeAllSelection, removeFromSelection, removeListDataListener, retainAllSelection, setMultiple, setSelection |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Map<K,V> _map
| Constructor Detail |
|---|
public ListModelMap(Map<K,V> map,
boolean live)
map - the map to representlive - whether to have a 'live' ListModel on top of
the specified map.
If false, the content of the specified map is copied.
If true, this object is a 'facade' of the specified map,
i.e., when you add or remove items from this ListModelMap,
the inner "live" map would be changed accordingly.
However, it is not a good idea to modify map
if it is passed to this method with live is true,
since Listbox is not smart enough to handle it.
Instead, modify it thru this object.public ListModelMap()
public ListModelMap(Map<? extends K,? extends V> map)
Notice that if the data is static or not shared, it is better to
use ListModelMap(map, true) instead, since
making a copy is slower.
public ListModelMap(int initialCapacity)
initialCapacity - the initial capacity for this ListModelMap.
public ListModelMap(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity for this ListModelMap.loadFactor - the loadFactor to increase capacity of this ListModelMap.| Method Detail |
|---|
public Map<K,V> getInnerMap()
public int getSize()
ListModel
getSize in interface ListModel<Map.Entry<K,V>>public Map.Entry<K,V> getElementAt(int j)
getElementAt in interface ListModel<Map.Entry<K,V>>public void clear()
clear in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>public boolean equals(Object o)
equals in interface Map<K,V>equals in class Objectpublic String toString()
toString in class Objectpublic V get(Object key)
get in interface Map<K,V>public int hashCode()
hashCode in interface Map<K,V>hashCode in class Objectpublic boolean isEmpty()
isEmpty in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>
public V put(K key,
V o)
put in interface Map<K,V>public int indexOfKey(Object o)
o - the key to look forpublic int indexOf(Object o)
o - the object to look for. It must be an instance of Map.Entry.public void putAll(Map<? extends K,? extends V> c)
putAll in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public int size()
size in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>
public void sort(Comparator<Map.Entry<K,V>> cmpr,
boolean ascending)
sort in interface Sortable<Map.Entry<K,V>>cmpr - the comparator.ascending - whether to sort in the ascending order.
It is ignored since this implementation uses cmpr to compare.public String getSortDirection(Comparator<Map.Entry<K,V>> cmpr)
SortableDefault: "natural".
getSortDirection in interface Sortable<Map.Entry<K,V>>public Object clone()
clone in class AbstractListModel<Map.Entry<K,V>>protected void fireSelectionEvent(Map.Entry<K,V> e)
AbstractListModel Fires a selection event for component to scroll into view. The override
subclass must put the index0 of AbstractListModel.fireEvent(int, int, int) as
the view index to scroll. By default, the value -1 is assumed which means
no scroll into view.
The method is invoked when both methods are invoked. AbstractListModel.addToSelection(Object)
and AbstractListModel.setSelection(Collection).
fireSelectionEvent in class AbstractListModel<Map.Entry<K,V>>e - selected object.public void addSelection(Map.Entry<K,V> obj)
AbstractListModel.addToSelection(E).
public void removeSelection(Object obj)
AbstractListModel.removeFromSelection(java.lang.Object).
protected void writeSelection(ObjectOutputStream s)
throws IOException
AbstractListModelAbstractListModel._selection.
Default: write it directly. Override it if E is not serializable.
writeSelection in class AbstractListModel<Map.Entry<K,V>>IOException
protected void readSelection(ObjectInputStream s)
throws IOException,
ClassNotFoundException
AbstractListModelAbstractListModel._selection.
Default: write it directly. Override it if E is not serializable.
readSelection in class AbstractListModel<Map.Entry<K,V>>IOException
ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||