[V4CC] 4.8b5, introduce KVC, KVO, CursorController, 3 new examples
Ruslan Zasukhin
ruslan_zasukhin at valentina-db.com
Tue Sep 21 07:00:05 CDT 2010
On 9/21/10 1:29 AM, "Ernesto Giannotta" <erne at apimac.com> wrote:
Hi Erne,
> I've tested the new VCursorController object and it's really awesome.
They still under development ...
I think we self still not very good understand all ideas ...
So any ideas from you guys are welcome.
> Now, let me ask, why not make it a collection controller making it a subclass
> of NSArrayController?
I have think about this, but I did not see advantages. And reasons.
Lets think together.
* Q from me was: NSArrayController want to see true NSArray, right?
But VCursor is not NSArray.
* And it is absolutely bad idea transfer records from Vcursor to NSArray.
Why? Because Cvursor can have million records.
> This way we could bind it to a NSTableView using its arrangedObjects
> controller key and have a consistent and more flexible way to interact with
> the cursor.
>
> From the Cocoa Bindings Programming Topics:
>
>> Setting the Content of a Controller
>>
>> NSObjectController and its subclasses are initialized with the method
>> initWithContent:, passing a content object or nil if you intend to use the
>> content bindings. You can explicitly set the content of an existing
>> controller using the setContent: method. It is far more common to provide
>> content for controllers by establishing a binding to one of their exposed
>> Controller Content bindings.
>>
>> NSObjectController exposes a single binding for content called contentObject.
>> You can establish a binding from contentObject to any object that is
>> key-value-coding and key-value-observing compliant for the keys that you
>> intend to have the controller operate on.
>>
>> The collection controllers expose additional bindings: contentArray,
>> contentSet, and contentArrayForMultipleSelection.
>>
>> The contentArray binding is bound to an NSArray or an object that implements
>> the appropriate array indexed accessor methods.
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> Similarly the contentSet binding is bound to an NSSet object or an object
>> that implements the appropriate set indexed accessor methods. The indexed
>> accessor patterns are described in Indexed Accessor Patterns for To-Many
>> Properties in the Key-Value Coding Programming Guide.
>>
>
> Of course I've not digged too deep into the implementation difficulties that
> may arise,
> we could pass a VCursor to the initWithContent: and setContent: methods,
> a simple NSDictionary would likely suffice when returning the arrangedObjects
> array,
> though maybe a VCursorRecord class that knows about its parent cursor could be
> useful for updating and deleting.
>
> Then the VCursorController could be made capable to handle the sort via
> NSSortDescriptors and integration with the Cocoa framework would be almost
> perfect.
>
> Well, I've talked too much as usual :-)
> What do you think?
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list