01: /* ListModelExt.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Fri Mar 30 16:40:50 2007, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2007 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.zul;
20:
21: import java.util.Comparator;
22:
23: /**
24: * An extra interface that can be implemented with {@link ListModel}
25: * to control the sorting of the listbox.
26: *
27: * @author tomyeh
28: */
29: public interface ListModelExt {
30: /** It called when {@link Listbox} or {@link Grid} has to sort
31: * the content.
32: *
33: * <p>After sorting, this model shall notify the instances of
34: * {@link org.zkoss.zul.event.ListDataListener} (registered thru {@link ListModel#addListDataListener})
35: * to update the content.
36: * Typically you have to notify with
37: * <pre><code>new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, -1, -1)</code></pre>
38: * to denote all data are changed (and reloading is required).
39: *
40: * <p>The comparator assigned to, say, {@link Listheader#setSortAscending}
41: * is passed to method as the cmpr argument.
42: * Thus, developers could use it as a tag to know which column
43: * or what kind of order to sort.
44: *
45: * @param cmpr the comparator assigned to {@link Listheader#setSortAscending}
46: * and other relative methods. If developers didn't assign any one,
47: * the default comparator is used.
48: * @param ascending whether to sort in the ascending order (or in
49: * the descending order)
50: */
51: public void sort(Comparator cmpr, boolean ascending);
52: }
|