I solved this my not adding the file to the store until after the insert is completed in the controller. The side effect is if the file system operation fails, I have to back out the node inserted into the tree which seems counterintuitive(i.e. I should only add the node if the model successfully has the data). It still calls both the getter and the setter within this one call. This has to be is a bug and I will file it. It should only call the setter.
-Tony On Jun 18, 2010, at 3:53 PM, Tony Romano wrote: > Scenario: Adding a new node to a NSOutlineView backed by a NSTreeController. > > 1. Create a new internal object add add it to the data store(file system). > This will be my representedObject in the treecontroller > 2. Compute the path and call insertObject:atArrangedObjectIndexPath: > > the treecontroller does 2 things during the call to insertObject: > > 1. It calls my getter, children, and asks me for all the children under the > parent node I have added the new node to. I give it the list INCLUDING the > newly created node since it is now in the store. > 2. Then it calls the setter, setChildren, and gives me the newChildren list. > Which now has an additional copy of the new node, one from the getter call > and one from the insertAt call. I know this for a fact because I purposely > added some data to the newly created node for the insert to distinguish them. > > From the UI, the outlineview is correct, but my internal child list has the > extra node. It's not displayed because the treecontroller optimizes when to > ask me for a childlist. I have a work around which I don't like to basically > lock out the getter method and just return the current child list(i.e the > previous child list which doesn't have the new node added from the file > system). Anyone experience this before and have a recommendation? > > TIA, > -Tony > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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/tonyrom%40hotmail.com > > This email sent to tony...@hotmail.com > -Tony _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com