|
||||||||||
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.
The class implements the Selectable
interface, updating
the selection status after sorted. (since 6.0.0)
ListModel
,
ListModelList
,
ListModelMap
,
Serialized FormField Summary | |
---|---|
protected java.lang.Object[] |
_array
|
Fields inherited from class org.zkoss.zul.AbstractListModel |
---|
_selection |
Constructor Summary | |
---|---|
ListModelArray(E[] array)
Constructor. |
|
ListModelArray(E[] array,
boolean live)
Constructor |
|
ListModelArray(int size)
Constructor. |
|
ListModelArray(java.util.List<? extends E> list)
Constructor. |
Method Summary | |
---|---|
void |
addSelection(E obj)
Deprecated. As of release 6.0.0, replaced with AbstractListModel.addToSelection(E) . |
java.lang.Object |
clone()
|
boolean |
equals(java.lang.Object o)
|
protected void |
fireSelectionEvent(E e)
Selectable's implementor use only. |
E |
get(int index)
Get the value of this ListModelArray at specified index. |
E |
getElementAt(int j)
Returns the value at the specified index. |
java.lang.Object[] |
getInnerArray()
Get the inner real Object[]. |
int |
getSize()
Returns the length of the list. |
java.lang.String |
getSortDirection(java.util.Comparator<E> cmpr)
Returns the sort direction of this model for the given comparator. |
int |
hashCode()
|
int |
indexOf(java.lang.Object elm)
Returns the index of the specified element. |
void |
removeSelection(java.lang.Object obj)
Deprecated. As of release 6.0.0, replaced with AbstractListModel.removeFromSelection(java.lang.Object) . |
void |
set(int index,
E value)
Change content of the Array at specified index. |
void |
sort(java.util.Comparator<E> cmpr,
boolean ascending)
Sorts the data. |
java.lang.String |
toString()
|
Methods inherited from class org.zkoss.zul.AbstractListModel |
---|
addListDataListener, addToSelection, clearSelection, fireEvent, getSelection, isMultiple, isSelected, isSelectionEmpty, newEmptySelection, readSelection, removeAllSelection, removeFromSelection, removeListDataListener, retainAllSelection, setMultiple, setSelection, writeSelection |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.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[] array)
Notice that if the data is static or not shared, it is better to
use ListModelArray(array, true)
instead, since
making a copy is slower.
public ListModelArray(int size)
size
- the array size.public ListModelArray(java.util.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 java.lang.Object[] getInnerArray()
public int indexOf(java.lang.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(java.util.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 java.lang.String getSortDirection(java.util.Comparator<E> cmpr)
Sortable
Default: "natural".
getSortDirection
in interface Sortable<E>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class AbstractListModel<E>
protected void fireSelectionEvent(E 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<E>
e
- selected object.public void addSelection(E obj)
AbstractListModel.addToSelection(E)
.
public void removeSelection(java.lang.Object obj)
AbstractListModel.removeFromSelection(java.lang.Object)
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |