Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* BindingListModelArray.java
 
 	Purpose:
 		
 	Description:
 		
 	History:
 		Mon Feb 26 17:37:25     2007, Created by henrichen
 
Copyright (C) 2007 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
	This program is distributed under LGPL Version 2.1 in the hope that
	it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zkplus.databind;

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

Deprecated:
As of release 7.0.0, replace with new ZK binding.
Author(s):
Henri Chen
See also:
BindingListModel
org.zkoss.zul.ListModel
org.zkoss.zul.ListModelArray
public class BindingListModelArray<E> extends ListModelArray<E>
	private static final long serialVersionUID = 200808191515L;
	private boolean _distinct = true//since 3.5; default to true

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

Since:
3.0.5
	public BindingListModelArray(E[] 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<Integerindexes = new LinkedList<Integer>();
			for(int j = 0; j < .; ++j) {
				if (Objects.equals(elm[j])) {
					indexes.add(new Integer(j));
				}
			}
			final int[] result = new int[indexes.size()];
			int j = 0;
			for (final Iterator<Integerit = indexes.iterator(); it.hasNext(); ++j) {
				final int idx = it.next().intValue();
				result[j] = idx;
			}
			return result;
		}
	}
New to GrepCode? Check out our FAQ X