• 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: display NSXMLDocument with NSOutlineView and NSTreeController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: display NSXMLDocument with NSOutlineView and NSTreeController


  • Subject: Re: display NSXMLDocument with NSOutlineView and NSTreeController
  • From: Chris Hanson <email@hidden>
  • Date: Mon, 16 Apr 2007 13:42:55 -0700

On Apr 16, 2007, at 10:55 AM, Torsten Curdt wrote:

Unfortunately that example does not show this for a NSOutlineView (and I don't see how to make it use one ;-) ).

On a button click I open a panel, select a file, parse that file into a NSXMLDocument and would like to feed that into a NSOutlineView.

Now sure what I am after?

The central issue is that you see this as a case of "feeding" data "into" an NSOutlineView. What you actually do is provide data to an NSOutlineView. You can do this in one of two ways:


(1) Create a data source for the outline view that follows the NSOutlineViewDataSource informal protocol, and provides information from your XML document.

(2) Use an NSTreeController that is appropriately bound to your model objects to provide data to the outline view; populate your model objects with information from your XML document.

Everything in Cocoa follows a Model-View-Controller architecture, where a controller object (which isn't necessarily a subclass of NSObjectController or NSWindowController) mediates between model objects containing your data and view objects that display and let the user interact with a representation of it.

In other words, you never push your data into views; the most you do is — in controller-level code only — push a representation of your data into views. For display, you should almost always be interacting with your model objects on a "pull" basis. If you remember this design pattern, the way to accomplish whatever you try to do in Cocoa should become much clearer.

  -- Chris

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: display NSXMLDocument with NSOutlineView and NSTreeController
      • From: Torsten Curdt <email@hidden>
References: 
 >display NSXMLDocument with NSOutlineView and NSTreeController (From: Torsten Curdt <email@hidden>)
 >Re: display NSXMLDocument with NSOutlineView and NSTreeController (From: Evan Moseman <email@hidden>)
 >Re: display NSXMLDocument with NSOutlineView and NSTreeController (From: Torsten Curdt <email@hidden>)

  • Prev by Date: Re: Import sqlite data file
  • Next by Date: Re: Sorting Array Alphabetically
  • Previous by thread: Re: display NSXMLDocument with NSOutlineView and NSTreeController
  • Next by thread: Re: display NSXMLDocument with NSOutlineView and NSTreeController
  • Index(es):
    • Date
    • Thread