[TOC] [Prev] [Next] [Bottom]

NSOutlineDataSource

(informal protocol)

Category Of:
NSObject

Declared In:
AppKit/NSOutlineView.h

Category Description

Note: The NSOutlineView class and its supporting informal protocol NSOutlineDataSource are under development. If you want to use an NSOutlineView, you will have to instantiate it programmatically because Interface Builder does not yet include support for working with it.

The NSOutlineDataSource category declares the methods that an NSOutlineView uses to access the contents of its data source object. An outline view determines whether an item is expandable by sending the outlineView:isItemExpandable: message. It determines how many rows to display for an expanded item by sending an outlineView:numberOfChildrenOfItem: message. It accesses individual values with the outlineView:child:ofItem: and outlineView:objectValueForTableColumn:byItem: methods. A data source must implement these methods to work with an NSOutlineView. To allow users to modify data, the data source object also implements the outlineView:setObjectValue:forTableColumn:byItem: method; otherwise, the NSOutlineView provides read-only access to its contents.

The NSOutlineView treats objects provided by its data source as values to be displayed in NSCell objects. If these objects aren't of common value classes-such as NSString, NSNumber, and so on-you'll need to create a custom NSFormatter to display them. See the NSFormatter class specification for more information.


Instance Methods


outlineView:child:ofItem:

- (id)outlineView:(NSOutlineView *)outlineView
child:(int)index
ofItem:(id)item

Returns the id for the child at index for item in outlineView. Returns nil if no such child exists. Items at the highest level in an outline view are considered to be children of a single root item. To specify a child of the single root item, you pass nil for item.


outlineView:isItemExpandable:

- (BOOL)outlineView:(NSOutlineView *)outlineView
isItemExpandable: (id)item

Returns the number of records managed for outlineView by the data source object. An NSOutlineView uses this method to determine whether item is expandable.


outlineView:objectValueForTableColumn:byItem:

- (id)outlineView:(NSOutlineView *)outlineView
objectValueForTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item

Returns an attribute value for the record in outlineView specified by item. tableColumn contains the identifier for the attribute, which you get by using NSTableColumn's identifier method. For example, if tableColumn stands for the city that an employee lives in and item specifies the record for an employee who lives in Portland, this method returns an object with a string value of "Portland."


outlineView:numberOfChildrenOfItem:

- (int)outlineView:(NSOutlineView *)outlineView
numberOfChildrenOfItem:(id)item

Returns the number of children for item in outlineView.


outlineView:setObjectValue:forTableColumn:byItem:

- (void)outlineView:(NSOutlineView *)outlineView
setObjectValue:(id)object
forTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item

Sets an attribute value for the record in outlineView specified by item. anObject is the new value, and aTableColumn contains the identifier for the attribute, which you get by using NSTableColumn's identifier method. This method allows editing of the data source's outline view.



[TOC] [Prev] [Next] [Bottom]

Copyright © 1997, Apple Computer, Inc. All rights reserved.