Hi, I've pushed a change to the develop branch that should make it easier to deal with dynamic data sets. The heart of this is ICollectionView, in the Collections project. This interface describes a class that allows items to be added, removed, and updated dynamically but can also front a more complex data set. For example, you could make a class, SortedData, which implements ICollectionView. Internally, the class might have an ArrayList that holds the original data. When you sort it, that creates an internal sorted list, leaving the original untouched. The SortedData's implementation of ICollectionView works only with the internal sorted list.
I extended ArrayList to implement ICollectionView. In the Basic project you will find a new model, SingleSelectionCollectionViewModel. This model is similar to ArrayListSelectionModel, but expects its dataProvider to implement ICollectionView. Also in the Basic project you will find a new bead, DataItemRendererFactoryForCollectionView. This bead assumes the model's dataProvider implements ICollectionView. It also responds to the insert, remove, and update events on the collection, generating new itemRenderer instances as needed or removing them. Back in the Collection project you will find a new collection, TreeData. This class also implements ICollectionView. TreeData is composed of HierarchicalData (items with nested children). When accessed via the ICollectionView interface, TreeData responds with a "flattened" view of the structured data. For example, if you have nodes A and B and node A has children A1, A2 and node B has children B1, B2, and B3, if you "open" node B, the flattened version of this will appear to be an array of [Node A, Node B, Node B1, NodeB3, NodeB3]. Returning to the Basic project, DataItemRendererFactoryForHierarchicalData now assumes the dataProvider in the model is an ICollectionView (implemented by TreeData in Collections) object. In other words, Tree now uses ICollectionView and the associated beads.The TreeExample shows this in action. You can also easily use this with List by setting the List's model to SingleSelectionCollectionViewModel and its data mapper to DataItemRendererFactoryForCollectionView. I had a reasonably working version of DataGrid for this, but I backed out the change temporarily. I will get that working again next week. Regards, Peter Ent Adobe Systems/Apache Royale Project
