Inherits From:
EOAssociation : EODelayedObserver (EOControl) : NSObject
EOObserving (EODelayedObserver)
Inherits From:
com.apple.yellow.eointerface (Yellow Box)
Class Description
An EOColumnAssociation object cooperates with an EOTableViewAssociation to display values in a column of an NSTableView (Application Kit). It is for use in Yellow Box applications only. For an equivalent Java Client class, see the EOTableColumnAssociation class specification.
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.
The EOTableViewAssociation receives target, delegate, and data source messages from the table view, and forwards them as needed to the appropriate column association. Column associations provide values for the cells of each NSTableColumn, and also accept edited values to set in their display groups.
EOColumnAssociations provide values using NSTableView's DataSource methods
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 identifer 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 correponding row.
EOColumnAssociation
(java.lang.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
setSortingSelector
public void setSortingSelector
(com.apple.yellow.foundation.NSSelector aSelector)
Sets the method selector used to sort rows to aSelector, one of:
null
(to tell the receiver not to sort)
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 EOSortOrdering.EO_COMPARE_ASCENDING.
sortingSelector
public com.apple.yellow.foundation.NSSelector sortingSelector
()
Returns the method selector used to sort rows, or null
if the column isn't sorted.
Data Source and Delegate Methods
These methods are forwarded by the corresponding NSTableView's EOTableViewAssociation to the appropriate EOColumnAssociation.
controlDidFailToFormatStringErrorDescription
public boolean controlDidFailToFormatStringErrorDescription
(
com.apple.yellow.application.NSControl aTableView,
java.lang.String aString,
java.lang.String errorDescription)
Invokes shouldEndEditing
(defined by EOAssociation) and returns the result.
controlIsValidObject
public boolean controlIsValidObject
(
com.apple.yellow.application.NSControl aNSControl,
java.lang.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 aNSControl,
com.apple.yellow.application.NSText aNSText)
Sends an associationDidBeginEditing
message to the receiver's EODisplayGroup and returns true.
tableViewObjectValueForLocation
public java.lang.Object tableViewObjectValueForLocation
(
com.apple.yellow.application.NSTableView aNSTableView,
com.apple.yellow.application.NSTableColumn aNSTableColumn,
int anInt)
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 aTableView,
java.lang.Object value,
com.apple.yellow.application.NSTableColumn aTableColumn,
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 aTableView,
com.apple.yellow.application.NSTableColumn aTableColumn,
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 aTableView,
java.lang.Object aCell,
com.apple.yellow.application.NSTableColumn aTableColumn,
int rowIndex)
Alters the display characteristics for aCell according to the values for the enabled
aspect of the object at rowIndex.