PATH  Documentation > WebObjects 4.5 > EOInterface Reference

Table of Contents

EOColumnAssociation


Inherits from:
EOAssociation : EODelayedObserver (EOControl) : NSObject
Implements:
EOObserving (EODelayedObserver)
Package:
com.apple.yellow.eointerface


Class Description


An EOColumnAssociation object cooperates with an EOTableViewAssociation to display values in a column of an NSTableView (Application Kit).


Note: This class doesn't exist in the com.apple.client.eointerface package.

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 tableViewSetObjectValueForLocation and tableViewObjectValueForLocation. 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.)


Example

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.




Method Types


Sorting rows
setSortingSelector
sortingSelector
Table view data source methods
tableViewSetObjectValueForLocation
tableViewObjectValueForLocation
Table view delegate methods
tableViewShouldEditLocation
tableViewWillDisplayCell
Control delegate methods
controlDidFailToFormatStringErrorDescription
controlIsValidObject
controlTextShouldBeginEditing


Constructors



EOColumnAssociation

public EOColumnAssociation(Object aDisplayObject)

Creates a new EOColumnAssociation to monitor and update the row values in aDisplayObject, an NSTableColumn (Application Kit).

You normally set up associations with the Interface Builder application, in which case you don't need to create them programmatically. However, if you do create them up programmatically, setting them up is a multi-step process. After creating an association, you must bind its aspects and establish its connections.

See Also: bindAspect (EOAssociation), establishConnection (EOAssociation)




Instance Methods



controlDidFailToFormatStringErrorDescription

public boolean controlDidFailToFormatStringErrorDescription( com.apple.yellow.application.NSControl aTableView, String aString, String errorDescription)

Invokes shouldEndEditing (defined by EOAssociation) and returns the result.

controlIsValidObject

public boolean controlIsValidObject( com.apple.yellow.application.NSControl aControl, Object anObject)

Saves the value of any cell being edited using setValueForAspect, and if successful sends an associationDidEndEditing message to the receiver's EODisplayGroup. Returns true if successful (or if no changes need be saved), false if unsuccessful.

controlTextShouldBeginEditing

public boolean controlTextShouldBeginEditing( com.apple.yellow.application.NSControl aControl, com.apple.yellow.application.NSText text)

Sends an associationDidBeginEditing message to the receiver's EODisplayGroup and returns true.

establishConnection

public void establishConnection()

Attaches the receiver to the outlets of its display object and otherwise configures the display object (such as by setting its action method). See "Setting up an EOAssociation Programmatically" in the class description for more information.

See Also: breakConnection ( EOAssociation)



setSortingSelector

public void setSortingSelector(NSSelector aSelector)

Sets the method selector used to sort rows to aSelector, one of (defined in EOControl):

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 CompareAscending.



sortingSelector

public NSSelector sortingSelector()

Returns the method selector used to sort rows, or null if the column isn't sorted.

tableViewObjectValueForLocation

public Object tableViewObjectValueForLocation( com.apple.yellow.application.NSTableView tableView, com.apple.yellow.application.NSTableColumn tableColumn, int rowIndex)

Returns the value of the property of the object at rowIndex bound to the value aspect.

tableViewSetObjectValueForLocation

public void tableViewSetObjectValueForLocation( com.apple.yellow.application.NSTableView tableView, Object value, com.apple.yellow.application.NSTableColumn tableColumn, int rowIndex)

Sets the property of the object at rowIndex bound to the value aspect to value.

tableViewShouldEditLocation

public boolean tableViewShouldEditLocation( com.apple.yellow.application.NSTableView tableView, com.apple.yellow.application.NSTableColumn tableColumn, int rowIndex)

Returns false if the enabled aspect is bound and its value for the object at rowIndex is false. Otherwise returns true. Note that because the enabled aspects of EOTableViewAssociation and EOColumnAssociation can be bound to different keys, you can limit editability to the whole row or to an individual cell (column) in that row.

tableViewWillDisplayCell

public void tableViewWillDisplayCell( com.apple.yellow.application.NSTableView tableView, Object aCell, com.apple.yellow.application.NSTableColumn tableColumn, int rowIndex)

Alters the display characteristics for aCell according to the values for the enabled aspect of the object at rowIndex.


Table of Contents