org.zkoss.zkplus.databind
Interface BindingListModelExt<E>

All Superinterfaces:
BindingListModel<E>, ListModel<E>
All Known Implementing Classes:
BindingListModelArray, BindingListModelList, BindingListModelListModel, BindingListModelMap, BindingListModelSet

public interface BindingListModelExt<E>
extends BindingListModel<E>

Support same object in multiple items of a ListModel.

To speed up performance, DataBinder used to find only the first item of a given bean (see BindingListModel.indexOf(java.lang.Object)). However, in some cases, there might be one object in multiple items which will cause "unexpected" results of data binding (i.e. While one change should cause multiple items to be updated in Grid, we saw only one item is updated.). Therefore, since version 3.1, we now support a "distinct" annotation that you can specify in model attribute of collection components (i.e. Grid, Listbox, Combobox, etc.). So the data binder knows how to handle your ListModel. The default value for "distinct" is true so the Data Binder behaves as usual. If you specify distinct=false, the Data Binder will scan the whole ListModel to find all items that matches and thus will be some performance issue if processing a big ListModel.

Example:


 <grid model="@{persons,distinct=false}">
    ...
 </grid>
 

Since:
3.5.0
Author:
henrichen

Method Summary
 int[] indexesOf(java.lang.Object obj)
          Returns indexes of the given object inside a ListModel.
 boolean isDistinct()
          Returns true if all objects inside this ListModel is distinct.
 
Methods inherited from interface org.zkoss.zkplus.databind.BindingListModel
indexOf
 
Methods inherited from interface org.zkoss.zul.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
 

Method Detail

indexesOf

int[] indexesOf(java.lang.Object obj)
Returns indexes of the given object inside a ListModel.

Parameters:
obj - the specified object
Returns:
indexes that contains the given object; return empty array if none found.

isDistinct

boolean isDistinct()
Returns true if all objects inside this ListModel is distinct. This is for DataBinder performance so there is no need to scan the whole ListModel as long as find one.

Returns:
true if all objects inside this ListModel is distinct; otherwise, return false.
Since:
3.5.0


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