| java.lang.Object org.zkoss.zul.AbstractListModel org.zkoss.zul.SimpleListModel
SimpleListModel | public SimpleListModel(Object[] data, boolean live)(Code) | | Constructor.
Parameters: data - the array to represent Parameters: live - whether to have a 'live' ListModel on top ofthe 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. since: 2.4.1 |
SimpleListModel | public SimpleListModel(Object[] data)(Code) | | Constructor.
It made a copy of the specified array (data ).
|
SimpleListModel | public SimpleListModel(List data)(Code) | | Constructor.
since: 2.4.1 |
getSize | public int getSize()(Code) | | |
getSubModel | public ListModel getSubModel(Object value, int nRows)(Code) | | Returns the subset of the list model data that matches
the specified value.
It is ususally used for implmentation of auto-complete.
The implementation uses
SimpleListModel.objectToString to convert
the returned object of
SimpleListModel.getElementAt 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.
Parameters: value - the value to retrieve the subset of the list model.It is converted to a string first by use of SimpleListModel.objectToString.Then, it is used to check if an element starts with (aka., prefix with)this string. since: 3.0.2 |
objectToString | protected String objectToString(Object value)(Code) | | Returns the string from the value object. It is used to convert
the object type to the string type for
SimpleListModel.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.
Parameters: value - the value object. since: 3.0.2 |
sort | public void sort(Comparator cmpr, boolean ascending)(Code) | | Sorts the data.
Parameters: cmpr - the comparator. Parameters: ascending - whether to sort in the ascending order.It is ignored since this implementation uses cmprt to compare. |
|
|