//For backward compatible, if by owner failed, try again with by item
CollectionItem decor = myGetCollectionItemByOwner(owner);
if (decor == null) {
decor = getBindingCollectionItem(item);
}
final ListModel xmodel = decor.getModelByOwner(owner);
if (isCollectionItem && comp == item) {
if (xmodel instanceof BindingListModelExt && !((BindingListModelExt)xmodel).isDistinct()) {
final BindingListModelExt model = (BindingListModelExt) xmodel;
final int[] indexes = model.indexesOf(bean);
final int sz = indexes.length;
final List comps = new ArrayList(sz);
for (int j = 0; j < sz; ++j) {
final Component xcomp = lookupClone(decor.getComponentAtIndexByOwner(owner, indexes[j]), comp);
if (xcomp != null)
comps.add(xcomp);
}
return (Component[]) comps.toArray(new Component[comps.size()]);
} else if (xmodel instanceof BindingListModel) {
final BindingListModel model = (BindingListModel) xmodel;
int index = model.indexOf(bean);
if (index >= 0) {
final Component xcomp = lookupClone(decor.getComponentAtIndexByOwner(owner, index), comp);
return xcomp != null ? new Component[] {xcomp} : new Component[0];
}
}
} else {
//though the comp is in collection but the binding does not relate to _var,
//have to scan through the whole cloned children items
final int sz = xmodel.getSize();
final List comps = new ArrayList(sz);
if (decor instanceof CollectionItemExt) {
final List items = ((CollectionItemExt)decor).getItems(owner);
for (final Iterator it = items.iterator(); it.hasNext(); ) {
final Component cloneitem = (Component) it.next();