RTRowEditor


Inherits From:
NSObject
Declared In:
RTRowEditor.h


Class Description

A RTRowEditor manages the current record of an editable data source. It associates "fields" (text fields, popups, etc.) with columns in the row being edited.

When data is first loaded into the objects managed by the row editor, if the object is an instance of NSControl and the column holds numeric or date/time values, an appropriate formatter will be attached to the control if a formatter does not already exist.

The following table shows what types of interface objects can be associated with SQL columns and how that relationship is managed.

<TABLE BORDER=1 CELLPADDING=4> <TR> <TH>Field Class</TH> <TH>Behavior</TH> </TR> <TR> <TD>NSControl</TD> <TD>The control will be sent the message <CODE>setObjectValue:</CODE> and the value will be retrieved via <CODE>objectValue</CODE>. NSFormatters attached to the control will properly handle NSNumber, NSDecimalNumber, and NSCalendarDate objects.</TD> </TR> <TR> <TD>NSImageView</TD> <TD>An NSImageView should only be associated with a column that contains a blob type. The row editor will create an NSImage with the blob data and place that in the ImageView. When saving an image to the database, the framework attempts to use the same format as the original image. If there was no previous image (such as when inserting a row) the image is saved as a jpeg with a 70% compression setting.</TD> </TR> <TR> <TD>NSMatrix</TD> <TD>If the SQL column is an integer type, then the matrix will be sent the message <CODE>selectCellWithTag:</CODE>. If the column is a string type, then the cell whose stringValue is equal to the value in question will be selected.</TD> </TR> <TR> <TD>NSPopUpButton/Cell</TD> <TD>If the bound column is a string, <CODE>titleOfSelectedItem</CODE> and <CODE>selectItemWithTitle:</CODE> will be used to get/set the value. Otherwise, the PopUp will be sent the message <CODE>setObjectValue:</CODE> and the value will be retrieved via <CODE>objectValue</CODE> which uses the value as the index of the selected item.</TD> </TR> <TR> <TD>NSText</TD> <TD>The value in question will be converted to a string. Upon saving to the database, a string value will be used in the INSERT/UPDATE statement. If the column type is not a string type, the result will be database dependent (i.e. does the server automatically convert strings to the appropriate type).</TD> </TR> <TR> <TD>RTResultListSource</TD> <TD>The result list source will be sent the messages <CODE>selectItemWithValue:</CODE> and <CODE>selectedValue</CODE>.</TD> </TR> </TABLE>


Method Types

- editableDataSource
- setEditableDataSource:
- isDirty
- save:
- revert:
- enabled
- setEnabled:
- columnNames
- fieldEditorForColumnName:
- setFieldEditor:forColumnName:

Instance Methods

columnNames

- (NSArray*)columnNames

Returns an array containing the names of the columns in the editableDataSource's table that are associated with field editors.


editableDataSource

- (RTEditableDataSource *)editableDataSource

No method description.


enabled

- (BOOL)enabled

Returns YES if this row editor has a row to edit and its fields are enabled.


fieldEditorForColumnName:

- (NSView*)fieldEditorForColumnName:(NSString*)colName

Returns the field editor associated with a particular column name.


isDirty

- (BOOL)isDirty

Returns YES if any of the values in the current row monitored by this row editor been modified.


revert:

- (IBAction)revert:(id)sender

Reverts the monitored field editors to show their original values.


save:

- (IBAction)save:(id)sender

If the current row is dirty, executes an INSERT or UPDATE statement to save the row to the database.


setEditableDataSource:

- (void)setEditableDataSource:(RTEditableDataSource *)inSource

No method description.


setEnabled:

- (void)setEnabled:(BOOL)enable

Sets if this row editor's fields are enabled. Refuses to enable the fields unless there is a row to edit.


setFieldEditor:forColumnName:

- (void)setFieldEditor:(NSView*)editor forColumnName:(NSString*)colName

Sets the field editor associated with a particular column name.


Copyright ©2006 by Runtime Labs, Inc.. All Rights Reserved.