|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zul.AbstractListModel<java.util.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 FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
protected java.util.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(java.util.Map<? extends K,? extends V> map)
Constructor. |
|
ListModelMap(java.util.Map<K,V> map,
boolean live)
Constructor. |
Method Summary | |
---|---|
void |
addSelection(java.util.Map.Entry<K,V> obj)
Deprecated. As of release 6.0.0, replaced with AbstractListModel.addToSelection(E) . |
void |
clear()
|
java.lang.Object |
clone()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object value)
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
boolean |
equals(java.lang.Object o)
|
protected void |
fireSelectionEvent(java.util.Map.Entry<K,V> e)
Selectable's implementor use only. |
V |
get(java.lang.Object key)
|
java.util.Map.Entry<K,V> |
getElementAt(int j)
Returns the entry (Map.Entry) at the specified index. |
java.util.Map<K,V> |
getInnerMap()
Get the inner real Map. |
int |
getSize()
Returns the length of the list. |
java.lang.String |
getSortDirection(java.util.Comparator<java.util.Map.Entry<K,V>> cmpr)
Returns the sort direction of this model for the given comparator. |
int |
hashCode()
|
int |
indexOf(java.lang.Object o)
Returns the index of the specified object based on the entry (Map.Entry). |
int |
indexOfKey(java.lang.Object o)
Returns the index of the specified object based on the key. |
boolean |
isEmpty()
|
java.util.Set<K> |
keySet()
|
V |
put(K key,
V o)
|
void |
putAll(java.util.Map<? extends K,? extends V> c)
|
protected void |
readSelection(java.io.ObjectInputStream s)
Reads back AbstractListModel._selection . |
V |
remove(java.lang.Object key)
|
void |
removeSelection(java.lang.Object obj)
Deprecated. As of release 6.0.0, replaced with AbstractListModel.removeFromSelection(java.lang.Object) . |
int |
size()
|
void |
sort(java.util.Comparator<java.util.Map.Entry<K,V>> cmpr,
boolean ascending)
Sorts the data. |
java.lang.String |
toString()
|
java.util.Collection<V> |
values()
|
protected void |
writeSelection(java.io.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 java.util.Map<K,V> _map
Constructor Detail |
---|
public ListModelMap(java.util.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(java.util.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 java.util.Map<K,V> getInnerMap()
public int getSize()
ListModel
getSize
in interface ListModel<java.util.Map.Entry<K,V>>
public java.util.Map.Entry<K,V> getElementAt(int j)
getElementAt
in interface ListModel<java.util.Map.Entry<K,V>>
public void clear()
clear
in interface java.util.Map<K,V>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
public boolean equals(java.lang.Object o)
equals
in interface java.util.Map<K,V>
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
public int hashCode()
hashCode
in interface java.util.Map<K,V>
hashCode
in class java.lang.Object
public boolean isEmpty()
isEmpty
in interface java.util.Map<K,V>
public java.util.Set<K> keySet()
keySet
in interface java.util.Map<K,V>
public V put(K key, V o)
put
in interface java.util.Map<K,V>
public int indexOfKey(java.lang.Object o)
o
- the key to look forpublic int indexOf(java.lang.Object o)
o
- the object to look for. It must be an instance of Map.Entry.public void putAll(java.util.Map<? extends K,? extends V> c)
putAll
in interface java.util.Map<K,V>
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
public int size()
size
in interface java.util.Map<K,V>
public java.util.Collection<V> values()
values
in interface java.util.Map<K,V>
public void sort(java.util.Comparator<java.util.Map.Entry<K,V>> cmpr, boolean ascending)
sort
in interface Sortable<java.util.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 java.lang.String getSortDirection(java.util.Comparator<java.util.Map.Entry<K,V>> cmpr)
Sortable
Default: "natural".
getSortDirection
in interface Sortable<java.util.Map.Entry<K,V>>
public java.lang.Object clone()
clone
in class AbstractListModel<java.util.Map.Entry<K,V>>
protected void fireSelectionEvent(java.util.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<java.util.Map.Entry<K,V>>
e
- selected object.public void addSelection(java.util.Map.Entry<K,V> obj)
AbstractListModel.addToSelection(E)
.
public void removeSelection(java.lang.Object obj)
AbstractListModel.removeFromSelection(java.lang.Object)
.
protected void writeSelection(java.io.ObjectOutputStream s) throws java.io.IOException
AbstractListModel
AbstractListModel._selection
.
Default: write it directly. Override it if E is not serializable.
writeSelection
in class AbstractListModel<java.util.Map.Entry<K,V>>
java.io.IOException
protected void readSelection(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
AbstractListModel
AbstractListModel._selection
.
Default: write it directly. Override it if E is not serializable.
readSelection
in class AbstractListModel<java.util.Map.Entry<K,V>>
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |