PATH  WebObjects 4.0 Documentation > EOInterface Reference



EOTableViewAssociation

Inherits From:
EOAssociation : EODelayedObserver (EOControl) : NSObject

EOObserving (EODelayedObserver)

Inherits From:
com.apple.yellow.eointerface (Yellow Box)


Class Description

An EOTableViewAssociation object manages the individual EOColumnAssociations between an NSTableView (Application Kit) and an EODisplayGroup. It is for use in Yellow Box applications only; for an equivalent Java Client class, see the EOTableAssociation class specification.

An EOTableViewAssociation can sort the objects in the display group by the left-to-right order of the table columns. The first EOColumnAssociation to be bound to a table view automatically creates the EOTableViewAssociation; you should rarely need to do so yourself.

An EOTableViewAssociation receives data source and delegate messages from the table view, some of which it handles itself, and some of which it forwards to the appropriate EOColumnAssociations. For more information, see the EOColumnAssociation class specification.

Usable With
NSTableView

Aspects
source Bound to the EODisplayGroup providing objects. This aspect doesn't use a key.
enabled A boolean attribute of the objects, which determines whether each object's row is editable. Note that because EOColumnAssociation 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.
textColor An NSColor attribute of the objects, which determines the color of text for each object's row in the NSTableView.
bold A boolean attribute of the objects, which determines whether each objects row is displayed in bold or regular weight text.
italic A boolean attribute of the objects, which determines whether each objects row is displayed in italic or normal angle text.

Object Keys Taken
dataSource An EOTableViewAssociation responds to some data source messages and forwards others to the appropriate EOColumnAssociation.
delegate An EOTableViewAssociation forwards delegate messages to the appropriate EOColumnAssociations.
target Reserved, but not used.


Example

For an example of using an EOTableViewAssociation, see the EOColumnAssociation class specification.


Method Types

Setting up a table view association
bindToTableView
Sorting
setSortsByColumnOrder
sortsByColumnOrder
Accessing the active EOColumnAssociation
editingAssociation
Table view data source methods
numberOfRowsInTableView
tableViewSetObjectValueForLocation
tableViewObjectValueForLocation
Table view delegate methods
tableViewShouldEditLocation
tableViewWillDisplayCell
Table view notification methods
tableViewSelectionDidChange
Control delegate methods
controlDidFailToFormatStringErrorDescription
controlIsValidObject
controlTextShouldBeginEditing

Constructors

public EOTableViewAssociation(java.lang.Object aDisplayObject)

Creates a new EOTableViewAssociation to manage EOColumnAssociations associated with aDisplayObject, an NSTableView (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)



bindToTableView

public static void bindToTableView(
com.apple.yellow.application.NSTableView aTableView,
EODisplayGroup aDisplayGroup)

Creates an EOTableViewAssociation, binding aTableView to aDisplayGroup, if there isn't already a table view association for aTableView.


Instance Methods


editingAssociation

public EOColumnAssociation editingAssociation()

Returns the EOColumnAssociation for the NSTableView cell being edited, or null if no cell is being edited.


setSortsByColumnOrder

public void setSortsByColumnOrder(boolean flag)

Controls whether the receiver applies a sort ordering to its EODisplayGroup. If flag is true, it builds EOSortOrderings (EOControl) for each of the EOColumnAssociations, collects them into an NSArray based on the left-to-right order of the columns, and assigns them to the display group with setSortOrderings. If flag is false, it doesn't alter the sort ordering of the display group.

An EOTableViewAssociation assigns sort orderings based on the left to right order of the table columns, and reassigns them whenever the user moves a column.

See also: sortingSelector (EOColumnAssociation)


sortsByColumnOrder

public boolean sortsByColumnOrder()

Returns true if the receiver assigns EOSortOrderings (EOControl) to its EODisplayGroup based on the sorting selectors of its EOColumnAssociations, false if it doesn't alter the display group's sort ordering.

Data Source, Delegate, and Notification Methods


controlDidFailToFormatStringErrorDescription

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

Forwards the message to the receiver's editing association.

See also: editingAssociation


controlIsValidObject

public boolean controlIsValidObject(
com.apple.yellow.application.NSControl aTableView,
java.lang.Object anObject)

Forwards the message to the receiver's editing association.

See also: editingAssociation


controlTextShouldBeginEditing

public boolean controlTextShouldBeginEditing(
com.apple.yellow.application.NSControl aTableView,
com.apple.yellow.application.NSText fieldEditor)

Forwards the message to the receiver's editing association.

See also: editingAssociation


numberOfRowsInTableView

public int numberOfRowsInTableView(com.apple.yellow.application.NSTableView aTableView)

Returns the number of displayed objects in the receiver's EODisplayGroup.

See also: displayedObjects (EODisplayGroup)


tableViewObjectValueForLocation

public java.lang.Object tableViewObjectValueForLocation(
com.apple.yellow.application.NSTableView aTableView,
com.apple.yellow.application.NSTableColumn aTableColumn,
int rowIndex)

Forwards the message to aTableColumn's identifier-assumed to be the EOColumnAssociation bound to that column-so that it can provide the value.


tableViewSelectionDidChange

public void tableViewSelectionDidChange(com.apple.yellow.foundation.NSNotification aNotification)

Updates the receiver's EODisplayGroup based on the new selection in the table view.

See also: setSelectionIndexes (EODisplayGroup)


tableViewSetObjectValueForLocation

public void tableViewSetObjectValueForLocation(
com.apple.yellow.application.NSTableView aTableView,
java.lang.Object value,
com.apple.yellow.application.NSTableColumn aTableColumn,
int rowIndex)

Forwards the message to aTableColumn's identifier-assumed to be the EOColumnAssociation bound to that column-so that it can set the 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 0. Otherwise forwards the message to aTableColumn's identifier-assumed to be the EOColumnAssociation bound to that column-and returns its response. Note that because the two associations' enabled aspects 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, textColor, bold, and italic aspects of the object at rowIndex. Then forwards the message to aTableColumn's identifier-assumed to be the EOColumnAssociation bound to that column-allowing it to adjust aCell based on its own enabled aspect.





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