org.zkoss.zkdemo.test2.grid
Class FakeListModel

java.lang.Object
  extended by org.zkoss.zul.AbstractListModel
      extended by org.zkoss.zkdemo.test2.grid.FakeListModel
All Implemented Interfaces:
java.io.Serializable, ListModel, ListModelExt

public class FakeListModel
extends AbstractListModel
implements ListModelExt

Author:
Jeff
See Also:
Serialized Form

Constructor Summary
FakeListModel()
           
FakeListModel(int size)
           
 
Method Summary
 java.lang.Object getElementAt(int v)
          Returns the value at the specified index.
 int getSize()
          Returns the length of the list.
 void invalidate()
           
 void setSize(int size)
           
 void sort(java.util.Comparator cmpr, boolean asc)
          It called when Listbox or Grid has to sort the content.
 
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

FakeListModel

public FakeListModel()

FakeListModel

public FakeListModel(int size)
Method Detail

sort

public void sort(java.util.Comparator cmpr,
                 boolean asc)
Description copied from interface: ListModelExt
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.

Specified by:
sort in interface ListModelExt
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.
asc - whether to sort in the ascending order (or in the descending order)

invalidate

public void invalidate()

getElementAt

public java.lang.Object getElementAt(int v)
Description copied from interface: ListModel
Returns the value at the specified index.

Specified by:
getElementAt in interface ListModel

getSize

public int getSize()
Description copied from interface: ListModel
Returns the length of the list.

Specified by:
getSize in interface ListModel

setSize

public void setSize(int size)


Copyright © 2005-2009 Potix Corporation. All Rights Reserved.