Core Data for managing subtree?
Core Data for managing subtree?
- Subject: Core Data for managing subtree?
- From: "Hamish Allan" <email@hidden>
- Date: Wed, 9 Apr 2008 00:09:02 +0100
Hi,
I have a source list (an NSOutlineView bound to an NSTreeController),
with three sections: one containing fixed items, one dynamic items,
and one items the user can add and remove (c.f. the iTunes source list
sections 'Library', 'Shared' and 'Playlists').
Because my add and remove controls are only applicable to a particular
subtree, I have an extra controller for that part of the model; my add
and remove buttons call methods on that controller rather than the
NSTreeController. The container in the model for those items is a
KVO-compliant mutable array obtained by calling
mutableArrayValueForKey:@"children" on their parent node (an
NSMutableDictionary). The add and remove buttons can therefore
manipulate the model directly and the view is kept up to date. All
well and good so far.
However, I would like to use Core Data to manage these items. I figure
I could have my add and remove methods insert and remove objects from
the managed object context as well as the KVO-compliant mutable array,
but when I undo such an action, the change will only be reflected in
the managed object context. I could create an extra entity to act as a
collection for those items and have the add and remove methods
manipulate that object, but I don't see how this collection could then
be KVO-related to its parent node as per mutableArrayValueForKey:.
Is it possible to achieve what I'm trying to do -- managing part but
not all of a tree also using bindings?
Thanks,
Hamish
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden