- Package:
- com.apple.yellow.application
The NSTableDataSource category declares the methods that an NSTableView uses to access the contents of its data source object. It determines how many rows to display by sending a numberOfRowsInTableView message, and accesses individual values with the tableViewObjectValueForLocation and tableViewSetObjectValueForLocation methods. A data source must implement the first two methods to work with an NSTableView, but if it doesn't implement the third the NSTableView simply provides read-only access to its contents.
The NSTableView 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 String, Number, and so on-you'll need to create a custom NSFormatter to display them. See the NSFormatter class specification for more information.
Suppose that an NSTableView's column identifiers are set up as Strings containing the names of attributes for the column, such as "Last Name", "City", and so on, and that the data source stores its records as an NSMutableArray, called records, of NSMutableDictionary objects using those names as keys.
- Getting values
- numberOfRowsInTableView
- tableViewObjectValueForLocation
- Setting values
- tableViewSetObjectValueForLocation
public abstract in numberOfRowsInTableView(NSTableView aTableView)
public abstract Object tableViewObjectValueForLocation(
NSTableView aTableView,
NSTableColumn aTableColumn,
int rowIndex)
public abstract Object tableViewSetObjectValueForLocation(
NSTableView aTableView,
Object anObject,
NSTableColumn aTableColumn,
int rowIndex)