On Fri, Jul 30, 2010 at 2:11 PM, Martin Stanley <[email protected]> wrote: > 2- the invalid predicate breaks the NSPredicateEditor. My > NSPredicateEditorRowTemplate subclass populates its popup button dynamically > based on the current contents of an NSArrayController bound to the entity in > question (e.g., Project). When it tries to match the popup to this predicate > it complains because there is no longer an entry matching the deleted > object's name. > > However, following your last suggestion, I think the following should work: > - when a SmartGroup is created, register an observer on its predicate > attribute. > - then whenever the predicate is changed: > - parse the predicate to find all of the objects mentioned (by name), > and > - create a bi-directional reference between each object and this > SmartGroup object > - then when attempting to delete the object (e.g. a Project) inform the user > and, if given the go-ahead, clean up all predicates which reference the > object before asking Core Data to delete the object.
I think you're going about this backwards. Your predicate should already be modeled in the document (by a SmartGroup entity or a collection of related entities) and the predicate editor's delegate should be the controller responsible for converting between the predicate editor's representation and your model representation. This would be evidence of a good MVC design. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
