- Inherits from:
- EOAssociation : EODelayedObserver (EOControl) : NSObject
- Conforms to:
- NSCoding
- (EOAssociation)
- EOObserving (EODelayedObserver)
- NSObject (NSObject)
Declared in:
- EOInterface/EOColumnAssociation.h
An EOColumnAssociation object cooperates with an EOTableViewAssociation to display values in a column of an NSTableView (Application Kit).
A column association links an NSTableColumn (Application Kit) to a single attribute of all displayed objects in an EODisplayGroup. The value of each object is displayed in its corresponding row.
Column associations provide values for the cells of each NSTableColumn, and also accept edited values to set in their display groups. The EOTableViewAssociation receives target, delegate, and data source messages from the table view, and forwards them as needed to the appropriate column association.
EOColumnAssociations provide values using NSTableView's DataSource methods tableView:setObjectValue:forTableColumn:row: and tableView:objectValueForTableColumn:. This allows values with non-string representations to be displayed. For example, if an NSImageCell (Application Kit) is used as an NSTableColumn's data cell, an EOColumnAssociation can be used to display NSImages (Application Kit) in the NSTableView.
Usable With |
NSTableColumn (Application Kit) |
Aspects | |
value | An attribute of the objects, displayed in each row of the NSTableColumn. |
enabled | A boolean attribute of the objects, which determines whether each object's value cell is editable. Note that because EOTableViewAssociation also uses this aspect, you can use it with different keys to limit editability to the whole row or to an individual cell (column) in that row. |
Object Keys Taken | |
identifier | An EOColumnAssociations sets itself as the identifier of its NSTableColumn. (Note: This key isn't formally reserved by the objectKeysTaken method, as Interface Builder doesn't treat it as an outlet.) |
To display the last and first names of objects in a Talent display group, in Interface Builder, Control-drag a connection from the last name column to the display group. Select EOColumnAssociation in the Connections inspector, and bind the value aspect to the "lastName" key (this automatically creates an EOTableViewAssociation to manage the individual columns). Repeat to set up a column association for the first name. Now when you run the application, the last and first names of each Talent object in the display group's displayedObjects array are put in the corresponding row.
- Sorting rows
- - setSortingSelector:
- - sortingSelector
- Table view data source methods
- - tableView:setObjectValue:forTableColumn:row:
- - tableView:objectValueForTableColumn:row:
- Table view delegate methods
- - tableView:shouldEditTableColumn:row:
- - tableView:willDisplayCell:forTableColumn:row:
- Control delegate methods
- - control:didFailToFormatString:errorDescription:
- - control:isValidObject:
- - control:textShouldBeginEditing:
- (BOOL)control:(NSControl
*)aTableView
didFailToFormatString:(NSString
*)aString
errorDescription:(NSString *)errorDescription
- (BOOL)control:(NSControl
*)aTableView
isValidObject:(id)anObject
- (BOOL)control:(NSControl
*)aTableView
textShouldBeginEditing:(NSText
*)fieldEditor
- (void)setSortingSelector:(SEL)aSelector
For more information on these selectors, see the section "Comparison Methods" in the EOSortOrdering class specification (EOControl).
If the EOTableViewAssociation for the receiver's NSTableView (Application Kit) sorts its rows, it applies this method as needed to sort them. The default sorting selector is EOCompareAscending.
- (SEL)sortingSelector
- (id)tableView:(NSTableView
*)aTableView
objectValueForTableColumn:(NSTableColumn
*)aTableColumn
row:(int)rowIndex
- (void)tableView:(NSTableView
*)aTableView
setObjectValue:(id)value
forTableColumn:(NSTableColumn
*)aTableColumn
row:(int)rowIndex
- (BOOL)tableView:(NSTableView
*)aTableView
shouldEditTableColumn:(NSTableColumn
*)aTableColumn
row:(int)rowIndex
- (void)tableView:(NSTableView
*)aTableView
willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn
*)aTableColumn
row:(int)rowIndex