|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zul.AbstractListModel
org.zkoss.zul.SimpleListModel
public class SimpleListModel
A simple implementation of ListModel.
Note: It assumes the content is immutable. If not, use ListModelList
or ListModelArray nstead.
ListModelArray,
ListModelSet,
ListModelList,
ListModelMap,
(since 3.0.2),
Serialized Form| Constructor Summary | |
|---|---|
SimpleListModel(java.util.List data)
Constructor. |
|
SimpleListModel(java.lang.Object[] data)
Constructor. |
|
SimpleListModel(java.lang.Object[] data,
boolean live)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getElementAt(int j)
Returns the value at the specified index. |
int |
getSize()
Returns the length of the list. |
ListModel |
getSubModel(java.lang.Object value,
int nRows)
Returns the subset of the list model data that matches the specified value. |
protected java.lang.String |
objectToString(java.lang.Object value)
Returns the string from the value object. |
void |
sort(java.util.Comparator cmpr,
boolean ascending)
Sorts the data. |
| Methods inherited from class org.zkoss.zul.AbstractListModel |
|---|
addListDataListener, fireEvent, removeListDataListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleListModel(java.lang.Object[] data,
boolean live)
data - the array to representlive - whether to have a 'live' ListModel on top of
the specified list.
If false, the content of the specified list is copied.
If true, this object is a 'facade' of the specified list,
i.e., when you add or remove items from this ListModelList,
the inner "live" list would be changed accordingly.
However, it is not a good idea to modify data
once it is passed to this method with live is true,
since Listbox is not smart enough to hanle it.public SimpleListModel(java.lang.Object[] data)
data).
public SimpleListModel(java.util.List data)
| Method Detail |
|---|
public int getSize()
ListModel
getSize in interface ListModelpublic java.lang.Object getElementAt(int j)
ListModel
getElementAt in interface ListModel
public void sort(java.util.Comparator cmpr,
boolean ascending)
sort in interface ListModelExtcmpr - the comparator.ascending - whether to sort in the ascending order.
It is ignored since this implementation uses cmprt to compare.
public ListModel getSubModel(java.lang.Object value,
int nRows)
The implementation uses objectToString(java.lang.Object) to convert
the returned object of getElementAt(int) to the string.
And then, an element is considered as 'matched', if the string
starts with the specified value.
Note: If the nRows is a negative number, 10 is assumed.
getSubModel in interface ListSubModelvalue - the value to retrieve the subset of the list model.
It is converted to a string first by use of objectToString(java.lang.Object).
Then, it is used to check if an element starts with (aka., prefix with)
this string.nRows - the number of rows suggested to return (as the
returned ListModel instance). It's a suggestion for developer to
follow.
If nonpositive, it means the maximal allowed rows is decided by the
implementation of ListSubmodel.protected java.lang.String objectToString(java.lang.Object value)
getSubModel(Object, int).
The implementation uses Object.toString() to convert
the value to a string (and to an empty string if null).
If you need better control, you can override this method.
value - the value object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||