NSTreeController and dissimilar entity problems
NSTreeController and dissimilar entity problems
- Subject: NSTreeController and dissimilar entity problems
- From: Dan Donaldson <email@hidden>
- Date: Thu, 2 Feb 2006 20:56:21 -0500
I've tried a couple of questions here, without response, maybe three
times a charm...
Questions I have referring to my current project (detailed below)
- if I require an NSTreeController to contain a tree of unlike
entities, is this possible? Under what conditions? What I've been
able to understand is that each entity must respond to the same
relationship keys.
- does the data model determine the type of entities created as
children of existing entities in the tree using the standard methods
such as addChild? eg in my model (below) does it 'know' that a
Conference has Papers as children nad add that type of object when a
child is to be added?
- how much of such an insert and creation process is free with
NSTreeController and coreData, and how much has to be programmatic?
- are there any clear tutorials or code examples that cover the use
of NSTreeController and NSOutlineView that deal with unlike entities
in the tree? The ones I've found only deal with the same type of
entity in the hierarchy per se
Description of Project:
OK, I have an NSTreeController bound to FileOwner's
managedObjectContext. In turn, an NSOutlineView is bound to that
NSTreeController.
The entities I'm interested in working with are organized like this:
Entity: Conference Entity:
Paper Entity: Author
att: name[string] att: name
[string] att: name[string]
rel: child <------------------------>> rel:parent
rel: child
<-------------------->> rel: parent
A button has as its target a method in MyDocument that adds a new
Conference object to MyDocument's managedObjectContext. At the same
time, it spits out an NSLog report to tell me what the context
contains, and here is typical output:
2006-02-02 16:06:26.930 OutlineExperiment[9579] context items are
<NSCFSet: 0x3a2fa0> (<NSManagedObject: 0x372a00> (entity: Conference;
id: 0x3a00c0 <x-coredata:///Conference/
t274FD35B-053A-4533-8379-9D49ED67E8DB> ; data: {child = (); name =
new conference; }), <NSManagedObject: 0x33f870> (entity: Conference;
id: 0x3a50b0 <x-coredata:///Conference/
tCBB008D9-6997-4C73-9FC3-572672BFD331> ; data: {child = (); name =
new conference; }))
So the entities are being created and properly inserted, and their
names show up in the first column of the NSOutlineView. They can be
edited in the outlineview successfully.
Any help appreciated greatly.
dan
Dan Donaldson
_______________________________________________
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