|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.zul.AbstractListModel<E>
org.zkoss.zul.ListModelArray<E>
public class ListModelArray<E>
This is the ListModel
as an Object array to be used with Listbox
.
Change the contents of this model as an Object array would cause the associated Listbox to
change accordingly.
ListModel
,
ListModelList
,
ListModelMap
,
Serialized FormField Summary | |
---|---|
protected Object[] |
_array
|
Constructor Summary | |
---|---|
ListModelArray(E[] src)
Constructor. |
|
ListModelArray(E[] array,
boolean live)
Constructor |
|
ListModelArray(int size)
Constructor. |
|
ListModelArray(List<? extends E> list)
Constructor. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
E |
get(int index)
Get the value of this ListModelArray at specified index. |
E |
getElementAt(int j)
Returns the value at the specified index. |
Object[] |
getInnerArray()
Get the inner real Object[]. |
int |
getSize()
Returns the length of the list. |
int |
hashCode()
|
int |
indexOf(Object elm)
Returns the index of the specified element. |
void |
set(int index,
E value)
Change content of the Array at specified index. |
void |
sort(Comparator<E> cmpr,
boolean ascending)
Sorts the data. |
String |
toString()
|
Methods inherited from class org.zkoss.zul.AbstractListModel |
---|
addListDataListener, addSelection, clearSelection, fireEvent, getSelection, removeAllSelection, removeListDataListener, removeSelection, retainAllSelection |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Object[] _array
Constructor Detail |
---|
public ListModelArray(E[] array, boolean live)
array
- the array to representlive
- whether to have a 'live' ListModel
on top of
the specified array.
If false, the content of the specified array is copied.
If true, this object is a 'facade' of the specified array,
i.e., when you add or remove items from this ListModelArray
,
the inner "live" array would be changed accordingly.
However, it is not a good idea to modify array
if it is passed to this method with live is true,
since Listbox
is not smart enough to hanle it.
Instead, modify it thru this object.public ListModelArray(E[] src)
src
- the source array used to initialize this ListModelArray.public ListModelArray(int size)
size
- the array size.public ListModelArray(List<? extends E> list)
Method Detail |
---|
public E get(int index)
index
- the array index to be get value.public void set(int index, E value)
index
- the array index to be set the new value.public Object[] getInnerArray()
public int indexOf(Object elm)
public int getSize()
ListModel
getSize
in interface ListModel<E>
public E getElementAt(int j)
ListModel
getElementAt
in interface ListModel<E>
public void sort(Comparator<E> cmpr, boolean ascending)
sort
in interface Sortable<E>
cmpr
- the comparator.ascending
- whether to sort in the ascending order.
It is ignored since this implementation uses cmprt to compare.public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |