• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bindings using other collections?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Bindings using other collections?
      • From: Robert La Ferla <email@hidden>
References: 
 >Bindings using other collections? (From: Robert La Ferla <email@hidden>)

  • Prev by Date: Re: is there something with the switch
  • Next by Date: Sending a HTTP form (searching the right framework/class-library)
  • Previous by thread: Bindings using other collections?
  • Next by thread: Re: Bindings using other collections?
  • Index(es):
    • Date
    • Thread