Skip navigation.
 
mlRe: NSOutlineView, NSTreeController and itemForPersistentObject...
FROM : Sebastian Morsch
DATE : Tue Jan 01 23:42:35 2008

Hi,

I'm picking up this over two years old thread here to see if there was 
anything new on this matter...

It's about the old problem how to translate back and forth between 
NSTreeControllers private tree node proxies and our Core Data 
NSManagedObjects. In Tiger, these tree node proxies belong to the 
undocumented _NSArrayControllerTreeNode class. Now in Leopard, 
apparently they are instances of the also undocumented 
NSTreeControllerTreeNode class (the fact that the underscore is gone 
gives me some hope though :-). Fortunately, you can throw 
representedObject at those NSTreeControllerTreeNodes to get your 
managed object back, but the other way round, getting a tree node 
proxy with a managed object, seems impossible (at least for my very 
limited knowledge and for everything I googled).

I came across this, while trying to implement the autosaving of 
expanded/collapsed state of an NSOutlineView (bound to 
NSTreeController bound to NSManagedObjectContext) in Leopard. 
Implementing outlineView:persistentObjectForItem: was easy, but I 
completely failed on outlineView:itemForPersistentObject:.

I know there are other solutions to this ( http://lists.apple.com/archives/cocoa-dev/2007/Dec/msg00982.html
  ), but I got curious if something less expensive is possible in 
Leopard. And I think, Drag'n'Drop implementation presents you with the 
same old problem, doesn't it?


Sebastian

Related mailsAuthorDate
mlRe: NSOutlineView, NSTreeController and itemForPersistentObject... Sebastian Morsch Jan 1, 23:42
mlRe: NSOutlineView, NSTreeController and itemForPersistentObject... Sebastian Morsch Jan 2, 00:01
mlRe: NSOutlineView, NSTreeController and itemForPersistentObject... William Turner Jan 2, 00:14
mlRe: NSOutlineView, NSTreeController and itemForPersistentObject... Sebastian Morsch Jan 2, 00:22