Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Source list tree nodes able to represent different entities




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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Source list tree nodes able to represent different entities (From: Sebastian Morsch <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.