NSTreeController and Core Data: creating abstract entities?
NSTreeController and Core Data: creating abstract entities?
- Subject: NSTreeController and Core Data: creating abstract entities?
- From: Michael McCracken <email@hidden>
- Date: Tue, 21 Jun 2005 20:56:48 -0700
Hi, I am setting up a source list style outline view - I have a few
different entities that are all collections of other entities, so I
created an abstract entity "Container", and each of the container-like
entities has Container as its parent. Container has a to-many
'children' relationship to itself, and a BOOL attribute 'isRoot',
defaulting to NO.
I set up an NSTreeController with the MOC bound to the document's MOC,
the entity set to Container, and a predicate of isRoot == 1. The
outlineview's tablecolumn's value binding is bound to the
treecontroller's arrangedObjects.name, which works fine.
I also have the document instantiate two top level Entities that are
child entities of Container (call them PubGroup and PersonGroup) at
document init time, with isRoot set to YES.
This works out nicely to display the two top level elements, and when
I programmatically create and insert child elements - however, I'd
like to use the treecontroller's add and addChild methods, but they
actually create Containers.
Is it intended behavior to create instances of abstract entities? That
was a little surprising.
Also, what should I do to get it to do what I want - that is, to
create a PubGroup if the selection was a PubGroup, and a PersonGroup
if the selection is a PersonGroup - will I need to subclass
NSTreeController, or should I just use it for display and handle
adding and removing through my own code?
Thanks for any insights,
-mike
--
Michael McCracken
http://michael-mccracken.net/blog/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden