Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* BindingListModelArray.java
 
 {{IS_NOTE
 	Purpose:
 		
 	Description:
 		
 	History:
 		Mon Feb 26 17:37:25     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.ListModelArray;

This is the BindingListModel as a Object array to be used with org.zkoss.zul.Listbox, org.zkoss.zul.Grid, and DataBinder. Modify the contents of this model as an Object array 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.ListModelArray
public class BindingListModelArray extends ListModelArray
	private static final long serialVersionUID = 200808191515L;
	private boolean _distinct = true//since 3.5; default to true

Since:
3.5.0
	public BindingListModelArray(Object[] cboolean liveboolean distinct) {
		super(clive);
		 = distinct;
	}

Since:
3.0.5
	public BindingListModelArray(Object[] cboolean live) {
		super(clive);
	}
	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();
			for(int j = 0; j < _array.length; ++j) {
				if (Objects.equals(elm, _array[j])) {
					indexes.add(new Integer(j));
				}
			}
			final int[] result = new int[indexes.size()];
			int 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