Re: NSOutlineView, NSTreeController and itemForPersistentObject...

  • 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
  • Solved my own problem:

    http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSTreeController

    (should have check the obvious places before posting :-)

    Am 01.01.2008 um 23:42 schrieb Sebastian Morsch:

    > 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
  • There's a new sample code showing one approach to using some of the
    Leopard APIs for NSTreeController/Core Data, including drag and drop.
    It might be useful to take a look - http://developer.apple.com/samplecode/AbstractTree/index.html

    Wil

    On Jan 1, 2008, at 3:01 PM, Sebastian Morsch wrote:

    > Solved my own problem:
    >
    > http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSTreeController
    >
    > (should have check the obvious places before posting :-)
    >
    >
    >
    >
    > Am 01.01.2008 um 23:42 schrieb Sebastian Morsch:
    >
    >> 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

  • Thanks William, that example is very helpful!!

    Am 02.01.2008 um 00:14 schrieb William Turner:

    > There's a new sample code showing one approach to using some of the
    > Leopard APIs for NSTreeController/Core Data, including drag and
    > drop. It might be useful to take a look - http://developer.apple.com/samplecode/AbstractTree/index.html
    >
    > Wil
    >
    > On Jan 1, 2008, at 3:01 PM, Sebastian Morsch wrote:
    >
    >> Solved my own problem:
    >>
    >> http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSTreeController
    >>
    >> (should have check the obvious places before posting :-)
    >>
    >>
    >>
    >>
    >> Am 01.01.2008 um 23:42 schrieb Sebastian Morsch:
    >>
    >>> 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

previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today