Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Java


[Previous] [Class List] [Next]

NSTableColumn


Inherits from: NSObject
Package: com.apple.yellow.application


Class Description


An NSTableColumn stores the display characteristics and attribute identifier for a column in an NSTableView. The NSTableColumn determines the width and width limits, resizability, and editability of its column in the NSTableView. It also stores two NSCell objects: the header cell, which is used to draw the column header, and the data cell, used to draw the values for each row. You can control the display of the column by setting the subclasses of NSCell used and by setting the font and other display characteristics for these NSCells. For example, you can use the default NSTextFieldCell for displaying string values or substitute an NSImageCell to display pictures.

See the NSTableView class specification for a general overview.


Method Types


Creating an NSTableColumn instance
initWithIdentifier:
Setting the identifier
setIdentifier
identifier
Setting the NSTableView
setTableView
tableView
Controlling size
setWidth
width
setMinWidth
minWidth
setMaxWidth
maxWidth
setResizable
isResizable
sizeToFit
Controlling editability
setEditable
isEditable
Setting component cells
setHeaderCell
headerCell
setDataCell
dataCell

Constructors


NSTableColumn

public NSTableColumn(Object anObject)

<<Description Forthcoming>>

Instance Methods



dataCell

public NSCell dataCell()

Returns the NSCell object used by the NSTableView to draw values for the NSTableColumn.

See Also: setDataCell



headerCell

public NSCell headerCell()

Returns the NSTableHeaderCell object used to draw the header of the NSTableColumn. You can set the column title by sending setStringValue: to this object.

See Also: setHeaderCell



initWithIdentifier:

- (id)initWithIdentifier:anObject

Initializes a newly created NSTableColumn with anObject as its identifier and with an NSTextFieldCell as its data cell. Send setStringValue: to the header cell to set the column title. This is the designated initializer for the NSTableColumn class. Returns this.

See the NSTableView class specification for information on identifiers.

See Also: setIdentifier



identifier

public Object identifier()

Returns the object used by the data source to identify the attribute corresponding to the NSTableColumn.

See Also: setIdentifier



isEditable

public boolean isEditable()

Returns true if the user can edit cells associated with the NSTableColumn by double-clicking the column in the NSTableView, false otherwise. You can initiate editing programmatically regardless of this setting with NSTableView's editColumn:row:withEvent:select: method.

See Also: setEditable



isResizable

public boolean isResizable()

Returns true if the user is allowed to resize the NSTableColumn in its NSTableView, false otherwise. You can change the size programmatically regardless of this setting.

See Also: setWidth, setMinWidth, setMaxWidth, setResizable



maxWidth

public float maxWidth()

Returns the maximum width of the NSTableColumn. The NSTableColumn's width can't be made larger than this either by the user or programmatically.

See Also: minWidth, width, setMaxWidth, - sizeToFit (NSTableView) - autoresizesAllColumnsToFit (NSTableView)



minWidth

public float minWidth()

Returns the minimum width for the NSTableColumn. The NSTableColumn's width can't be made less than this either by the user or programmatically.

See Also: maxWidth, width, setMinWidth, - sizeToFit (NSTableView) - autoresizesAllColumnsToFit (NSTableView)



setDataCell

public void setDataCell(NSCell aCell)

Sets the NSCell used by the NSTableView to draw individual values for the NSTableColumn to aCell. You can use this method to control the font, alignment, and other text attributes for an NSTableColumn. You can also assign a cell to display things other than text-for example, an NSImageCell to display images.

See Also: dataCell



setEditable

public void setEditable(boolean flag)

- (void)setEditable:(BOOL)flag

Controls whether the user can edit cells in the receiver by double-clicking them. If flag is true a double click initiates editing; if flag is false it merely sends the double action to the NSTableView's target. You can initiate editing programmatically regardless of this setting with NSTableView's editColumn:row:withEvent:select: method.

See Also: isEditable



setHeaderCell

public void setHeaderCell(NSCell aCell)

Sets the NSCell used to draw the NSTableColumn's header to aCell. aCell should never be null.

See Also: headerCell



setIdentifier

public void setIdentifier(Object anObject)

Sets the NSTableColumn's identifier to anObject. This object is used by the data source to identify the attribute corresponding to the NSTableColumn.

See Also: identifier



setMaxWidth

public void setMaxWidth(float maxWidth)

Sets the NSTableColumn's maximum width to maxWidth, also adjusting the current width if it's greater than this value. The NSTableView can be made no wider than this, either by the user or programmatically.

See Also: setMinWidth, setWidth, maxWidth, - sizeToFit (NSTableView) - autoresizesAllColumnsToFit (NSTableView)



setMinWidth

public void setMinWidth(float minWidth)

Sets the NSTableColumn's minimum width to minWidth, also adjusting the current width if it's less than this value. The NSTableView can be made no less wide than this, either by the user or programmatically.

See Also: setMaxWidth, setWidth, minWidth, - sizeToFit (NSTableView) - autoresizesAllColumnsToFit (NSTableView)



setResizable

public void setResizable(boolean flag)

Sets whether the user can resize the receiver in its NSTableView. If flag is true the user can resize the receiver; if flag is false the user can't resize it. You can always set the size programmatically.

See Also: isResizable, setWidth, setMinWidth, setMaxWidth



setTableView

public void setTableView(NSTableView aTableView)

Sets aTableView as the NSTableColumn's NSTableView. You should never need to invoke this method; it's invoked automatically when you add an NSTableColumn to an NSTableView.

See Also: tableView, - addTableColumn: (NSTableView)



setWidth

public void setWidth(float newWidth)

Sets the NSTableColumn's width to newWidth. If newWidth exceeds the minimum or maximum width, it's adjusted to the appropriate limiting value. Marks the NSTableView as needing display.

This method posts NSTableViewColumnDidResizeNotification on behalf of the NSTableColumn's NSTableView.

See Also: width, setMinWidth, setMaxWidth, - sizeToFit (NSTableView) - autoresizesAllColumnsToFit (NSTableView)



sizeToFit

public void sizeToFit()

Resizes the NSTableColumn to fit the width of its header cell. If the maximum width is less than the width of the header, the maximum is increased to the header's width. Similarly, if the minimum width is greater than the width of the header, the minimum is reduced to the header's width. Marks the NSTableView as needing display if the width actually changes.

See Also: width, minWidth, maxWidth, - sizeToFit (NSTableView) - autoresizesAllColumnsToFit (NSTableView)



tableView

public NSTableView tableView()

Returns the NSTableView the NSTableColumn belongs to.

See Also: setTableView



width

public float width()

Returns the width of the NSTableColumn.


[Previous] [Next]