Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* BindingListModelList.java
 
 {{IS_NOTE
 	Purpose:
 		
 	Description:
 		
 	History:
 		Mon Jan 29 21:07:15     2007, Created by henrichen
}}IS_NOTE
Copyright (C) 2007 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
	This program is distributed under GPL Version 3.0 in the hope that
	it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zkplus.databind;
import  org.zkoss.zul.ListModelList;

This is the BindingListModel as a java.util.List to be used with org.zkoss.zul.Listbox, org.zkoss.zul.Grid, and DataBinder. Add or remove the contents of this model as a List would cause the associated Listbox or Grid to change accordingly.

Make as public class since 3.0.5

Support BindingListModelEx since 3.1

Author(s):
Henri Chen
See also:
BindingListModel
org.zkoss.zul.ListModel
org.zkoss.zul.ListModelList
public class BindingListModelList extends ListModelList
	private static final long serialVersionUID = 200808191518L;
	private boolean _distinct = true//since 3.5; default to true

Since:
3.1
	public BindingListModelList(List listboolean liveboolean distinct) {
		super(listlive);
		 = distinct;
	}

Since:
3.0.5
	public BindingListModelList(List listboolean live) {
		super(listlive);
	}
	public boolean isDistinct() {
		return ;
	}
	public int[] indexesOf(Object elm) {
		if (isDistinct()) {
			final int idx = indexOf(elm);
			return idx < 0 ? new int[0] : new int[] {idx}; 
else {
			final List indexes = new LinkedList();
			int j = 0;
			for(final Iterator it = _list.iterator(); it.hasNext(); ++j) {
				if (Objects.equals(elmit.next())) {
					indexes.add(new Integer(j));
				}
			}
			final int[] result = new int[indexes.size()];
			j = 0;
			for (final Iterator it = indexes.iterator(); it.hasNext(); ++j) {
				final int idx = ((Integerit.next()).intValue();
				result[j] = idx;
			}
			return result;
		}
	}
New to GrepCode? Check out our FAQ X