org.zkoss.zul
Interface ListModelExt

All Known Implementing Classes:
BindingListModelArray, BindingListModelList, BindingListModelMap, BindingListModelSet, ListModelArray, ListModelList, ListModelMap, ListModelSet, SimpleListModel

public interface ListModelExt

An extra interface that can be implemented with ListModel to control the sorting of the data model.

Author:
tomyeh

Method Summary
 void sort(java.util.Comparator cmpr, boolean ascending)
          It called when Listbox or Grid has to sort the content.
 

Method Detail

sort

void sort(java.util.Comparator cmpr,
          boolean ascending)
It called when Listbox or Grid has to sort the content.

After sorting, this model shall notify the instances of ListDataListener (registered thru ListModel.addListDataListener(org.zkoss.zul.event.ListDataListener)) to update the content. Typically you have to notify with

new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, -1, -1)
to denote all data are changed (and reloading is required).

The comparator assigned to, say, Listheader.setSortAscending(java.util.Comparator) is passed to method as the cmpr argument. Thus, developers could use it as a tag to know which column or what kind of order to sort.

Parameters:
cmpr - the comparator assigned to Listheader.setSortAscending(java.util.Comparator) and other relative methods. If developers didn't assign any one, the default comparator is used.
ascending - whether to sort in the ascending order (or in the descending order)


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo