• 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
bindings and heterogeneous data sets (was Re: [CoreData] Entity inheritance)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bindings and heterogeneous data sets (was Re: [CoreData] Entity inheritance)


  • Subject: bindings and heterogeneous data sets (was Re: [CoreData] Entity inheritance)
  • From: mmalcolm crawford <email@hidden>
  • Date: Sun, 15 May 2005 14:38:38 -0700


On May 15, 2005, at 11:54 AM, Christophe Favergeon wrote:

I am just learning CoreData and Cocoa Bindings. I am experimenting with entity inheritance in Core Data.


Please try to be more accurate with subject lines. This really has little to do with Core Data and entity inheritance per se, it's a question about bindings and heterogeneous data sets.



I have an abstract entity (let's say A). B and C are entities inheriting from A.
I have created a table view in Interface Builder connected to an array of managed objects of type A.
Now, I have two buttons allowing me to create managed objects of type B and C. They are added automatically to the view displaying the managed object of type A. So, everything is fine so far.
Now, I'd like to be able to edit the attributes of all my entities. Of course, when I select an entity in my table, it can either be of type B or C.
And, I have some problems to manage it through bindings.
I have two views : one to edit entities of kind B and one for entities of kind C. Of course, when an entity of kind B is selected, I get exceptions raised by the controller for entities of type C since there B and C are extending the set of attributes of A in different ways.



It's not clear exactly what controllers you have set up, what bindings there are for the detail view, and where the exceptions occur. I'd imagine a single array controller for the table view which manages a heterogeneous array, and the detail views are bound to the array controller selection?

One (untested) possibility might be to add additional object controllers to manage the selection -- one controller per class you want to inspect (or per distinct detail view collection), and bind the detail views to them. Bind the contentObject of each object controller to the table view's selection, but also associate a value transformer with the binding. The value transformer should check the class (or entity) of the incoming value. If it's appropriate for the object controller, pass the value as-is. If it's not appropriate, emit the NSNotApplicableMarker.

mmalc


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >[CoreData] Entity inheritance (From: Christophe Favergeon <email@hidden>)

  • Prev by Date: Re: Where is X11 on Tiger ?
  • Next by Date: Re: NSManagedObjectContextObjectsDidChangeNotification in loaded nibs
  • Previous by thread: [CoreData] Entity inheritance
  • Next by thread: Where is X11 on Tiger ?
  • Index(es):
    • Date
    • Thread