Re: Source list tree nodes able to represent different entities
Re: Source list tree nodes able to represent different entities
- Subject: Re: Source list tree nodes able to represent different entities
- From: mmalc crawford <email@hidden>
- Date: Sun, 30 Dec 2007 17:34:44 -0800
On Dec 30, 2007, at 4:51 PM, Sebastian Morsch wrote:
But I don't know how to work around the fact that a relationship
like my TreeNodes "representedObject" wants a single entity it
relates to. I want it to relate to more than one entity!
First, do you need to use a TreeNotes entity? Can you not just use
the data entities directly.
Note:
"An NSTreeController requires that you describe how the tree of
objects is traversed by specifying the key path for child objects. All
child objects for the tree must be key-value-coding compliant for the
same child key path. If necessary you should implement accessor
methods in your model classes, or categories on those classes, that
map the child key to the appropriate class-specific method name."
<http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTreeController_Class/Reference/Reference.html
>
Unfortunately, the usual example-suspects (CoreRecipies, SourceList
Sample) seem to work with only one entity/class.
So does anyone know how to implement a source list tree that points
to objects of different entities? Any help is greatly appreciated!!
Thanks.
Use entity inheritance. Define an entity (perhaps abstract) that
defines the relationship, then implement the other entities as sub-
entities.
mmalc
_______________________________________________
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