NSTreeController: binding cascading entities
NSTreeController: binding cascading entities
- Subject: NSTreeController: binding cascading entities
- From: "Frederick C. Lee" <email@hidden>
- Date: Sat, 18 Mar 2006 15:30:43 -0800
Here's the scenario:
1) I have Core Data object as follows: Region --->> Country --->>
Province -->> City
2) Each entity link to multiple 'map' objects:
Region -->> Map; Country -->>Map; Province -->> Map; City --
>> Map
So the entity 'Map' contains images for all regions (Region,
Country, ....City).
Okay...
Now for the NSTreeController ---> NSOutlineView.
A) I toyed with a single tier to see if I get something via binding:
Region Tree <--- Context Set --- RegionArrayController
{Children By Key Path = nil}
This gives me a single list of Regions. *OK*
Here's a brief snippet of Region's class:
@implementation EntityManagedObject
#pragma mark NSTreeController stuff
- (NSSet *)items {
return nil;
}
...
@end
===================================================================
B) Now to connect the subordinate entities:
I'm getting a little lost here.
My Questions.
Regions *DOES* have children. They're 'Country' and 'Map'. (Ditto
for Country, Provinces and City)
Which means, that 'Country' and 'Map' are SIBLINGS.
The difference between 'Country' and 'Map'; is that 'Map' is a Leaf
Node and Country is NOT (a parent).
So....
1) In Region's Class, Do I need to return a NSSet containing Map AND
Country entities?
- (NSSet *)items {
*** Do I return the NSSet of dependent Map and/or Country items
here? ****
*** Do I grab the set from the controller or moc? ****
}
1a) Ditto for CountryManagedObjectClass and ProvinceManagedObjectClass?
ALSO....
Do I chain together NSTreeControllers in IB?
Example Scenario (IB):
Region -->> Country -->> Province -->> City (Ditto for Maps)
RegionArrayController -- contextSet --> RegionTreeController
CountryArrayController -- contextSet --> CountryTreeController
ProvinceArrayController -- contextSet --> ProvinceTreeController
CityArrayController -- contextSet --> CityTreeController
Any pointers would be appreciated!
Regards,
Ric.
_______________________________________________
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