I have an architectural question concerning the use of sets of data
providers for a Tree control.

We have a master list of Users for our chat application, which we
might need to filter and sort in various ways (buddies only, blocked
only, etc).  For our buddy list, we were using an adapter-esque
solution to convert the list of users into a list of "buddy groups"
containing User objects underneath them.  We recently stumbled across
the HierarchicalCollectionView and GroupingCollection objects and
decided those might be better than the overhead of a custom adapter
class, but we're having some trouble getting everything to sync up
correctly.

We used the tutorial here to try to set up our collections correctly:
http://blog.tsclausing.com/post/20.  Essentially, we have a list of
Users that is shared throughout the application.  In our BuddyList
view, we have a ListCollectionView with list = masterUserList, with a
sort and filter applied as well.  We then have a GroupingCollection
sorting on the User's groupName field.  We then have a
HierarchicalCollectionView adapting the GroupingCollection for display
in a Tree control.

We see the data as expected, but we're having trouble figuring out
exactly how to keep everything in lock-step.  Sometimes properties of
the User object change completely asynchronously -- if a User signs
off, we update their online status and need to reapply the sort on our
ListCollectionView, but we don't have a specific request/response, so
we can't rely on a command or delegate or anything.  If we update the
model, it fires a COLLECTION_CHANGE event, but this doesn't seem to
fire every time in the bound ListCollectionView.  We anticipated this
event would fire in the bound object as well, allowing us to call
refresh and invalidateDisplayList as necessary.

Has anyone else used chained collections/views in this manner?  I
think in general we're trying to figure out exactly how to set up
refreshes and redraws that aren't directly tied to button/column
clicks (as in every other application we come across).

Thanks!

Reply via email to