• 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: Robert La Ferla <email@hidden>
  • Date: Sun, 08 Feb 2004 21:27:55 -0500

Yeah but with that approach, I have to wrap every array in the model. As far as I know, Java doesn't have "pose as" functionality. If I have a simplistic data source, the wrapper approach works but otherwise, it's a big effort.

Also, how do you programmatically set up bindings in Java? I can do it in Objective C but the documentation for Java is lacking or perhaps the Java implementation isn't complete in Panther. Has anyone done this successfully?

mmalcolm crawford wrote:


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.

References: 
 >Bindings using other collections? (From: Robert La Ferla <email@hidden>)
 >Re: Bindings using other collections? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: NSImageView as image well (solved)
  • Next by Date: Re: adding to my UI
  • Previous by thread: Re: Bindings using other collections?
  • Next by thread: Arrows on NSBezierPaths
  • Index(es):
    • Date
    • Thread