Re: Custom NSArrayController that manages its own array?

2011-10-19 Thread Jens Alfke
On Oct 18, 2011, at 5:01 PM, Keary Suska wrote: Well, entries in this case is redundant. If you subclass is designed to manage an array of entries, then its content would simply be the array itself. There is no need to abstract it out by the key. In fact, it is a code smell to do so. The

Re: Custom NSArrayController that manages its own array?

2011-10-19 Thread Jens Alfke
On Oct 18, 2011, at 6:44 PM, Quincey Morris wrote: Absolutely. I'll add here that NSArrayControllers are basically glue, and not even (exactly) necessary glue. You can connect a table view directly to a data model, without using an array controller. All the array controller does is to add

Custom NSArrayController that manages its own array?

2011-10-18 Thread Jens Alfke
To help bind my data model to AppKit tables, I’ve written a custom class that implements KVC collection accessors to define a mutable-array property. That is, it implements methods like -countOfEntries, objectInEntriesAtIndex:, insertObject:inEntriesAtIndex, etc. I can then bind this as the

Re: Custom NSArrayController that manages its own array?

2011-10-18 Thread Keary Suska
On Oct 18, 2011, at 11:44 AM, Jens Alfke wrote: To help bind my data model to AppKit tables, I’ve written a custom class that implements KVC collection accessors to define a mutable-array property. That is, it implements methods like -countOfEntries, objectInEntriesAtIndex:,

Re: Custom NSArrayController that manages its own array?

2011-10-18 Thread Quincey Morris
On Oct 18, 2011, at 10:44 , Jens Alfke wrote: To help bind my data model to AppKit tables, I’ve written a custom class that implements KVC collection accessors to define a mutable-array property. That is, it implements methods like -countOfEntries, objectInEntriesAtIndex:,

Re: Custom NSArrayController that manages its own array?

2011-10-18 Thread Jens Alfke
On Oct 18, 2011, at 11:59 AM, Keary Suska wrote: In your subclass you could use the machinery afforded by automaticallyPreparesContent, or simply set the content on awakeFromNib or whenever it is needed. Hm. So in other words I would implement the KVC methods in the subclass

Re: Custom NSArrayController that manages its own array?

2011-10-18 Thread Keary Suska
On Oct 18, 2011, at 5:16 PM, Jens Alfke wrote: On Oct 18, 2011, at 11:59 AM, Keary Suska wrote: In your subclass you could use the machinery afforded by automaticallyPreparesContent, or simply set the content on awakeFromNib or whenever it is needed. Hm. So in other words I would

Re: Custom NSArrayController that manages its own array?

2011-10-18 Thread Quincey Morris
On Oct 18, 2011, at 17:01 , Keary Suska wrote: When dealing with collections even the best of us forget that in the MVC approach the model for the NSArrayController is the array itself, and not the object that contains it. The key and the collection KVC methods are simply a way to acquire