[Chandler-dev] Re: collection question

Andi Vajda vajda at osafoundation.org
Fri Aug 11 13:29:06 PDT 2006


On Fri, 11 Aug 2006, D. John Anderson wrote:

> One possibility of implementing the new sidebar design is splitting it up 
> into two separate blocks: "out of the box" collections and "user" 
> collections.
>
> I'd like to make a combined collection out of the two separate collections, 
> which would be all of the collections in both sidebar components. Ideally the 
> order of the combined collection would match the order of items in the 
> combined collections, viewed through their numeric index. Is this possible?

Use a Union set that combines two ref collections.
Or, in collection item terms, use a UnionCollection that combines two 
ListCollections.

The order of items in a ref collection (or a ListCollection) is maintained, it 
can be safely assumed that the order of iterating the Union (or a numeric 
index attached to it) would reflect the order in the first collection followed 
by the order in the second collectionm, assuming no duplicates.

> Finally, I need to maintain a combined selection. Is there anyway to make the 
> combined collection's selection match that of the combined component 
> collections? Here order matters. I need to be able to get the first selected 
> item in the combined collections stacked one on top of the other.

I'm not sure I follow the stacking question but if you use a Union you then 
have a third collection that represents the union of the two you started from 
and it can have selection and indexes like any other collection.

Andi..


More information about the chandler-dev mailing list