Re: Bindings using other collections?
Re: Bindings using other collections?
- Subject: Re: Bindings using other collections?
- From: mmalcolm crawford <email@hidden>
- Date: Sun, 8 Feb 2004 09:46:04 -0800
On Feb 8, 2004, at 7:43 AM, Robert La Ferla wrote:
It appears that the new bindings architecture is largely (but not
entirely) dependent on Objective C. Is it possible to bind to Java
collections instead of NSMutableArray for relationships? If so, how?
e.g. If I have a Company that has many Employee objects, how can I
use a Vector or ArrayList for the to-many employees relationship so
that the bindings system knows how to add, remove, get, etc... from
that collection?
<
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueCoding/Concepts/AccessorConventions.html>
and
<
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
The array controller uses key-value coding to retrieve values. If your
data source implements the relevant indexed accessors, it doesn't
matter what the data model is behind them. For example, you could have
a raw bitmap. If you call the variable "bitmap", then provided you
implement
- (unsigned int)countOfBitmap;
- (id)objectInBitmapAtIndex:(unsigned int)index;
and if you want to edit it:
- (void)insertObject:(id)anObject inBitmapAtIndex:(unsigned int)index;
- (void)removeObjectFromBitmapAtIndex:(unsigned int)index;
(and optionally for efficiency:
- (void)replaceObjectInBitmapAtIndex:(unsigned int)index
withObject:(id)anObject;
)
then the actual implementation details are irrelevant.
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.